diff options
| author | Duncan Sands <baldrick@free.fr> | 2011-10-28 19:01:20 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2011-10-28 19:01:20 +0000 |
| commit | 280bc553b38014bd459b55cc56b78a413058bc2d (patch) | |
| tree | 8711001b33e93873d40e32a1015d12863d9ffbab /llvm/test/Transforms/InstSimplify/compare.ll | |
| parent | 7989f15d3788ae9c8e78606908ec0166f0e6d491 (diff) | |
| download | bcm5719-llvm-280bc553b38014bd459b55cc56b78a413058bc2d.tar.gz bcm5719-llvm-280bc553b38014bd459b55cc56b78a413058bc2d.zip | |
The expression icmp eq (select (icmp eq x, 0), 1, x), 0 folds to false.
Spotted by my super-optimizer in 186.crafty and 450.soplex. We really
need a proper infrastructure for handling generalizations of this kind
of thing (which occur a lot), however this case is so simple that I decided
to go ahead and implement it directly.
llvm-svn: 143214
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/compare.ll')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/compare.ll | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll index 57727c9ab76..df331225743 100644 --- a/llvm/test/Transforms/InstSimplify/compare.ll +++ b/llvm/test/Transforms/InstSimplify/compare.ll @@ -204,6 +204,15 @@ define i1 @select4(i1 %cond) { ; CHECK: ret i1 %cond } +define i1 @select5(i32 %x) { +; CHECK: @select5 + %c = icmp eq i32 %x, 0 + %s = select i1 %c, i32 1, i32 %x + %c2 = icmp eq i32 %s, 0 + ret i1 %c2 +; CHECK: ret i1 false +} + define i1 @urem1(i32 %X, i32 %Y) { ; CHECK: @urem1 %A = urem i32 %X, %Y |

