diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-09-07 21:28:34 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-09-07 21:28:34 +0000 |
commit | 93873cc10e8f70a2e0d87680ef46b96f122e82d5 (patch) | |
tree | 33b5f8e1badcf09dddf8fe8beadaafaa45bd4a37 /llvm/test/Transforms/InstCombine/assume.ll | |
parent | 7e1844940e8550e7b79b78091fd1bce043e257ea (diff) | |
download | bcm5719-llvm-93873cc10e8f70a2e0d87680ef46b96f122e82d5.tar.gz bcm5719-llvm-93873cc10e8f70a2e0d87680ef46b96f122e82d5.zip |
Check for all known bits on ret in InstCombine
From a combination of @llvm.assume calls (and perhaps through other means, such
as range metadata), it is possible that all bits of a return value might be
known. Previously, InstCombine did not check for this (which is understandable
given assumptions of constant propagation), but means that we'd miss simple
cases where assumptions are involved.
llvm-svn: 217346
Diffstat (limited to 'llvm/test/Transforms/InstCombine/assume.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/assume.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/assume.ll b/llvm/test/Transforms/InstCombine/assume.ll index 286ca1e8d77..b328fb684aa 100644 --- a/llvm/test/Transforms/InstCombine/assume.ll +++ b/llvm/test/Transforms/InstCombine/assume.ll @@ -43,6 +43,18 @@ entry: ; Function Attrs: nounwind declare void @llvm.assume(i1) #1 +define i32 @simple(i32 %a) #1 { +entry: + +; CHECK-LABEL: @simple +; CHECK: call void @llvm.assume +; CHECK: ret i32 4 + + %cmp = icmp eq i32 %a, 4 + tail call void @llvm.assume(i1 %cmp) + ret i32 %a +} + ; Function Attrs: nounwind uwtable define i32 @can1(i1 %a, i1 %b, i1 %c) { entry: |