[PATCH] D39345: SCEV: preserve debug information attached to PHI nodes.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 16:13:29 PDT 2017


aprantl planned changes to this revision.
aprantl added inline comments.


================
Comment at: lib/Analysis/ScalarEvolutionExpander.cpp:1215
+  // Save the original PHI node so we can copy over its debug info.
+  PHINode *OldPN = L->getCanonicalInductionVariable();
+ 
----------------
hfinkel wrote:
> How do you know that the AddRec being expanded here is equivalent to a canonical induction variable? That's only true if we're expanding '{0,+,1}', right?
> 
> Does calling SE.getSCEVValues(Normalized) also find the original PHI node?
> 
Thanks, that is a good point! I could either constrain it to just handle this special case or attempt to generalize it. Unfortunately I don't know enough about SCEV yet:
Can SCEV also modify the trip count of the loop?
Is there a way I can reconstruct a function (that I then could translate into a DWARF expression) that transforms the value of the new induction variable into the original one for the current iteration?


https://reviews.llvm.org/D39345





More information about the llvm-commits mailing list