summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-19 10:26:02 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-19 10:26:02 +0000
commit03300ecaee3ef853669582bcadec34170dbf515f (patch)
treeb04a2cf356a8a3f71b24b3329abd348e369a6595 /test
parent6bf57b02724e312399bf6d24ce43cfa6564fea11 (diff)
downloadllvm-03300ecaee3ef853669582bcadec34170dbf515f.tar.gz
llvm-03300ecaee3ef853669582bcadec34170dbf515f.tar.bz2
llvm-03300ecaee3ef853669582bcadec34170dbf515f.tar.xz
Move the handling of unanalyzable branches out of the loop-driven chain
formation phase and into the initial walk of the basic blocks. We essentially pre-merge all blocks where unanalyzable fallthrough exists, as we won't be able to update the terminators effectively after any reorderings. This is quite a bit more principled as there may be CFGs where the second half of the unanalyzable pair has some analyzable predecessor that gets placed first. Then it may get placed next, implicitly breaking the unanalyzable branch even though we never even looked at the part that isn't analyzable. I've included a test case that triggers this (thanks Benjamin yet again!), and I'm hoping to synthesize some more general ones as I dig into related issues. Also, to make this new scheme work we have to be able to handle branches into the middle of a chain, so add this check. We always fallback on the incoming ordering. Finally, this starts to really underscore a known limitation of the current implementation -- we don't consider broken predecessors when merging successors. This can caused major missed opportunities, and is something I'm planning on looking at next (modulo more bug reports). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/block-placement.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGen/X86/block-placement.ll b/test/CodeGen/X86/block-placement.ll
index 6220ae3286..859a702732 100644
--- a/test/CodeGen/X86/block-placement.ll
+++ b/test/CodeGen/X86/block-placement.ll
@@ -393,3 +393,28 @@ exit:
%merge = phi i32 [ 3, %step ], [ 6, %entry ]
ret i32 %merge
}
+
+define void @fpcmp_unanalyzable_branch(i1 %cond) {
+entry:
+ br i1 %cond, label %entry.if.then_crit_edge, label %lor.lhs.false
+
+entry.if.then_crit_edge:
+ %.pre14 = load i8* undef, align 1, !tbaa !0
+ br label %if.then
+
+lor.lhs.false:
+ br i1 undef, label %if.end, label %exit
+
+exit:
+ %cmp.i = fcmp une double 0.000000e+00, undef
+ br i1 %cmp.i, label %if.then, label %if.end
+
+if.then:
+ %0 = phi i8 [ %.pre14, %entry.if.then_crit_edge ], [ undef, %exit ]
+ %1 = and i8 %0, 1
+ store i8 %1, i8* undef, align 4, !tbaa !0
+ br label %if.end
+
+if.end:
+ ret void
+}