diff options
author | Duncan Sands <baldrick@free.fr> | 2011-02-03 09:37:39 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-02-03 09:37:39 +0000 |
commit | 50ca4d37f7f3b460c6441eb5ad14625a7d86b5d9 (patch) | |
tree | 240e5626072424c8c5d65d781f4ce7420d42a605 /test/Transforms/InstSimplify | |
parent | ee64684710486bf8a0cd156d0516e0a7caecfb0b (diff) | |
download | llvm-50ca4d37f7f3b460c6441eb5ad14625a7d86b5d9.tar.gz llvm-50ca4d37f7f3b460c6441eb5ad14625a7d86b5d9.tar.bz2 llvm-50ca4d37f7f3b460c6441eb5ad14625a7d86b5d9.tar.xz |
Improve threading of comparisons over select instructions (spotted by my
auto-simplifier). This has a big impact on Ada code, but not much else.
Unfortunately the impact is mostly negative! This is due to PR9004 (aka
SCCP failing to resolve conditional branch conditions in the destination
blocks of the branch), in which simple correlated expressions are not
resolved but complicated ones are, so simplifying has a bad effect!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r-- | test/Transforms/InstSimplify/2011-01-18-Compare.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/2011-01-18-Compare.ll b/test/Transforms/InstSimplify/2011-01-18-Compare.ll index ed358443d6..e08ee2c6fb 100644 --- a/test/Transforms/InstSimplify/2011-01-18-Compare.ll +++ b/test/Transforms/InstSimplify/2011-01-18-Compare.ll @@ -132,3 +132,38 @@ define i1 @ashr(i32 %x) { ret i1 %c ; CHECK: ret i1 false } + +define i1 @select1(i1 %cond) { +; CHECK: @select1 + %s = select i1 %cond, i32 1, i32 0 + %c = icmp eq i32 %s, 1 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select2(i1 %cond) { +; CHECK: @select2 + %x = zext i1 %cond to i32 + %s = select i1 %cond, i32 %x, i32 0 + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select3(i1 %cond) { +; CHECK: @select3 + %x = zext i1 %cond to i32 + %s = select i1 %cond, i32 1, i32 %x + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select4(i1 %cond) { +; CHECK: @select4 + %invert = xor i1 %cond, 1 + %s = select i1 %invert, i32 0, i32 1 + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} |