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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 29 00:47:19 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D48599#1147514, @mkazantsev wrote:

> LGTM once a TODO comment is added.






================
Comment at: lib/Analysis/ScalarEvolutionExpander.cpp:1172
 
       Instruction *TempIncV =
+          dyn_cast<Instruction>(PN.getIncomingValueForBlock(LatchBlock));
----------------
mkazantsev wrote:
> 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.
Ok, great, thank you.


Repository:
  rL LLVM

https://reviews.llvm.org/D48599





More information about the llvm-commits mailing list