[PATCH] D114650: [SCEV] Construct SCEV iteratively (WIP).
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 15:10:34 PST 2021
reames added a comment.
Putting this here only because the bug database is still readonly.
Random thought: We're discussing this as a SCEV cornercase, and it's probably worth fixing the case this exposes, but it's also worth noting here that the unroller is producing a horrendously bad form here. It might be worth considering whether the unroller should be applying a peephole as it unrolls to avoid generating this massive and utterly useless IR.
Specifically for this case: if generating an unrolled IV increment with no other uses of the IV, eagerly fold the step increments if constant. That is, instead of producing:
%a = gep i8, i8 %p, i64 1
%b = gep i8, i8 %b, i64 1
%c = gep i8, i8 %c, i64 1
%d = gep i8, i8 %d, i64 1
produce:
%a = gep i8, i8 %p, i64 1
%b = gep i8, i8 %p, i64 2
%c = gep i8, i8 %p, i64 3
%d = gep i8, i8 %p, i64 4
(All of which but the last are dead.)
Doing this might be a worthwhile compile time optimization on it's own.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114650/new/
https://reviews.llvm.org/D114650
More information about the llvm-commits
mailing list