diff options
author | Dan Gohman <gohman@apple.com> | 2012-04-13 01:08:28 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-04-13 01:08:28 +0000 |
commit | 6c189ecbe6d11583dc54289a2e8d8f35add01c82 (patch) | |
tree | b3a1c55fccb4ea87d784a8be2b10e9c7b81d143b /test/Transforms | |
parent | aab3c0cb077f741af3447cc030c28bedd23b491c (diff) | |
download | external_llvm-6c189ecbe6d11583dc54289a2e8d8f35add01c82.zip external_llvm-6c189ecbe6d11583dc54289a2e8d8f35add01c82.tar.gz external_llvm-6c189ecbe6d11583dc54289a2e8d8f35add01c82.tar.bz2 |
Use the new Use-aware dominates method to apply the objc runtime
library return value optimization for phi uses. Even when the
phi itself is not dominated, the specific use may be dominated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/ObjCARC/contract.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/ObjCARC/contract.ll b/test/Transforms/ObjCARC/contract.ll index 04ae3ca..c48f8a5 100644 --- a/test/Transforms/ObjCARC/contract.ll +++ b/test/Transforms/ObjCARC/contract.ll @@ -143,3 +143,21 @@ define i8* @test7(i8* %p) { %2 = tail call i8* @objc_autoreleaseReturnValue(i8* %p) ret i8* %p } + +; Do the return value substitution for PHI nodes too. + +; CHECK: define i8* @test8( +; CHECK: %retval = phi i8* [ %p, %if.then ], [ null, %entry ] +; CHECK: } +define i8* @test8(i1 %x, i8* %c) { +entry: + br i1 %x, label %return, label %if.then + +if.then: ; preds = %entry + %p = call i8* @objc_retain(i8* %c) nounwind + br label %return + +return: ; preds = %if.then, %entry + %retval = phi i8* [ %c, %if.then ], [ null, %entry ] + ret i8* %retval +} |