LoopUnroll does a limited DCE pass after unrolling, but if you have a chain of dead instructions, it only deletes the last one. Improve the code to recursively delete all trivially dead instructions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
226 | Err, ignore this comment, I submitted it by accident -- it's incompatible with the other one, which requires WeakTrackingVH in the API. |
It looks like this is causing Clang to crash when building the C source below with -O3 on X86 (https://bugs.llvm.org/show_bug.cgi?id=50354)
int a, b, c; int main () { while (b) for (c = -9; c; c++) a = (a ^ 2) == 0; return 0; }
llvm/lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
212 | Bikeshedding question: *why* do we do this here? |
llvm/lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
212 | Presumably there are some tests that fail or some git history which can give a clue. Not sure off the top of my head. If you see 60% of time, that's probably a SCEV bug as a guess. :) |
llvm/lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
212 | Hmm, i was hoping this was simply resulting in bad SCEV forget-compute cache hammering, |
Bikeshedding question: *why* do we do this here?
I'm looking at a test case where we spend most of the time (60%+, minutes) in LoopUnroll,
apparently in simplifyLoopIVs() specifically.