[llvm] r319894 - [InstSimplify] Fold insertelement into undef if index is out of bounds

Marek Olšák via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 13:20:24 PST 2017


I have a patch that fixes this for Mesa.

Igor, you can commit your change again if it's been reverted.

Marek

On Tue, Dec 12, 2017 at 5:31 PM, Michel Dänzer <michel at daenzer.net> wrote:
>
> Looks like this has become a case for Nicolai or Marek.
>
> To give some context to Marek, the issue below can be reproduced with
> the piglit test fcc-read-to-pbo-after-clear.
>
>
> On 2017-12-12 04:25 PM, Sanjay Patel wrote:
>> For reference, the extractelement with bad index should already have
>> been simplified.
>> https://reviews.llvm.org/rL319910 recently made that stronger, but
>> raised some concern for AMDGPU backend tests.
>>
>> On Tue, Dec 12, 2017 at 8:01 AM, Igor Laevsky via llvm-commits
>> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>>
>>     Hi Michael,
>>
>>     In the source code I see the following operations:
>>       %122 = extractelement <4 x i32> %121, i32 6
>>     and:
>>       %124 = insertelement <4 x i32> %121, i32 %123, i32 6
>>
>>     This operations has undefined result
>>     (see https://llvm.org/docs/LangRef.html#extractelement-instruction
>>     <https://llvm.org/docs/LangRef.html#extractelement-instruction>).
>>     Looks like a bug in the frontend. Do you know what’s the best
>>     approach here?
>>
>>
>>>     On 12 Dec 2017, at 13:45, Michel Dänzer <michel at daenzer.net
>>>     <mailto:michel at daenzer.net>> wrote:
>>>
>>>     On 2017-12-12 11:08 AM, Igor Laevsky wrote:
>>>>     I reverted problematic changes in the
>>>>     https://reviews.llvm.org/rL320466 <https://reviews.llvm.org/rL320466>
>>>
>>>     Thanks.
>>>
>>>
>>>>     Is it possible to obtain an llvm-ir of the failing test case
>>>>     before the
>>>>     optimizations? I can see the miscompile, but I can’t reproduce it
>>>>     using
>>>>     optimised good case.
>>>
>>>     The attached should be the LLVM IR before optimizations.
>>>
>>>
>>>     --
>>>     Earthling Michel Dänzer               |
>>>                   http://www.amd.com <http://www.amd.com>
>>>     Libre software enthusiast             |             Mesa and X
>>>     developer
>>>     <fcc-read-to-pbo-after-clear.ll>
>>
>>
>>     _______________________________________________
>>     llvm-commits mailing list
>>     llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>>     http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>>
>>
>
>
> --
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer


More information about the llvm-commits mailing list