[llvm] r277841 - GlobalISel: clear pending phis after MachineFunction translated
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 5 10:50:36 PDT 2016
Author: tnorthover
Date: Fri Aug 5 12:50:36 2016
New Revision: 277841
URL: http://llvm.org/viewvc/llvm-project?rev=277841&view=rev
Log:
GlobalISel: clear pending phis after MachineFunction translated
Test is just reordering the existing functions (it would trigger for any
function after one with a phi).
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=277841&r1=277840&r2=277841&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Fri Aug 5 12:50:36 2016
@@ -249,6 +249,8 @@ void IRTranslator::finishPendingPhis() {
MIB.addMBB(BBToMBB[PI->getIncomingBlock(i)]);
}
}
+
+ PendingPHIs.clear();
}
bool IRTranslator::translate(const Instruction &Inst) {
@@ -327,6 +329,8 @@ bool IRTranslator::runOnMachineFunction(
MRI = &MF.getRegInfo();
DL = &F.getParent()->getDataLayout();
+ assert(PendingPHIs.empty() && "stale PHIs");
+
// Setup the arguments.
MachineBasicBlock &MBB = getOrCreateBB(F.front());
MIRBuilder.setMBB(MBB);
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll?rev=277841&r1=277840&r2=277841&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll Fri Aug 5 12:50:36 2016
@@ -296,16 +296,6 @@ define void @intrinsics(i32 %cur, i32 %b
ret void
}
-
-; CHECK-LABEL: name: unreachable
-; CHECK: G_ADD
-; CHECK-NEXT: {{^$}}
-; CHECK-NEXT: ...
-define void @unreachable(i32 %a) {
- %sum = add i32 %a, %a
- unreachable
-}
-
; CHECK-LABEL: name: test_phi
; CHECK: G_BRCOND s1 {{%.*}}, %[[TRUE:bb\.[0-9]+]]
; CHECK: G_BR unsized %[[FALSE:bb\.[0-9]+]]
@@ -318,7 +308,6 @@ define void @unreachable(i32 %a) {
; CHECK: [[RES:%[0-9]+]](32) = PHI [[RES1]], %[[TRUE]], [[RES2]], %[[FALSE]]
; CHECK: %w0 = COPY [[RES]]
-
define i32 @test_phi(i32* %addr1, i32* %addr2, i1 %tst) {
br i1 %tst, label %true, label %false
@@ -334,3 +323,12 @@ end:
%res = phi i32 [%res1, %true], [%res2, %false]
ret i32 %res
}
+
+; CHECK-LABEL: name: unreachable
+; CHECK: G_ADD
+; CHECK-NEXT: {{^$}}
+; CHECK-NEXT: ...
+define void @unreachable(i32 %a) {
+ %sum = add i32 %a, %a
+ unreachable
+}
More information about the llvm-commits
mailing list