summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-07-03 17:16:45 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-07-03 17:16:45 +0000
commit83bbe2f418859ea1ae00c2918923b97dc6647a44 (patch)
tree80daa7e361bb5d085e52c9c91eb47503626aa13c /llvm/lib
parent26812c7675d02ec789adbd925a6ab12c3adf7577 (diff)
downloadbcm5719-llvm-83bbe2f418859ea1ae00c2918923b97dc6647a44.tar.gz
bcm5719-llvm-83bbe2f418859ea1ae00c2918923b97dc6647a44.zip
[CodeGen] Make branch funnels pass the machine verifier
We previously marked all the tests with branch funnels as `-verify-machineinstrs=0`. This is an attempt to fix it. 1) `ICALL_BRANCH_FUNNEL` has no defs. Mark it as `let OutOperandList = (outs)` 2) After that we hit an assert: ``` Assertion failed: (Op.getValueType() != MVT::Other && Op.getValueType() != MVT::Glue && "Chain and glue operands should occur at end of operand list!"), function AddOperand, file /Users/francisvm/llvm/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp, line 461. ``` The chain operand was added at the beginning of the operand list. Move that to the end. 3) After that we hit another verifier issue in the pseudo expansion where the registers used in the cmps and jmps are not added to the livein lists. Add the `EFLAGS` to all the new MBBs that we create. PR39436 Differential Review: https://reviews.llvm.org/D54155 llvm-svn: 365058
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp2
-rw-r--r--llvm/lib/Target/X86/X86ExpandPseudo.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index aa6435f3349..cf5e9031478 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6746,7 +6746,6 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
case Intrinsic::icall_branch_funnel: {
SmallVector<SDValue, 16> Ops;
- Ops.push_back(DAG.getRoot());
Ops.push_back(getValue(I.getArgOperand(0)));
int64_t Offset;
@@ -6789,6 +6788,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
Ops.push_back(T.Target);
}
+ Ops.push_back(DAG.getRoot()); // Chain
SDValue N(DAG.getMachineNode(TargetOpcode::ICALL_BRANCH_FUNNEL,
getCurSDLoc(), MVT::Other, Ops),
0);
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index 6cda7ad1c3b..b8624b40f2f 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -87,6 +87,8 @@ void X86ExpandPseudo::ExpandICallBranchFunnel(
const GlobalValue *CombinedGlobal = JTInst->getOperand(1).getGlobal();
auto CmpTarget = [&](unsigned Target) {
+ if (Selector.isReg())
+ MBB->addLiveIn(Selector.getReg());
BuildMI(*MBB, MBBI, DL, TII->get(X86::LEA64r), X86::R11)
.addReg(X86::RIP)
.addImm(1)
@@ -102,6 +104,8 @@ void X86ExpandPseudo::ExpandICallBranchFunnel(
auto CreateMBB = [&]() {
auto *NewMBB = MF->CreateMachineBasicBlock(BB);
MBB->addSuccessor(NewMBB);
+ if (!MBB->isLiveIn(X86::EFLAGS))
+ MBB->addLiveIn(X86::EFLAGS);
return NewMBB;
};
OpenPOWER on IntegriCloud