[llvm] r276364 - GVN-hoist: add missing check for all GEP operands available

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 16:53:25 PDT 2016


This will return false after we've already mutated the IR.  We should
return false earlier.

On Thu, Jul 21, 2016 at 4:32 PM, Sebastian Pop via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: spop
> Date: Thu Jul 21 18:32:39 2016
> New Revision: 276364
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276364&view=rev
> Log:
> GVN-hoist: add missing check for all GEP operands available
>
> Modified:
>     llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp?rev=276364&r1=276363&r2=276364&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp Thu Jul 21 18:32:39 2016
> @@ -613,6 +613,9 @@ public:
>
>      // Also copy Val when it is a GEP.
>      if (Val && isa<GetElementPtrInst>(Val)) {
> +      // Check whether we can compute the GEP at HoistPt.
> +      if (!allOperandsAvailable(Val, HoistPt))
> +        return false;
>        Instruction *ClonedVal = Val->clone();
>        ClonedVal->insertBefore(HoistPt->getTerminator());
>        // Conservatively discard any optimization hints, they may differ
> on the
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/9f145245/attachment.html>


More information about the llvm-commits mailing list