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/JumpThreading/basic.ll | |
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/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index 4627137..f889c02 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -476,3 +476,39 @@ exit1: ; CHECK: } } +; In this test we check that block duplication is inhibited by the presence +; of a function with the 'noduplicate' attribute. + +declare void @g() +declare void @j() +declare void @k() + +; CHECK: define void @h(i32 %p) { +define void @h(i32 %p) { + %x = icmp ult i32 %p, 5 + br i1 %x, label %l1, label %l2 + +l1: + call void @j() + br label %l3 + +l2: + call void @k() + br label %l3 + +l3: +; CHECK: call void @g() noduplicate +; CHECK-NOT: call void @g() noduplicate + call void @g() noduplicate + %y = icmp ult i32 %p, 5 + br i1 %y, label %l4, label %l5 + +l4: + call void @j() + ret void + +l5: + call void @k() + ret void +; CHECK: } +} |