1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 08:23:21 +01:00
llvm-mirror/test/Transforms/InstSimplify/rem.ll
Duncan Sands 750a066af1 Move some rem transforms out of instcombine and into instsimplify.
This automagically provides a transform noticed by my super-optimizer
as occurring quite often: "rem x, (select cond, x, 1)" -> 0.

llvm-svn: 130694
2011-05-02 16:27:02 +00:00

18 lines
360 B
LLVM

; RUN: opt < %s -instsimplify -S | FileCheck %s
define i32 @select1(i32 %x, i1 %b) {
; CHECK: @select1
%rhs = select i1 %b, i32 %x, i32 1
%rem = srem i32 %x, %rhs
ret i32 %rem
; CHECK: ret i32 0
}
define i32 @select2(i32 %x, i1 %b) {
; CHECK: @select2
%rhs = select i1 %b, i32 %x, i32 1
%rem = urem i32 %x, %rhs
ret i32 %rem
; CHECK: ret i32 0
}