[llvm-branch-commits] [llvm-branch] r308718 - Merging r308503:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 21 01:01:42 PDT 2017


Author: hans
Date: Fri Jul 21 01:01:42 2017
New Revision: 308718

URL: http://llvm.org/viewvc/llvm-project?rev=308718&view=rev
Log:
Merging r308503:
------------------------------------------------------------------------
r308503 | davide | 2017-07-19 11:09:46 -0700 (Wed, 19 Jul 2017) | 3 lines

[X86] Don't try to scale down if that exceeds the bitwidth.

Fixes the crash reported in PR33844.
------------------------------------------------------------------------

Added:
    llvm/branches/release_50/test/CodeGen/X86/pr33844.ll
      - copied unchanged from r308503, llvm/trunk/test/CodeGen/X86/pr33844.ll
Modified:
    llvm/branches/release_50/   (props changed)
    llvm/branches/release_50/lib/Target/X86/X86ISelDAGToDAG.cpp

Propchange: llvm/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 21 01:01:42 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,308483-308484
+/llvm/trunk:155241,308483-308484,308503

Modified: llvm/branches/release_50/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=308718&r1=308717&r2=308718&view=diff
==============================================================================
--- llvm/branches/release_50/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/branches/release_50/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Jul 21 01:01:42 2017
@@ -1055,7 +1055,10 @@ static bool foldMaskAndShiftToScale(Sele
 
   // Scale the leading zero count down based on the actual size of the value.
   // Also scale it down based on the size of the shift.
-  MaskLZ -= (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt;
+  unsigned ScaleDown = (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt;
+  if (MaskLZ < ScaleDown)
+    return true;
+  MaskLZ -= ScaleDown;
 
   // The final check is to ensure that any masked out high bits of X are
   // already known to be zero. Otherwise, the mask has a semantic impact




More information about the llvm-branch-commits mailing list