mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
Plumb TLI through isSafeToExecuteUnconditionally [NFC]
Split from D95815 to reduce patch size. Isn't (yet) used for anything, only the client side is wired up.
This commit is contained in:
parent
88425e7fcb
commit
eafb369a5a
@ -461,7 +461,8 @@ constexpr unsigned MaxAnalysisRecursionDepth = 6;
|
||||
/// for such instructions, moving them may change the resulting value.
|
||||
bool isSafeToSpeculativelyExecute(const Value *V,
|
||||
const Instruction *CtxI = nullptr,
|
||||
const DominatorTree *DT = nullptr);
|
||||
const DominatorTree *DT = nullptr,
|
||||
const TargetLibraryInfo *TLI = nullptr);
|
||||
|
||||
/// Returns true if the result or effects of the given instructions \p I
|
||||
/// depend on or influence global memory.
|
||||
|
@ -4411,7 +4411,8 @@ bool llvm::mustSuppressSpeculation(const LoadInst &LI) {
|
||||
|
||||
bool llvm::isSafeToSpeculativelyExecute(const Value *V,
|
||||
const Instruction *CtxI,
|
||||
const DominatorTree *DT) {
|
||||
const DominatorTree *DT,
|
||||
const TargetLibraryInfo *TLI) {
|
||||
const Operator *Inst = dyn_cast<Operator>(V);
|
||||
if (!Inst)
|
||||
return false;
|
||||
@ -4458,7 +4459,7 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V,
|
||||
const DataLayout &DL = LI->getModule()->getDataLayout();
|
||||
return isDereferenceableAndAlignedPointer(
|
||||
LI->getPointerOperand(), LI->getType(), MaybeAlign(LI->getAlignment()),
|
||||
DL, CtxI, DT);
|
||||
DL, CtxI, DT, TLI);
|
||||
}
|
||||
case Instruction::Call: {
|
||||
auto *CI = cast<const CallInst>(Inst);
|
||||
|
@ -162,6 +162,7 @@ static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
|
||||
OptimizationRemarkEmitter *ORE);
|
||||
static bool isSafeToExecuteUnconditionally(Instruction &Inst,
|
||||
const DominatorTree *DT,
|
||||
const TargetLibraryInfo *TLI,
|
||||
const Loop *CurLoop,
|
||||
const LoopSafetyInfo *SafetyInfo,
|
||||
OptimizationRemarkEmitter *ORE,
|
||||
@ -921,7 +922,7 @@ bool llvm::hoistRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI,
|
||||
ORE) &&
|
||||
worthSinkOrHoistInst(I, CurLoop->getLoopPreheader(), ORE, BFI) &&
|
||||
isSafeToExecuteUnconditionally(
|
||||
I, DT, CurLoop, SafetyInfo, ORE,
|
||||
I, DT, TLI, CurLoop, SafetyInfo, ORE,
|
||||
CurLoop->getLoopPreheader()->getTerminator())) {
|
||||
hoist(I, DT, CurLoop, CFH.getOrCreateHoistedBlock(BB), SafetyInfo,
|
||||
MSSAU, SE, ORE);
|
||||
@ -1815,11 +1816,12 @@ static void hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop,
|
||||
/// or if it is a trapping instruction and is guaranteed to execute.
|
||||
static bool isSafeToExecuteUnconditionally(Instruction &Inst,
|
||||
const DominatorTree *DT,
|
||||
const TargetLibraryInfo *TLI,
|
||||
const Loop *CurLoop,
|
||||
const LoopSafetyInfo *SafetyInfo,
|
||||
OptimizationRemarkEmitter *ORE,
|
||||
const Instruction *CtxI) {
|
||||
if (isSafeToSpeculativelyExecute(&Inst, CtxI, DT))
|
||||
if (isSafeToSpeculativelyExecute(&Inst, CtxI, DT, TLI))
|
||||
return true;
|
||||
|
||||
bool GuaranteedToExecute =
|
||||
@ -2093,8 +2095,9 @@ bool llvm::promoteLoopAccessesToScalars(
|
||||
// to execute does as well. Thus we can increase our guaranteed
|
||||
// alignment as well.
|
||||
if (!DereferenceableInPH || (InstAlignment > Alignment))
|
||||
if (isSafeToExecuteUnconditionally(*Load, DT, CurLoop, SafetyInfo,
|
||||
ORE, Preheader->getTerminator())) {
|
||||
if (isSafeToExecuteUnconditionally(*Load, DT, TLI, CurLoop,
|
||||
SafetyInfo, ORE,
|
||||
Preheader->getTerminator())) {
|
||||
DereferenceableInPH = true;
|
||||
Alignment = std::max(Alignment, InstAlignment);
|
||||
}
|
||||
@ -2141,7 +2144,7 @@ bool llvm::promoteLoopAccessesToScalars(
|
||||
if (!DereferenceableInPH) {
|
||||
DereferenceableInPH = isDereferenceableAndAlignedPointer(
|
||||
Store->getPointerOperand(), Store->getValueOperand()->getType(),
|
||||
Store->getAlign(), MDL, Preheader->getTerminator(), DT);
|
||||
Store->getAlign(), MDL, Preheader->getTerminator(), DT, TLI);
|
||||
}
|
||||
} else
|
||||
return false; // Not a load or store.
|
||||
|
Loading…
Reference in New Issue
Block a user