Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 2138443002: Subzero: Loop Invariant Code Motion (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceLoopAnalyzer.cpp ('k') | src/IceTimerTree.def » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index a9dc7a7e75496b3d28fb654c2188c7b6cc2ed0da..b6eebd13f881ce5a94417e354deef8076cbdb6af 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -443,6 +443,18 @@ template <typename TraitsType> void TargetX86Base<TraitsType>::translateO2() {
Func->processAllocas(SortAndCombineAllocas);
Func->dump("After Alloca processing");
+ // Run this early so it can be used to focus optimizations on potentially hot
+ // code.
+ // TODO(stichnot,ascull): currently only used for regalloc not
+ // expensive high level optimizations which could be focused on potentially
+ // hot code.
+ Func->generateLoopInfo();
+ Func->dump("After loop analysis");
+ if (getFlags().getLoopInvariantCodeMotion()) {
+ Func->loopInvariantCodeMotion();
+ Func->dump("After LICM");
+ }
+
if (getFlags().getEnableExperimental()) {
Func->localCSE();
Func->dump("After Local CSE");
@@ -466,14 +478,6 @@ template <typename TraitsType> void TargetX86Base<TraitsType>::translateO2() {
Func->dump("After Phi lowering");
}
- // Run this early so it can be used to focus optimizations on potentially hot
- // code.
- // TODO(stichnot,ascull): currently only used for regalloc not
- // expensive high level optimizations which could be focused on potentially
- // hot code.
- Func->computeLoopNestDepth();
- Func->dump("After loop nest depth analysis");
-
// Address mode optimization.
Func->getVMetadata()->init(VMK_SingleDefs);
Func->doAddressOpt();
@@ -5420,10 +5424,13 @@ TargetX86Base<TypeTraits>::computeAddressOpt(const Inst *Instr, Type MemType,
// don't go further. Alternatively (?), never consider a transformation that
// would change a variable that is currently *not* live across basic block
// boundaries into one that *is*.
- if (Func->getVMetadata()->isMultiBlock(
- NewAddr.Base) /* || Base->getUseCount() > 1*/)
- return nullptr;
-
+ if (!getFlags().getLoopInvariantCodeMotion()) {
+ // Need multi block address opt when licm is enabled.
+ // Might make sense to restrict to current node and loop header.
+ if (Func->getVMetadata()->isMultiBlock(
+ NewAddr.Base) /* || Base->getUseCount() > 1*/)
+ return nullptr;
+ }
AddressOptimizer AddrOpt(Func);
const bool MockBounds = getFlags().getMockBoundsCheck();
const Inst *Reason = nullptr;
« no previous file with comments | « src/IceLoopAnalyzer.cpp ('k') | src/IceTimerTree.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698