<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2016, at 5:47 PM, Eli Friedman <<a href="mailto:eli.friedman@gmail.com" class="">eli.friedman@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Tue, May 24, 2016 at 3:59 PM, Michael Zolotukhin via llvm-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Author: mzolotukhin<br class="">Date: Tue May 24 17:59:58 2016<br class="">New Revision: 270629<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=270629&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=270629&view=rev</a><br class="">Log:<br class="">[LoopUnrollAnalyzer] Fix a crash in UnrolledInstAnalyzer::visitCastInst.<br class=""><br class="">This fixes PR27847. Now for real.<br class=""><br class="">Modified:<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/Transforms/LoopUnroll/full-unroll-crashers.ll<br class=""><br class="">Modified: llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp?rev=270629&r1=270628&r2=270629&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp?rev=270629&r1=270628&r2=270629&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp (original)<br class="">+++ llvm/trunk/lib/Analysis/LoopUnrollAnalyzer.cpp Tue May 24 17:59:58 2016<br class="">@@ -141,11 +141,7 @@ bool UnrolledInstAnalyzer::visitCastInst<br class="">   Constant *COp = dyn_cast<Constant>(I.getOperand(0));<br class="">   if (!COp)<br class="">     COp = SimplifiedValues.lookup(I.getOperand(0));<br class="">-  if (COp) {<br class="">-    if (COp->getType() == I.getType()) {<br class="">-      SimplifiedValues[&I] = cast<Constant>(COp);<br class="">-      return true;<br class="">-    }<br class="">+  if (COp && CastInst::castIsValid(I.getOpcode(), COp, I.getType())) {<br class=""></blockquote><div class=""><br class=""></div><div class="">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.<br class=""></div></div></div></div></div></blockquote>It happens when SCEV analyzes an instruction like</div><div>%offset = getelementptr inbounds float, float* null, i32 3</div><div><br class=""></div><div>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.</div><div><br class=""></div><div>Michael</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">-Eli</div></div></div></div></div></blockquote></div><br class=""></body></html>