Skip to content

Commit 0c0c57f

Browse files
committed
Revert "[CodeGen] Postprocess PHI nodes for callbr"
Accidental commit. This reverts commit 7f4c940.
1 parent f97b68e commit 0c0c57f

File tree

3 files changed

+7
-53
lines changed

3 files changed

+7
-53
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,9 @@ SDValue SelectionDAGBuilder::getControlRoot() {
10841084

10851085
void SelectionDAGBuilder::visit(const Instruction &I) {
10861086
// Set up outgoing PHI node register values before emitting the terminator.
1087-
if (I.isTerminator())
1088-
HandlePHINodesInSuccessorBlocks(I.getParent(), true);
1087+
if (I.isTerminator()) {
1088+
HandlePHINodesInSuccessorBlocks(I.getParent());
1089+
}
10891090

10901091
// Increase the SDNodeOrder if dealing with a non-debug instruction.
10911092
if (!isa<DbgInfoIntrinsic>(I))
@@ -2838,9 +2839,6 @@ void SelectionDAGBuilder::visitCallBr(const CallBrInst &I) {
28382839
visitInlineAsm(I);
28392840
CopyToExportRegsIfNeeded(&I);
28402841

2841-
// Set up outgoing PHI node register values before emitting the branch.
2842-
HandlePHINodesInSuccessorBlocks(I.getParent(), false);
2843-
28442842
// Retrieve successors.
28452843
MachineBasicBlock *Return = FuncInfo.MBBMap[I.getDefaultDest()];
28462844

@@ -9992,32 +9990,17 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
99929990
/// directly add them, because expansion might result in multiple MBB's for one
99939991
/// BB. As such, the start of the BB might correspond to a different MBB than
99949992
/// the end.
9995-
void SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(
9996-
const BasicBlock *LLVMBB, bool Preprocess) {
9993+
void
9994+
SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) {
99979995
const Instruction *TI = LLVMBB->getTerminator();
9998-
const CallBrInst *CI = dyn_cast<CallBrInst>(TI);
9996+
99999997
SmallPtrSet<MachineBasicBlock *, 4> SuccsHandled;
100009998

100019999
// Check PHI nodes in successors that expect a value to be available from this
1000210000
// block.
1000310001
for (unsigned succ = 0, e = TI->getNumSuccessors(); succ != e; ++succ) {
1000410002
const BasicBlock *SuccBB = TI->getSuccessor(succ);
1000510003
if (!isa<PHINode>(SuccBB->begin())) continue;
10006-
10007-
if (CI) {
10008-
if (Preprocess) {
10009-
// Don't push PHI node values back before an INLINEASM_BR instruction on
10010-
// the default branch.
10011-
if (SuccBB == CI->getDefaultDest())
10012-
continue;
10013-
} else {
10014-
// Don't push PHI node values back after an INLINEASM_BR instruction on
10015-
// the indirect branch.
10016-
if (SuccBB != CI->getDefaultDest())
10017-
continue;
10018-
}
10019-
}
10020-
1002110004
MachineBasicBlock *SuccMBB = FuncInfo.MBBMap[SuccBB];
1002210005

1002310006
// If this terminator has multiple identical successors (common for

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,7 @@ class SelectionDAGBuilder {
783783
void processIntegerCallValue(const Instruction &I,
784784
SDValue Value, bool IsSigned);
785785

786-
void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB,
787-
bool Preprocess);
786+
void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
788787

789788
void emitInlineAsmError(const CallBase &Call, const Twine &Message);
790789

llvm/test/CodeGen/X86/callbr-asm-phi-nodes.ll

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)