================
@@ -545,11 +551,18 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, 
AAResults *AA, LoopInfo *LI,
   assert((L->isOutermost() || L->getParentLoop()->isLCSSAForm(*DT)) &&
          "Parent loop not left in LCSSA form after LICM!");
 
+  // sink pre-header defs that are unused in-loop into the unique exit to 
reduce
+  // pressure.
+  Flags.setIsSink(true);
+  Changed |= sinkUnusedInvariantsFromPreheaderToExit(L, AA, &SafetyInfo, MSSAU,
+                                                     SE, DT, Flags, ORE);
----------------
nikic wrote:

In terms of ordering, I think it would make the most sense to do this between 
sinkRegion and hoistRegion above.

Anything that gets hoisted out by hoistRegion cannot be sunk, otherwise 
sinkRegion would have already done it. So there is no need to check the hoisted 
instructions for sinking again.

https://github.com/llvm/llvm-project/pull/157559
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to