diff options
author | James Molloy <james.molloy@arm.com> | 2012-12-20 16:04:27 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2012-12-20 16:04:27 +0000 |
commit | 4f6fb953a7597cf617005582e26e2c71ed7cbaa5 (patch) | |
tree | 1d3c47d0896c06d408edea3ec9d5dd4ce37b44d4 /llvm/test/Transforms/LoopRotate/basic.ll | |
parent | 3b42bdd58ae3c5ea61afe2f13adbb216ef79dd65 (diff) | |
download | bcm5719-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/LoopRotate/basic.ll')
-rw-r--r-- | llvm/test/Transforms/LoopRotate/basic.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopRotate/basic.ll b/llvm/test/Transforms/LoopRotate/basic.ll index b7bcb21d56f..cb5d3f9be8a 100644 --- a/llvm/test/Transforms/LoopRotate/basic.ll +++ b/llvm/test/Transforms/LoopRotate/basic.ll @@ -33,3 +33,29 @@ for.end: ; preds = %for.cond declare void @g(i32*) +; CHECK: @test2 +define void @test2() nounwind ssp { +entry: + %array = alloca [20 x i32], align 16 + br label %for.cond + +for.cond: ; preds = %for.body, %entry + %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %cmp = icmp slt i32 %i.0, 100 +; CHECK: call void @f +; CHECK-NOT: call void @f + call void @f() noduplicate + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %inc = add nsw i32 %i.0, 1 + call void @h() + br label %for.cond + +for.end: ; preds = %for.cond + ret void +; CHECK: } +} + +declare void @f() noduplicate +declare void @h() |