summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopUnroll/basic.ll
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-12-20 16:04:27 +0000
committerJames Molloy <james.molloy@arm.com>2012-12-20 16:04:27 +0000
commit4f6fb953a7597cf617005582e26e2c71ed7cbaa5 (patch)
tree1d3c47d0896c06d408edea3ec9d5dd4ce37b44d4 /llvm/test/Transforms/LoopUnroll/basic.ll
parent3b42bdd58ae3c5ea61afe2f13adbb216ef79dd65 (diff)
downloadbcm5719-llvm-4f6fb953a7597cf617005582e26e2c71ed7cbaa5.tar.gz
bcm5719-llvm-4f6fb953a7597cf617005582e26e2c71ed7cbaa5.zip
Add a new attribute, 'noduplicate'. If a function contains a noduplicate call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call.
Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage). llvm-svn: 170704
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll/basic.ll')
-rw-r--r--llvm/test/Transforms/LoopUnroll/basic.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/basic.ll b/llvm/test/Transforms/LoopUnroll/basic.ll
index eeb3e9a57b0..ab5bc568ede 100644
--- a/llvm/test/Transforms/LoopUnroll/basic.ll
+++ b/llvm/test/Transforms/LoopUnroll/basic.ll
@@ -22,3 +22,26 @@ l1: ; preds = %l1, %entry
l2: ; preds = %l1
ret i32 0
}
+
+; This should not unroll since the call is 'noduplicate'.
+
+; CHECK: @test2
+define i32 @test2(i8** %P) nounwind ssp {
+entry:
+ br label %l1
+
+l1: ; preds = %l1, %entry
+ %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
+; CHECK: call void @f()
+; CHECK-NOT: call void @f()
+ call void @f() noduplicate
+ %inc = add nsw i32 %x.0, 1
+ %exitcond = icmp eq i32 %inc, 3
+ br i1 %exitcond, label %l2, label %l1
+
+l2: ; preds = %l1
+ ret i32 0
+; CHECK: }
+}
+
+declare void @f()
OpenPOWER on IntegriCloud