[IndVars] Teach replaceCongruentIVs to avoid scrambling induction variables
replaceCongruentIVs analysis is based on ScalarEvolution; this makes comparing different PHIs and performing the replacement straightforward. However, it can have some side-effects: it isn't aware whether an induction variable is in canonical form, so it can perform replacements which obscure the meaning of the IR. In test22 in widen-loop-comp.ll, the resulting loop can't be analyzed by ScalarEvolution at all. My attempted solution is to restrict the transform: don't try to replace induction variables using PHI nodes that don't represent simple induction variables. I'm not sure if this is the best solution; suggestions welcome. Differential Revision: https://reviews.llvm.org/D121950
Loading
Please sign in to comment