forked from OSchip/llvm-project
[x86] change free truncate hook to handle only simple types (PR42880)
This avoids the crash from: https://bugs.llvm.org/show_bug.cgi?id=42880 ...and I think it's a proper constraint for the TLI hook. But that example raises questions about what happens to get us into this situation (created i29 types) and what happens later (why does legalization die on those types), so I'm not sure if we will resolve the bug based on this change. llvm-svn: 367766
This commit is contained in:
parent
3c805d125a
commit
c9171bd0a9
|
@ -28842,6 +28842,8 @@ bool X86TargetLowering::isLegalStoreImmediate(int64_t Imm) const {
|
|||
bool X86TargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
|
||||
if (!VT1.isInteger() || !VT2.isInteger())
|
||||
return false;
|
||||
if (!VT1.isSimple() || !VT2.isSimple())
|
||||
return false;
|
||||
unsigned NumBits1 = VT1.getSizeInBits();
|
||||
unsigned NumBits2 = VT2.getSizeInBits();
|
||||
return NumBits1 > NumBits2;
|
||||
|
|
|
@ -387,3 +387,36 @@ define i32 @ashr_add_shl_i32_i8_extra_use3(i32 %r, i32* %p1, i32* %p2) nounwind
|
|||
%conv1 = ashr i32 %sext, 24
|
||||
ret i32 %conv1
|
||||
}
|
||||
|
||||
%"class.QPainterPath" = type { double, double, i32 }
|
||||
|
||||
define void @PR42880(i32 %t0) {
|
||||
; X32-LABEL: PR42880:
|
||||
; X32: # %bb.0:
|
||||
; X32-NEXT: xorl %eax, %eax
|
||||
; X32-NEXT: testb %al, %al
|
||||
; X32-NEXT: je .LBB16_1
|
||||
; X32-NEXT: # %bb.2: # %if
|
||||
; X32-NEXT: .LBB16_1: # %then
|
||||
;
|
||||
; X64-LABEL: PR42880:
|
||||
; X64: # %bb.0:
|
||||
; X64-NEXT: xorl %eax, %eax
|
||||
; X64-NEXT: testb %al, %al
|
||||
; X64-NEXT: je .LBB16_1
|
||||
; X64-NEXT: # %bb.2: # %if
|
||||
; X64-NEXT: .LBB16_1: # %then
|
||||
%sub = add nsw i32 %t0, -1
|
||||
%add.ptr.i94 = getelementptr inbounds %"class.QPainterPath", %"class.QPainterPath"* null, i32 %sub
|
||||
%x = ptrtoint %"class.QPainterPath"* %add.ptr.i94 to i32
|
||||
%sub2 = sub i32 %x, 0
|
||||
%div = sdiv exact i32 %sub2, 24
|
||||
br i1 undef, label %if, label %then
|
||||
|
||||
then:
|
||||
%t1 = xor i32 %div, -1
|
||||
unreachable
|
||||
|
||||
if:
|
||||
unreachable
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue