diff options
| author | Dan Gohman <gohman@apple.com> | 2011-06-16 20:57:14 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2011-06-16 20:57:14 +0000 |
| commit | 00fa9634d59fc844d51376d2efd2780ddd37ff6a (patch) | |
| tree | 8845b2e45e3a8f8a5c5515f00346671d6cb03d40 /llvm/test/Transforms | |
| parent | 5964a0154b1b97b96e72368fa761228b906cabf4 (diff) | |
| download | bcm5719-llvm-00fa9634d59fc844d51376d2efd2780ddd37ff6a.tar.gz bcm5719-llvm-00fa9634d59fc844d51376d2efd2780ddd37ff6a.zip | |
Fix ARCOpt to insert releases on both successors of an invoke rather
than trying to insert them immediately after the invoke.
llvm-svn: 133188
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/ObjCARC/invoke.ll | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ObjCARC/invoke.ll b/llvm/test/Transforms/ObjCARC/invoke.ll new file mode 100644 index 00000000000..a1b87d230bd --- /dev/null +++ b/llvm/test/Transforms/ObjCARC/invoke.ll @@ -0,0 +1,67 @@ +; RUN: opt -S -objc-arc < %s | FileCheck %s + +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) +declare i8* @objc_msgSend(i8*, i8*, ...) +declare void @use_pointer(i8*) +declare void @callee() + +; ARCOpt shouldn't try to move the releases to the block containing the invoke. + +; CHECK: define void @test0( +; CHECK: invoke.cont: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: ret void +; CHECK: lpad: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: ret void +define void @test0(i8* %zipFile) { +entry: + call i8* @objc_retain(i8* %zipFile) nounwind + call void @use_pointer(i8* %zipFile) + invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*)*)(i8* %zipFile) + to label %invoke.cont unwind label %lpad + +invoke.cont: ; preds = %entry + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void + +lpad: ; preds = %entry + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void +} + +; ARCOpt should move the release before the callee calls. + +; CHECK: define void @test1( +; CHECK: invoke.cont: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: call void @callee() +; CHECK: br label %done +; CHECK: lpad: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: call void @callee() +; CHECK: br label %done +; CHECK: done: +; CHECK-NEXT: ret void +define void @test1(i8* %zipFile) { +entry: + call i8* @objc_retain(i8* %zipFile) nounwind + call void @use_pointer(i8* %zipFile) + invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*)*)(i8* %zipFile) + to label %invoke.cont unwind label %lpad + +invoke.cont: ; preds = %entry + call void @callee() + br label %done + +lpad: ; preds = %entry + call void @callee() + br label %done + +done: + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void +} + +!0 = metadata !{} |

