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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277841 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tim Northover 2016-08-05 17:50:36 +00:00
parent bdea192076
commit 47dc780f20
2 changed files with 13 additions and 11 deletions

View File

@ -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(MachineFunction &MF) {
MRI = &MF.getRegInfo();
DL = &F.getParent()->getDataLayout();
assert(PendingPHIs.empty() && "stale PHIs");
// Setup the arguments.
MachineBasicBlock &MBB = getOrCreateBB(F.front());
MIRBuilder.setMBB(MBB);

View File

@ -296,16 +296,6 @@ define void @intrinsics(i32 %cur, i32 %bits) {
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
}