[PATCH] D38677: [ConstantFold] Fix a crash when folding a GEP that has vector index

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 05:54:04 PDT 2017


mssimpso accepted this revision.
mssimpso added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D38677#908574, @haicheng wrote:

> Thank you, Matt.
>
> As you pointed out, supporting vector previous index is not difficult.  I choosed to bail out at first because
>
> 1. We already bail out when the current index is a vector.
> 2. I initially planned to fix the crash in this patch to unblock the release and add the vector index support for both current and previous index.
> 3. I think this piece of algorithm work better if we iterate from the last index to the first.  So, we don't need to recursively call this function in the following case.
>
>   ``` @block = global [8 x [64 x [8192 x i8]]] zeroinitializer, align 1
>
>   define i8* @vectorindex() { %1 = getelementptr inbounds [8 x [64 x [8192 x i8]]], [8 x [64 x [8192 x i8]]]* @block, i64 0, i64 0, i64 63, i64 8192 ret i8* %1 } ```


OK, that sounds good to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D38677





More information about the llvm-commits mailing list