<div dir="ltr">This will return false after we've already mutated the IR.  We should return false earlier.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 4:32 PM, Sebastian Pop via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: spop<br>
Date: Thu Jul 21 18:32:39 2016<br>
New Revision: 276364<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276364&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276364&view=rev</a><br>
Log:<br>
GVN-hoist: add missing check for all GEP operands available<br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp?rev=276364&r1=276363&r2=276364&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp?rev=276364&r1=276363&r2=276364&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp Thu Jul 21 18:32:39 2016<br>
@@ -613,6 +613,9 @@ public:<br>
<br>
     // Also copy Val when it is a GEP.<br>
     if (Val && isa<GetElementPtrInst>(Val)) {<br>
+      // Check whether we can compute the GEP at HoistPt.<br>
+      if (!allOperandsAvailable(Val, HoistPt))<br>
+        return false;<br>
       Instruction *ClonedVal = Val->clone();<br>
       ClonedVal->insertBefore(HoistPt->getTerminator());<br>
       // Conservatively discard any optimization hints, they may differ on the<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>