mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Fix a crash in APInt::lshr when shiftAmt > BitWidth.
Patch by James Benton <jbenton@vmware.com>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158213 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c36d033c08
commit
28dd960cd1
@ -1135,7 +1135,7 @@ APInt APInt::lshr(unsigned shiftAmt) const {
|
||||
// If all the bits were shifted out, the result is 0. This avoids issues
|
||||
// with shifting by the size of the integer type, which produces undefined
|
||||
// results. We define these "undefined results" to always be 0.
|
||||
if (shiftAmt == BitWidth)
|
||||
if (shiftAmt >= BitWidth)
|
||||
return APInt(BitWidth, 0);
|
||||
|
||||
// If none of the bits are shifted out, the result is *this. This avoids
|
||||
|
8
test/CodeGen/Generic/2012-06-08-APIntCrash.ll
Normal file
8
test/CodeGen/Generic/2012-06-08-APIntCrash.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llc < %s
|
||||
|
||||
define <8 x i32> @test1(<8 x i32>* %ptr)
|
||||
{
|
||||
%1 = load <8 x i32>* %ptr, align 32
|
||||
%2 = and <8 x i32> %1, <i32 0, i32 0, i32 0, i32 -1, i32 0, i32 0, i32 0, i32 -1>
|
||||
ret <8 x i32> %2;
|
||||
}
|
Loading…
Reference in New Issue
Block a user