summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2020-01-07 13:43:04 -0800
committerBill Wendling <isanbard@gmail.com>2020-01-07 13:44:08 -0800
commite886e762dd7972064b948119f9af2f6be312b995 (patch)
tree5b22f2ed2a7546c51fea8c8f5641e02070f3ee8e /llvm/lib
parent06d122bc4236bf0d049eab72d883c98cfc2a9901 (diff)
downloadbcm5719-llvm-e886e762dd7972064b948119f9af2f6be312b995.tar.gz
bcm5719-llvm-e886e762dd7972064b948119f9af2f6be312b995.zip
Revert "Allow output constraints on "asm goto""
This reverts commit 52366088a8e42c2f1e96e8430b84b8b65ec3f7bc. I accidentally pushed this before supporting changes.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp3
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp11
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp50
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp2
-rw-r--r--llvm/lib/IR/Verifier.cpp2
5 files changed, 18 insertions, 50 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 731c1cea0dc..1a17f633ae1 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -6419,6 +6419,9 @@ bool LLParser::ParseCallBr(Instruction *&Inst, PerFunctionState &PFS) {
/*IsCall=*/true))
return true;
+ if (isa<InlineAsm>(Callee) && !Ty->getReturnType()->isVoidTy())
+ return Error(RetTypeLoc, "asm-goto outputs not supported");
+
// Set up the Attribute for the function.
SmallVector<Value *, 8> Args;
SmallVector<AttributeSet, 8> ArgAttrs;
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 8928dc858d5..f433c4b6c90 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1109,17 +1109,6 @@ bool MachineBasicBlock::canSplitCriticalEdge(
if (Succ->isEHPad())
return false;
- // Splitting the critical edge to a callbr's indirect block isn't advised.
- // Don't do it in this generic function.
- if (Succ->hasAddressTaken())
- if (auto *cbr = dyn_cast<CallBrInst>(getBasicBlock()->getTerminator()))
- if (auto *bb = Succ->getBasicBlock())
- if (cbr->getDefaultDest() != bb)
- if (llvm::any_of(cbr->getIndirectDests(), [&](const BasicBlock *succ){
- return succ == bb;
- }))
- return false;
-
const MachineFunction *MF = getParent();
// Performance might be harmed on HW that implements branching using exec mask
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index cbafd387a62..ca57e51268e 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -633,30 +633,17 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
}
// Count the number of landing pad successors.
- SmallPtrSet<const MachineBasicBlock*, 4> LandingPadSuccs;
- for (const auto *succ : MBB->successors()) {
- if (succ->isEHPad())
- LandingPadSuccs.insert(succ);
- if (!FunctionBlocks.count(succ))
- report("MBB has successor that isn't part of the function.", MBB);
- if (!MBBInfoMap[succ].Preds.count(MBB)) {
- report("Inconsistent CFG", MBB);
- errs() << "MBB is not in the predecessor list of the successor "
- << printMBBReference(*succ) << ".\n";
- }
- }
-
- // Count the number of INLINEASM_BR indirect pad successors.
- SmallPtrSet<const MachineBasicBlock*, 4> IndirectPadSuccs;
- for (const auto *succ : MBB->successors()) {
- if (succ->isInlineAsmBrIndirectPad())
- IndirectPadSuccs.insert(succ);
- if (!FunctionBlocks.count(succ))
+ SmallPtrSet<MachineBasicBlock*, 4> LandingPadSuccs;
+ for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
+ E = MBB->succ_end(); I != E; ++I) {
+ if ((*I)->isEHPad())
+ LandingPadSuccs.insert(*I);
+ if (!FunctionBlocks.count(*I))
report("MBB has successor that isn't part of the function.", MBB);
- if (!MBBInfoMap[succ].Preds.count(MBB)) {
+ if (!MBBInfoMap[*I].Preds.count(MBB)) {
report("Inconsistent CFG", MBB);
errs() << "MBB is not in the predecessor list of the successor "
- << printMBBReference(*succ) << ".\n";
+ << printMBBReference(*(*I)) << ".\n";
}
}
@@ -697,13 +684,11 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
// It's possible that the block legitimately ends with a noreturn
// call or an unreachable, in which case it won't actually fall
// out the bottom of the function.
- } else if (MBB->succ_size() == LandingPadSuccs.size() ||
- MBB->succ_size() == IndirectPadSuccs.size()) {
+ } else if (MBB->succ_size() == LandingPadSuccs.size()) {
// It's possible that the block legitimately ends with a noreturn
// call or an unreachable, in which case it won't actually fall
// out of the block.
- } else if (MBB->succ_size() != 1 + LandingPadSuccs.size() &&
- MBB->succ_size() != 1 + IndirectPadSuccs.size()) {
+ } else if (MBB->succ_size() != 1+LandingPadSuccs.size()) {
report("MBB exits via unconditional fall-through but doesn't have "
"exactly one CFG successor!", MBB);
} else if (!MBB->isSuccessor(&*MBBI)) {
@@ -725,10 +710,7 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
// landingpad, accept it as valid control flow.
if (MBB->succ_size() != 1+LandingPadSuccs.size() &&
(MBB->succ_size() != 1 || LandingPadSuccs.size() != 1 ||
- *MBB->succ_begin() != *LandingPadSuccs.begin()) &&
- MBB->succ_size() != 1 + IndirectPadSuccs.size() &&
- (MBB->succ_size() != 1 || IndirectPadSuccs.size() != 1 ||
- *MBB->succ_begin() != *IndirectPadSuccs.begin())) {
+ *MBB->succ_begin() != *LandingPadSuccs.begin())) {
report("MBB exits via unconditional branch but doesn't have "
"exactly one CFG successor!", MBB);
} else if (!MBB->isSuccessor(TBB)) {
@@ -858,14 +840,8 @@ void MachineVerifier::visitMachineBundleBefore(const MachineInstr *MI) {
if (!FirstTerminator)
FirstTerminator = MI;
} else if (FirstTerminator && !MI->isDebugEntryValue()) {
- // An "INLINEASM_BR" will fallthrough to the successor block executing any
- // "COPY" instructions that exist so that they can be assigned in the
- // fallthrough block..
- if (FirstTerminator->getOpcode() != TargetOpcode::INLINEASM_BR ||
- MI->getOpcode() != TargetOpcode::COPY) {
- report("Non-terminator instruction after the first terminator", MI);
- errs() << "First terminator was:\t" << *FirstTerminator;
- }
+ report("Non-terminator instruction after the first terminator", MI);
+ errs() << "First terminator was:\t" << *FirstTerminator;
}
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 1505506dbf0..00b05c5db2f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2847,7 +2847,6 @@ void SelectionDAGBuilder::visitCallBr(const CallBrInst &I) {
assert(isa<InlineAsm>(I.getCalledValue()) &&
"Only know how to handle inlineasm callbr");
visitInlineAsm(&I);
- CopyToExportRegsIfNeeded(&I);
// Retrieve successors.
MachineBasicBlock *Return = FuncInfo.MBBMap[I.getDefaultDest()];
@@ -2857,7 +2856,6 @@ void SelectionDAGBuilder::visitCallBr(const CallBrInst &I) {
for (unsigned i = 0, e = I.getNumIndirectDests(); i < e; ++i) {
MachineBasicBlock *Target = FuncInfo.MBBMap[I.getIndirectDest(i)];
addSuccessorWithProb(CallBrMBB, Target);
- Target->setIsInlineAsmBrIndirectPad();
}
CallBrMBB->normalizeSuccProbs();
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 184a9a0569b..e3a3d91b455 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2501,6 +2501,8 @@ void Verifier::visitIndirectBrInst(IndirectBrInst &BI) {
void Verifier::visitCallBrInst(CallBrInst &CBI) {
Assert(CBI.isInlineAsm(), "Callbr is currently only used for asm-goto!",
&CBI);
+ Assert(CBI.getType()->isVoidTy(), "Callbr return value is not supported!",
+ &CBI);
for (unsigned i = 0, e = CBI.getNumSuccessors(); i != e; ++i)
Assert(CBI.getSuccessor(i)->getType()->isLabelTy(),
"Callbr successors must all have pointer type!", &CBI);
OpenPOWER on IntegriCloud