diff options
| author | Davide Italiano <davide@freebsd.org> | 2017-07-19 18:09:46 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2017-07-19 18:09:46 +0000 |
| commit | 5fc5d0a4069e304597b04adb0ecc79a009684b75 (patch) | |
| tree | 765eed5f4a4ec7df7e43316de0150d95059abe73 /llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | |
| parent | 3fce9d9c4929a1218b9119b237bfe1b64c463113 (diff) | |
| download | bcm5719-llvm-5fc5d0a4069e304597b04adb0ecc79a009684b75.tar.gz bcm5719-llvm-5fc5d0a4069e304597b04adb0ecc79a009684b75.zip | |
[X86] Don't try to scale down if that exceeds the bitwidth.
Fixes the crash reported in PR33844.
llvm-svn: 308503
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelDAGToDAG.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 3c4589ab18f..8f24f98be68 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -1055,7 +1055,10 @@ static bool foldMaskAndShiftToScale(SelectionDAG &DAG, SDValue N, // 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 |

