[PATCH] D48599: SCEVExpander::expandAddRecExprLiterally(): check before casting as Instruction

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 28 20:17:03 PDT 2018


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

LGTM once a TODO comment is added.



================
Comment at: lib/Analysis/ScalarEvolutionExpander.cpp:1172
 
       Instruction *TempIncV =
+          dyn_cast<Instruction>(PN.getIncomingValueForBlock(LatchBlock));
----------------
lebedev.ri wrote:
> mkazantsev wrote:
> > Naming here is also confusing. `V` assumes that it should be a value. If there is no strong reason to keep it an instruction, I'd suggest reworking this code to deal with values.
> I'm afraid i have no knowledge of this code to do anything like that.
> So the crash can either stay, or this band-aid can land, and a bug
> about possibility to rework this code to work with `Value` be filled.
Ok, I'm actually OK with the current solution. Just add a TODO comment that this possibly can be reworked to avoid this cast at all.


Repository:
  rL LLVM

https://reviews.llvm.org/D48599





More information about the llvm-commits mailing list