[llvm] r309330 - [ConstantFolder] Don't try to fold gep when the idx is a vector.

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 10:34:54 PDT 2017


On Thu, Jul 27, 2017 at 3:23 PM, Davide Italiano <davide at freebsd.org> wrote:
> On Thu, Jul 27, 2017 at 3:20 PM, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: davide
>> Date: Thu Jul 27 15:20:44 2017
>> New Revision: 309330
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=309330&view=rev
>> Log:
>> [ConstantFolder] Don't try to fold gep when the idx is a vector.
>>
>> The code in ConstantFoldGetElementPtr() assumes integers, and
>> therefore it crashes trying to get the integer bidwith of a vector
>> type (in this case <4 x i32>. I just changed the code to prevent
>> the folding in case of vectors and I didn't bother to generalize
>> as this doesn't seem to me something that really happens in
>> practice, but I'm willing to change the patch if you think
>> it's worth it.
>> This is hard to trigger from -instsimplify or -instcombine
>> only as the second instruction is dead, so the test uses loop-unroll.
>>
>
> Hans, David, can we consider merging this to 5.0?

David: what do you think?


More information about the llvm-commits mailing list