diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 17:15:14 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 17:15:14 +0000 |
commit | 989779ccc746eb7d7ab4774f25d7a3e1be14923e (patch) | |
tree | 42069618e091c6a3298117623a16c4514cb5a512 /test/Transforms | |
parent | b0dfceec2282d4af1e87042f1db8ed51c5330132 (diff) | |
download | external_llvm-989779ccc746eb7d7ab4774f25d7a3e1be14923e.zip external_llvm-989779ccc746eb7d7ab4774f25d7a3e1be14923e.tar.gz external_llvm-989779ccc746eb7d7ab4774f25d7a3e1be14923e.tar.bz2 |
MemoryBuiltins: Fix operator new bits.
We really don't want to optimize malloc return value checks away.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstSimplify/call.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/call.ll b/test/Transforms/InstSimplify/call.ll index aa3b086..89d4238 100644 --- a/test/Transforms/InstSimplify/call.ll +++ b/test/Transforms/InstSimplify/call.ll @@ -121,3 +121,23 @@ cast.end: ; preds = %cast.notnull, %entr } declare noalias i8* @_Znwm(i64) + +define i8* @malloc_can_return_null() { +entry: + %call = tail call noalias i8* @malloc(i64 8) + %cmp = icmp eq i8* %call, null + br i1 %cmp, label %cast.end, label %cast.notnull + +cast.notnull: ; preds = %entry + %add.ptr = getelementptr inbounds i8* %call, i64 4 + br label %cast.end + +cast.end: ; preds = %cast.notnull, %entry + %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ] + ret i8* %cast.result + +; CHECK-LABEL: @malloc_can_return_null +; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull +} + +declare noalias i8* @malloc(i64) |