summaryrefslogtreecommitdiff
path: root/test/Transforms/CodeGenPrepare
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-15 07:25:29 +0000
committerChris Lattner <sabre@nondot.org>2011-01-15 07:25:29 +0000
commit94e8e0cfbe13cdbdf7addc6e36df863cab92e4c9 (patch)
tree98f51b117a90652f64838caa862d98cbebdfe687 /test/Transforms/CodeGenPrepare
parent7579609bfe0d915b6c2d8dc094a132d793ec8855 (diff)
downloadllvm-94e8e0cfbe13cdbdf7addc6e36df863cab92e4c9.tar.gz
llvm-94e8e0cfbe13cdbdf7addc6e36df863cab92e4c9.tar.bz2
llvm-94e8e0cfbe13cdbdf7addc6e36df863cab92e4c9.tar.xz
Now that instruction optzns can update the iterator as they go, we can
have objectsize folding recursively simplify away their result when it folds. It is important to catch this here, because otherwise we won't eliminate the cross-block values at isel and other times. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/CodeGenPrepare')
-rw-r--r--test/Transforms/CodeGenPrepare/basic.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/CodeGenPrepare/basic.ll b/test/Transforms/CodeGenPrepare/basic.ll
new file mode 100644
index 0000000000..c3e57b4d20
--- /dev/null
+++ b/test/Transforms/CodeGenPrepare/basic.ll
@@ -0,0 +1,24 @@
+; RUN: opt -codegenprepare %s -S -o - | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+; CHECK: @test1
+define i32 @test1(i8* %ptr) nounwind ssp noredzone align 2 {
+entry:
+ %0 = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
+ %1 = icmp ugt i64 %0, 3
+ br i1 %1, label %T, label %trap
+
+; CHECK: br i1 true, label
+trap: ; preds = %0, %entry
+ tail call void @llvm.trap() noreturn nounwind
+ unreachable
+
+T:
+ ret i32 4
+}
+
+declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
+
+declare void @llvm.trap() nounwind