[llvm] r259381 - [SystemZ] Fix wrong-code generation for certain always-false conditions

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 14:22:10 PST 2016


Merged in r259940.

Thanks,
Hans

On Fri, Feb 5, 2016 at 2:13 PM, Ulrich Weigand
<Ulrich.Weigand at de.ibm.com> wrote:
> Hi Hans,
>
> and one more that would be good to see in 3.8; this one didn't show up in
> the test suites, but caused a miscompile of the swift compiler.
>
>>Author: uweigand
>>Date: Mon Feb  1 12:31:19 2016
>>New Revision: 259381
>>
>>URL: http://llvm.org/viewvc/llvm-project?rev=259381&view=rev
>>Log:
>>[SystemZ] Fix wrong-code generation for certain always-false conditions
>>
>>We've found another bug in the code generation logic conditions for a
>>certain class of always-false conditions, those of the form
>>   if ((a & 1) < 0)
>>
>>These only reach the back end when compiling without optimization.
>>
>>The bug was introduced by the choice of using TEST UNDER MASK
>>to implement a check for
>>   if ((a & MASK) < VAL)
>>as
>>   if ((a & MASK) == 0)
>>
>>where VAL is less than the the lowest bit of MASK.  This is correct
>>in all cases except for VAL == 0, in which case the original
>>condition is always false, but the replacement isn't.
>>
>>Fixed by excluding that particular case.
>>
>>
>>Added:
>>    llvm/trunk/test/CodeGen/SystemZ/int-cmp-53.ll
>>Modified:
>>    llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
>
>
> Mit freundlichen Gruessen / Best Regards
>
> Ulrich Weigand
>
> --
> Dr. Ulrich Weigand | Phone: +49-7031/16-3727
> STSM, GNU/Linux compilers and toolchain
> IBM Deutschland Research & Development GmbH
> Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
> Wittkopp
> Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart,
> HRB 243294


More information about the llvm-commits mailing list