diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-11-25 05:22:53 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-11-25 05:22:53 +0000 |
commit | 215aad562cbff81f5b1ce5b570076b88a87998f8 (patch) | |
tree | b0ffce9779a5640d8db33fad5fb143012ad44b96 /test | |
parent | f02a188899769cde2315c964f0fbed1d024b7514 (diff) | |
download | external_llvm-215aad562cbff81f5b1ce5b570076b88a87998f8.zip external_llvm-215aad562cbff81f5b1ce5b570076b88a87998f8.tar.gz external_llvm-215aad562cbff81f5b1ce5b570076b88a87998f8.tar.bz2 |
Merging r195492:
------------------------------------------------------------------------
r195492 | arsenm | 2013-11-22 11:24:37 -0800 (Fri, 22 Nov 2013) | 1 line
StructurizeCFG: Fix inverting a branch on an argument
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@195605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/StructurizeCFG/branch-on-argument.ll | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Transforms/StructurizeCFG/branch-on-argument.ll b/test/Transforms/StructurizeCFG/branch-on-argument.ll new file mode 100644 index 0000000..4eba0cd --- /dev/null +++ b/test/Transforms/StructurizeCFG/branch-on-argument.ll @@ -0,0 +1,47 @@ +; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s + +; CHECK-LABEL: @invert_branch_on_arg_inf_loop( +; CHECK: entry: +; CHECK: %arg.inv = xor i1 %arg, true +; CHECK: phi i1 [ false, %Flow1 ], [ %arg.inv, %entry ] +define void @invert_branch_on_arg_inf_loop(i32 addrspace(1)* %out, i1 %arg) { +entry: + br i1 %arg, label %for.end, label %for.body + +for.body: ; preds = %entry, %for.body + store i32 999, i32 addrspace(1)* %out, align 4 + br label %for.body + +for.end: ; preds = %Flow + ret void +} + + +; CHECK-LABEL: @invert_branch_on_arg_jump_into_loop( +; CHECK: entry: +; CHECK: %arg.inv = xor i1 %arg, true +; CHECK: Flow: +; CHECK: Flow1: +define void @invert_branch_on_arg_jump_into_loop(i32 addrspace(1)* %out, i32 %n, i1 %arg) { +entry: + br label %for.body + +for.body: + %i = phi i32 [0, %entry], [%i.inc, %end.loop] + %ptr = getelementptr i32 addrspace(1)* %out, i32 %i + store i32 %i, i32 addrspace(1)* %ptr, align 4 + br i1 %arg, label %mid.loop, label %end.loop + +mid.loop: + store i32 333, i32 addrspace(1)* %out, align 4 + br label %for.end + +end.loop: + %i.inc = add i32 %i, 1 + %cmp = icmp ne i32 %i.inc, %n + br i1 %cmp, label %for.body, label %for.end + +for.end: + ret void +} + |