summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG/assume.ll
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-07-25 21:13:35 +0000
committerHal Finkel <hfinkel@anl.gov>2014-07-25 21:13:35 +0000
commit930469107d34d66b015f6e48b3f05554819216d8 (patch)
tree3d23c9a2e9b5241703cbcfcc6040619ea65894d1 /llvm/test/Transforms/SimplifyCFG/assume.ll
parentc888757a2dcaf365a115cd250da045e12af013c1 (diff)
downloadbcm5719-llvm-930469107d34d66b015f6e48b3f05554819216d8.tar.gz
bcm5719-llvm-930469107d34d66b015f6e48b3f05554819216d8.zip
Add @llvm.assume, lowering, and some basic properties
This is the first commit in a series that add an @llvm.assume intrinsic which can be used to provide the optimizer with a condition it may assume to be true (when the control flow would hit the intrinsic call). Some basic properties are added here: - llvm.invariant(true) is dead. - llvm.invariant(false) is unreachable (this directly corresponds to the documented behavior of MSVC's __assume(0)), so is llvm.invariant(undef). The intrinsic is tagged as writing arbitrarily, in order to maintain control dependencies. BasicAA has been updated, however, to return NoModRef for any particular location-based query so that we don't unnecessarily block code motion. llvm-svn: 213973
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG/assume.ll')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/assume.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/assume.ll b/llvm/test/Transforms/SimplifyCFG/assume.ll
new file mode 100644
index 00000000000..1d1b96a58ed
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/assume.ll
@@ -0,0 +1,22 @@
+; RUN: opt -simplifycfg -S < %s | FileCheck %s
+
+define void @test1() {
+ call void @llvm.assume(i1 0)
+ ret void
+
+; CHECK-LABEL: @test1
+; CHECK-NOT: llvm.assume
+; CHECK: unreachable
+}
+
+define void @test2() {
+ call void @llvm.assume(i1 undef)
+ ret void
+
+; CHECK-LABEL: @test2
+; CHECK-NOT: llvm.assume
+; CHECK: unreachable
+}
+
+declare void @llvm.assume(i1) nounwind
+
OpenPOWER on IntegriCloud