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 | 67ae13575900e8efd056672987249fd0adbf5e73 (patch) | |
tree | c297968f698f92b4b2d7b06c6d892a2299061887 /test/Transforms/LoopUnroll | |
parent | 6af228a92a7b8414fa3c1b3c37ee659d32e66e1b (diff) | |
download | external_llvm-67ae13575900e8efd056672987249fd0adbf5e73.zip external_llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.gz external_llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.bz2 |
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).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopUnroll')
-rw-r--r-- | test/Transforms/LoopUnroll/basic.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/LoopUnroll/basic.ll b/test/Transforms/LoopUnroll/basic.ll index eeb3e9a..ab5bc56 100644 --- a/test/Transforms/LoopUnroll/basic.ll +++ b/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() |