[llvm] r270629 - [LoopUnrollAnalyzer] Fix a crash in UnrolledInstAnalyzer::visitCastInst.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 17:57:38 PDT 2016
> On May 24, 2016, at 5:47 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>
> On Tue, May 24, 2016 at 3:59 PM, Michael Zolotukhin via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: mzolotukhin
> Date: Tue May 24 17:59:58 2016
> New Revision: 270629
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270629&view=rev <http://llvm.org/viewvc/llvm-project?rev=270629&view=rev>
> Log:
> [LoopUnrollAnalyzer] Fix a crash in UnrolledInstAnalyzer::visitCastInst.
>
> This fixes PR27847. Now for real.
>
> Modified:
> llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp
> llvm/trunk/test/Transforms/LoopUnroll/full-unroll-crashers.ll
>
> Modified: llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp?rev=270629&r1=270628&r2=270629&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp?rev=270629&r1=270628&r2=270629&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp (original)
> +++ llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp Tue May 24 17:59:58 2016
> @@ -141,11 +141,7 @@ bool UnrolledInstAnalyzer::visitCastInst
> Constant *COp = dyn_cast<Constant>(I.getOperand(0));
> if (!COp)
> COp = SimplifiedValues.lookup(I.getOperand(0));
> - if (COp) {
> - if (COp->getType() == I.getType()) {
> - SimplifiedValues[&I] = cast<Constant>(COp);
> - return true;
> - }
> + if (COp && CastInst::castIsValid(I.getOpcode(), COp, I.getType())) {
>
> How are you getting into a situation where "V.getType() != SimplifiedValues.lookup(V).getType()"? It seems like there's an underlying problem which is getting ignored here.
It happens when SCEV analyzes an instruction like
%offset = getelementptr inbounds float, float* null, i32 3
When asked for a value at some iteration, SCEV considers ‘null' as 0 and returns, for instance, ‘i32 24’. I’m not sure if it’s incorrect, that’s why I fixed it in this spot.
Michael
>
> -Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160524/48afdbfa/attachment.html>
More information about the llvm-commits
mailing list