mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
In ChangeCompareStride, when the stride to be reused is truncated to
a smaller type, promoted its offset back up to the type of the new comparison. This fixes PR4222. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc9be219d6
commit
ead28bd04b
@ -2005,11 +2005,16 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
|
|||||||
ConstantInt *CI = ConstantInt::get(NewCmpIntTy, NewCmpVal);
|
ConstantInt *CI = ConstantInt::get(NewCmpIntTy, NewCmpVal);
|
||||||
NewCmpRHS = ConstantExpr::getIntToPtr(CI, NewCmpTy);
|
NewCmpRHS = ConstantExpr::getIntToPtr(CI, NewCmpTy);
|
||||||
}
|
}
|
||||||
|
NewOffset = CondUse->getOffset();
|
||||||
|
if (CondUse->isSigned())
|
||||||
|
NewOffset = SE->getNoopOrSignExtend(CondUse->getOffset(), NewCmpTy);
|
||||||
|
else
|
||||||
|
NewOffset = SE->getNoopOrZeroExtend(CondUse->getOffset(), NewCmpTy);
|
||||||
NewOffset = TyBits == NewTyBits
|
NewOffset = TyBits == NewTyBits
|
||||||
? SE->getMulExpr(CondUse->getOffset(),
|
? SE->getMulExpr(NewOffset,
|
||||||
SE->getConstant(ConstantInt::get(CmpTy, Scale)))
|
SE->getConstant(ConstantInt::get(CmpTy, Scale)))
|
||||||
: SE->getConstant(ConstantInt::get(NewCmpIntTy,
|
: SE->getConstant(ConstantInt::get(NewCmpIntTy,
|
||||||
cast<SCEVConstant>(CondUse->getOffset())->getValue()
|
cast<SCEVConstant>(NewOffset)->getValue()
|
||||||
->getSExtValue()*Scale));
|
->getSExtValue()*Scale));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
; RUN: llvm-as < %s | llc
|
||||||
|
; PR4222
|
||||||
|
|
||||||
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
||||||
|
target triple = "x86_64-pc-linux-gnu"
|
||||||
|
module asm ".ident\09\22$FreeBSD: head/sys/amd64/amd64/minidump_machdep.c 184499 2008-10-31 10:11:35Z kib $\22"
|
||||||
|
%struct.dumperinfo = type <{ i32 (i8*, i8*, i64, i64, i64)*, i8*, i32, i32, i64, i64 }>
|
||||||
|
|
||||||
|
define void @minidumpsys(%struct.dumperinfo* %di) nounwind {
|
||||||
|
entry:
|
||||||
|
br label %if.end
|
||||||
|
|
||||||
|
if.end: ; preds = %if.end52, %entry
|
||||||
|
br label %for.cond.i.preheader
|
||||||
|
|
||||||
|
for.cond.i.preheader: ; preds = %if.end52, %if.end
|
||||||
|
%indvar688 = phi i64 [ 0, %if.end ], [ %indvar.next689, %if.end52 ] ; <i64> [#uses=3]
|
||||||
|
%tmp690 = shl i64 %indvar688, 12 ; <i64> [#uses=1]
|
||||||
|
%pa.0642 = add i64 %tmp690, 0 ; <i64> [#uses=1]
|
||||||
|
%indvar688703 = trunc i64 %indvar688 to i32 ; <i32> [#uses=1]
|
||||||
|
%tmp692693 = add i32 %indvar688703, 1 ; <i32> [#uses=1]
|
||||||
|
%phitmp = sext i32 %tmp692693 to i64 ; <i64> [#uses=1]
|
||||||
|
br i1 false, label %if.end52, label %land.lhs.true.i
|
||||||
|
|
||||||
|
land.lhs.true.i: ; preds = %for.cond.i.preheader
|
||||||
|
%shr2.i = lshr i64 %pa.0642, 18 ; <i64> [#uses=0]
|
||||||
|
unreachable
|
||||||
|
|
||||||
|
if.end52: ; preds = %for.cond.i.preheader
|
||||||
|
%phitmp654 = icmp ult i64 %phitmp, 512 ; <i1> [#uses=1]
|
||||||
|
%indvar.next689 = add i64 %indvar688, 1 ; <i64> [#uses=1]
|
||||||
|
br i1 %phitmp654, label %for.cond.i.preheader, label %if.end
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user