Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/IfConversion.cpp
Show First 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | bool IfConverter::runOnMachineFunction(MachineFunction &MF) { | ||||
if (!TII) return false; | if (!TII) return false; | ||||
PreRegAlloc = MRI->isSSA(); | PreRegAlloc = MRI->isSSA(); | ||||
bool BFChange = false; | bool BFChange = false; | ||||
if (!PreRegAlloc) { | if (!PreRegAlloc) { | ||||
// Tail merge tend to expose more if-conversion opportunities. | // Tail merge tend to expose more if-conversion opportunities. | ||||
BranchFolder BF(true, false, MBFI, *MBPI); | BranchFolder BF(true, false, MBFI, *MBPI); | ||||
BFChange = BF.OptimizeFunction(MF, TII, ST.getRegisterInfo(), | auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>(); | ||||
getAnalysisIfAvailable<MachineModuleInfo>()); | BFChange = BF.OptimizeFunction( | ||||
MF, TII, ST.getRegisterInfo(), | |||||
arsenm: Won't this crash if MachineModuleInfoWrapperPass is not available? | |||||
MMIWP ? &MMIWP->getMMI() : nullptr); | |||||
} | } | ||||
LLVM_DEBUG(dbgs() << "\nIfcvt: function (" << ++FnNum << ") \'" | LLVM_DEBUG(dbgs() << "\nIfcvt: function (" << ++FnNum << ") \'" | ||||
<< MF.getName() << "\'"); | << MF.getName() << "\'"); | ||||
if (FnNum < IfCvtFnStart || (IfCvtFnStop != -1 && FnNum > IfCvtFnStop)) { | if (FnNum < IfCvtFnStart || (IfCvtFnStop != -1 && FnNum > IfCvtFnStop)) { | ||||
LLVM_DEBUG(dbgs() << " skipped\n"); | LLVM_DEBUG(dbgs() << " skipped\n"); | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | while (IfCvtLimit == -1 || (int)NumIfCvts < IfCvtLimit) { | ||||
MadeChange |= Change; | MadeChange |= Change; | ||||
} | } | ||||
Tokens.clear(); | Tokens.clear(); | ||||
BBAnalysis.clear(); | BBAnalysis.clear(); | ||||
if (MadeChange && IfCvtBranchFold) { | if (MadeChange && IfCvtBranchFold) { | ||||
BranchFolder BF(false, false, MBFI, *MBPI); | BranchFolder BF(false, false, MBFI, *MBPI); | ||||
BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(), | auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>(); | ||||
getAnalysisIfAvailable<MachineModuleInfo>()); | BF.OptimizeFunction( | ||||
MF, TII, MF.getSubtarget().getRegisterInfo(), | |||||
Ditto arsenm: Ditto | |||||
MMIWP ? &MMIWP->getMMI() : nullptr); | |||||
} | } | ||||
MadeChange |= BFChange; | MadeChange |= BFChange; | ||||
return MadeChange; | return MadeChange; | ||||
} | } | ||||
/// BB has a fallthrough. Find its 'false' successor given its 'true' successor. | /// BB has a fallthrough. Find its 'false' successor given its 'true' successor. | ||||
static MachineBasicBlock *findFalseBlock(MachineBasicBlock *BB, | static MachineBasicBlock *findFalseBlock(MachineBasicBlock *BB, | ||||
▲ Show 20 Lines • Show All 1,718 Lines • Show Last 20 Lines |
Won't this crash if MachineModuleInfoWrapperPass is not available?