[llvm-branch-commits] [llvm-branch] r259940 - Merging r259381:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 5 14:17:38 PST 2016


Author: hans
Date: Fri Feb  5 16:17:38 2016
New Revision: 259940

URL: http://llvm.org/viewvc/llvm-project?rev=259940&view=rev
Log:
Merging r259381:
------------------------------------------------------------------------
r259381 | uweigand | 2016-02-01 10:31:19 -0800 (Mon, 01 Feb 2016) | 21 lines

[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/branches/release_38/test/CodeGen/SystemZ/int-cmp-53.ll
      - copied unchanged from r259381, llvm/trunk/test/CodeGen/SystemZ/int-cmp-53.ll
Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/lib/Target/SystemZ/SystemZISelLowering.cpp

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb  5 16:17:38 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259645,259649,259695,259740,259798,259835,259840,259886,259888
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695,259740,259798,259835,259840,259886,259888

Modified: llvm/branches/release_38/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=259940&r1=259939&r2=259940&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/branches/release_38/lib/Target/SystemZ/SystemZISelLowering.cpp Fri Feb  5 16:17:38 2016
@@ -1849,7 +1849,7 @@ static unsigned getTestUnderMaskCond(uns
     if (CCMask == SystemZ::CCMASK_CMP_NE)
       return SystemZ::CCMASK_TM_SOME_1;
   }
-  if (EffectivelyUnsigned && CmpVal <= Low) {
+  if (EffectivelyUnsigned && CmpVal > 0 && CmpVal <= Low) {
     if (CCMask == SystemZ::CCMASK_CMP_LT)
       return SystemZ::CCMASK_TM_ALL_0;
     if (CCMask == SystemZ::CCMASK_CMP_GE)




More information about the llvm-branch-commits mailing list