Add test case for r311511
This also changes the TailDuplicator to be configured explicitely
pre/post regalloc rather than relying on the isSSA() flag. This was
necessary to have `llc -run-pass` work reliably.
llvm-svn: 311520
diff --git a/llvm/lib/CodeGen/TailDuplication.cpp b/llvm/lib/CodeGen/TailDuplication.cpp
index 489a607..131b9a2 100644
--- a/llvm/lib/CodeGen/TailDuplication.cpp
+++ b/llvm/lib/CodeGen/TailDuplication.cpp
@@ -52,7 +52,10 @@
auto MBPI = &getAnalysis<MachineBranchProbabilityInfo>();
- Duplicator.initMF(MF, MBPI, /* LayoutMode */ false);
+ // TODO: Querying isSSA() to determine pre-/post-regalloc is fragile, better
+ // split this into two passes instead.
+ bool PreRegAlloc = MF.getRegInfo().isSSA();
+ Duplicator.initMF(MF, PreRegAlloc, MBPI, /* LayoutMode */ false);
bool MadeChange = false;
while (Duplicator.tailDuplicateBlocks())