[PATCH] D44766: Extend peeling to help invariant motion
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 21 18:15:31 PDT 2018
efriedma added inline comments.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:266
+ // If there is an instruction with invariant operands and unsafe to
+ // speculate - that is because of unreachable exit block prior to it.
+ // Peeling first iteration will prove the instruction is safe.
----------------
This heuristic is a bit suspicious. I'm not sure we always run LICM immediately before unrolling. And even if we do, peeling won't help in a lot of situations; a load could alias another memory operation, or it might not dominate the loop latch.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:531
BasicBlock *Latch = L->getLoopLatch();
- BasicBlock *Exit = L->getUniqueExitBlock();
+ BasicBlock *Exit = L->getUniqueReachableExitBlock();
----------------
This is really hacky.
There really isn't any reason we can't peel loops with multiple exits; it just isn't implemented yet. Please fix it properly.
Repository:
rL LLVM
https://reviews.llvm.org/D44766
More information about the llvm-commits
mailing list