Skip to content

Commit

Permalink
Revert "Correct dwarf unwind information in function epilogue for X86"
Browse files Browse the repository at this point in the history
This reverts r317100 as it introduced sanitizer-x86_64-linux-autoconf
buildbot failure (build #15606).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317136 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
petar-jovanovic committed Nov 1, 2017
1 parent 8b4e833 commit 5616b72
Show file tree
Hide file tree
Showing 99 changed files with 32 additions and 1,689 deletions.
3 changes: 0 additions & 3 deletions include/llvm/CodeGen/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,6 @@ namespace llvm {
/// shuffles.
FunctionPass *createExpandReductionsPass();

/// Creates CFI Instruction Inserter pass. \see CFIInstrInserter.cpp
FunctionPass *createCFIInstrInserter();

} // End llvm namespace

#endif
1 change: 0 additions & 1 deletion include/llvm/InitializePasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ void initializeCFGOnlyViewerLegacyPassPass(PassRegistry&);
void initializeCFGPrinterLegacyPassPass(PassRegistry&);
void initializeCFGSimplifyPassPass(PassRegistry&);
void initializeCFGViewerLegacyPassPass(PassRegistry&);
void initializeCFIInstrInserterPass(PassRegistry&);
void initializeCFLAndersAAWrapperPassPass(PassRegistry&);
void initializeCFLSteensAAWrapperPassPass(PassRegistry&);
void initializeCallGraphDOTPrinterPass(PassRegistry&);
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Target/Target.td
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ def CFI_INSTRUCTION : Instruction {
let InOperandList = (ins i32imm:$id);
let AsmString = "";
let hasCtrlDep = 1;
let isNotDuplicable = 0;
let isNotDuplicable = 1;
}
def EH_LABEL : Instruction {
let OutOperandList = (outs);
Expand Down
8 changes: 0 additions & 8 deletions include/llvm/Target/TargetFrameLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ class TargetFrameLowering {
return false;
return true;
}

/// Return initial CFA offset value i.e. the one valid at the beginning of the
/// function (before any stack operations).
virtual int getInitialCFAOffset(const MachineFunction &MF) const;

/// Return initial CFA register value i.e. the one valid at the beginning of
/// the function (before any stack operations).
virtual unsigned getInitialCFARegister(const MachineFunction &MF) const;
};

} // End llvm namespace
Expand Down
50 changes: 8 additions & 42 deletions lib/CodeGen/BranchFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ static unsigned HashEndOfMBB(const MachineBasicBlock &MBB) {
return HashMachineInstr(*I);
}

// Whether MI should be counted as an instruction when calculating common tail.
static bool countsAsInstruction(const MachineInstr &MI) {
return !(MI.isDebugValue() || MI.isCFIInstruction());
}

/// ComputeCommonTailLength - Given two machine basic blocks, compute the number
/// of instructions they actually have in common together at their end. Return
/// iterators for the first shared instruction in each block.
Expand All @@ -315,9 +310,9 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
while (I1 != MBB1->begin() && I2 != MBB2->begin()) {
--I1; --I2;
// Skip debugging pseudos; necessary to avoid changing the code.
while (!countsAsInstruction(*I1)) {
while (I1->isDebugValue()) {
if (I1==MBB1->begin()) {
while (!countsAsInstruction(*I2)) {
while (I2->isDebugValue()) {
if (I2==MBB2->begin())
// I1==DBG at begin; I2==DBG at begin
return TailLen;
Expand All @@ -330,7 +325,7 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
--I1;
}
// I1==first (untested) non-DBG preceding known match
while (!countsAsInstruction(*I2)) {
while (I2->isDebugValue()) {
if (I2==MBB2->begin()) {
++I1;
// I1==non-DBG, or first of DBGs not at begin; I2==DBG at begin
Expand Down Expand Up @@ -373,35 +368,6 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
}
++I1;
}

// Ensure that I1 and I2 do not point to a CFI_INSTRUCTION. This can happen if
// I1 and I2 are non-identical when compared and then one or both of them ends
// up pointing to a CFI instruction after being incremented. For example:
/*
BB1:
...
INSTRUCTION_A
ADD32ri8 <- last common instruction
...
BB2:
...
INSTRUCTION_B
CFI_INSTRUCTION
ADD32ri8 <- last common instruction
...
*/
// When INSTRUCTION_A and INSTRUCTION_B are compared as not equal, after
// incrementing the iterators, I1 will point to ADD, however I2 will point to
// the CFI instruction. Later on, this leads to BB2 being 'hacked off' at the
// wrong place (in ReplaceTailWithBranchTo()) which results in losing this CFI
// instruction.
while (I1 != MBB1->end() && I1->isCFIInstruction()) {
++I1;
}

while (I2 != MBB2->end() && I2->isCFIInstruction()) {
++I2;
}
return TailLen;
}

Expand Down Expand Up @@ -488,7 +454,7 @@ static unsigned EstimateRuntime(MachineBasicBlock::iterator I,
MachineBasicBlock::iterator E) {
unsigned Time = 0;
for (; I != E; ++I) {
if (!countsAsInstruction(*I))
if (I->isDebugValue())
continue;
if (I->isCall())
Time += 10;
Expand Down Expand Up @@ -848,12 +814,12 @@ mergeOperations(MachineBasicBlock::iterator MBBIStartPos,
assert(MBBI != MBBIE && "Reached BB end within common tail length!");
(void)MBBIE;

if (!countsAsInstruction(*MBBI)) {
if (MBBI->isDebugValue()) {
++MBBI;
continue;
}

while ((MBBICommon != MBBIECommon) && !countsAsInstruction(*MBBICommon))
while ((MBBICommon != MBBIECommon) && MBBICommon->isDebugValue())
++MBBICommon;

assert(MBBICommon != MBBIECommon &&
Expand Down Expand Up @@ -893,7 +859,7 @@ void BranchFolder::mergeCommonTails(unsigned commonTailIndex) {
}

for (auto &MI : *MBB) {
if (!countsAsInstruction(MI))
if (MI.isDebugValue())
continue;
DebugLoc DL = MI.getDebugLoc();
for (unsigned int i = 0 ; i < NextCommonInsts.size() ; i++) {
Expand All @@ -903,7 +869,7 @@ void BranchFolder::mergeCommonTails(unsigned commonTailIndex) {
auto &Pos = NextCommonInsts[i];
assert(Pos != SameTails[i].getBlock()->end() &&
"Reached BB end within common tail");
while (!countsAsInstruction(*Pos)) {
while (Pos->isDebugValue()) {
++Pos;
assert(Pos != SameTails[i].getBlock()->end() &&
"Reached BB end within common tail");
Expand Down
Loading

0 comments on commit 5616b72

Please sign in to comment.