[PATCH] D50888: [NFC][LICM] Remove too conservative IsMustExecute variable
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 20:20:03 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346204: [LICM] Remove too conservative IsMustExecute variable (authored by mkazantsev, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D50888?vs=161194&id=172706#toc
Repository:
rL LLVM
https://reviews.llvm.org/D50888
Files:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Index: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp
@@ -460,14 +460,10 @@
if (inSubLoop(BB, CurLoop, LI))
continue;
- // Keep track of whether the prefix of instructions visited so far are such
- // that the next instruction visited is guaranteed to execute if the loop
- // is entered.
- bool IsMustExecute = CurLoop->getHeader() == BB;
// Keep track of whether the prefix instructions could have written memory.
- // TODO: This and IsMustExecute may be done smarter if we keep track of all
- // throwing and mem-writing operations in every block, e.g. using something
- // similar to isGuaranteedToExecute.
+ // TODO: This may be done smarter if we keep track of all throwing and
+ // mem-writing operations in every block, e.g. using something similar to
+ // isGuaranteedToExecute.
bool IsMemoryNotModified = CurLoop->getHeader() == BB;
for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
@@ -493,10 +489,9 @@
//
if (CurLoop->hasLoopInvariantOperands(&I) &&
canSinkOrHoistInst(I, AA, DT, CurLoop, CurAST, true, ORE) &&
- (IsMustExecute ||
- isSafeToExecuteUnconditionally(
- I, DT, CurLoop, SafetyInfo, ORE,
- CurLoop->getLoopPreheader()->getTerminator()))) {
+ isSafeToExecuteUnconditionally(
+ I, DT, CurLoop, SafetyInfo, ORE,
+ CurLoop->getLoopPreheader()->getTerminator())) {
hoist(I, DT, CurLoop, SafetyInfo, ORE);
Changed = true;
continue;
@@ -531,15 +526,13 @@
if (((I.use_empty() &&
match(&I, m_Intrinsic<Intrinsic::invariant_start>())) ||
isGuard(&I)) &&
- IsMustExecute && IsMemoryNotModified &&
- CurLoop->hasLoopInvariantOperands(&I)) {
+ IsMemoryNotModified && CurLoop->hasLoopInvariantOperands(&I) &&
+ SafetyInfo->isGuaranteedToExecute(I, DT, CurLoop)) {
hoist(I, DT, CurLoop, SafetyInfo, ORE);
Changed = true;
continue;
}
- if (IsMustExecute)
- IsMustExecute = isGuaranteedToTransferExecutionToSuccessor(&I);
if (IsMemoryNotModified)
IsMemoryNotModified = !I.mayWriteToMemory();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50888.172706.patch
Type: text/x-patch
Size: 2409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181106/cf3454cd/attachment-0001.bin>
More information about the llvm-commits
mailing list