diff options
author | Mark Lacey <mark.lacey@apple.com> | 2016-05-20 18:39:11 +0000 |
---|---|---|
committer | Mark Lacey <mark.lacey@apple.com> | 2016-05-20 18:39:11 +0000 |
commit | 04be7e88ef8a846da184096c898b76d226ce034c (patch) | |
tree | 369a51620cdd4dcb1fa7be5f31f31f50f527189a /test/Transforms/MergeFunc | |
parent | 8cd572cb8ff5220342508ef830f6208ccd0cdc28 (diff) |
Functions with differing phis should not be merged.
Check that the incoming blocks of phi nodes are identical, and block
function merging if they are not.
rdar://problem/26255167
Differential Revision: http://reviews.llvm.org/D20462
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/MergeFunc')
-rw-r--r-- | test/Transforms/MergeFunc/phi-check-blocks.ll | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/Transforms/MergeFunc/phi-check-blocks.ll b/test/Transforms/MergeFunc/phi-check-blocks.ll new file mode 100644 index 00000000000..b2de9a0c028 --- /dev/null +++ b/test/Transforms/MergeFunc/phi-check-blocks.ll @@ -0,0 +1,50 @@ +; RUN: opt -S -mergefunc < %s | FileCheck %s + +; Ensure that we do not merge functions that are identical with the +; exception of the order of the incoming blocks to a phi. + +; CHECK-LABEL: define linkonce_odr hidden i1 @first(i2) +define linkonce_odr hidden i1 @first(i2) { +entry: +; CHECK: switch i2 + switch i2 %0, label %default [ + i2 0, label %L1 + i2 1, label %L2 + i2 -2, label %L3 + ] +default: + unreachable +L1: + br label %done +L2: + br label %done +L3: + br label %done +done: + %result = phi i1 [ true, %L1 ], [ false, %L2 ], [ false, %L3 ] +; CHECK: ret i1 + ret i1 %result +} + +; CHECK-LABEL: define linkonce_odr hidden i1 @second(i2) +define linkonce_odr hidden i1 @second(i2) { +entry: +; CHECK: switch i2 + switch i2 %0, label %default [ + i2 0, label %L1 + i2 1, label %L2 + i2 -2, label %L3 + ] +default: + unreachable +L1: + br label %done +L2: + br label %done +L3: + br label %done +done: + %result = phi i1 [ true, %L3 ], [ false, %L2 ], [ false, %L1 ] +; CHECK: ret i1 + ret i1 %result +} |