mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
Don't try to mix integers and pointers in an icmp instruction
in getSCEVAtScope. llvm-svn: 70495
This commit is contained in:
parent
9219a96e13
commit
25d21786d3
@ -2613,21 +2613,28 @@ SCEVHandle ScalarEvolution::getSCEVAtScope(SCEV *V, const Loop *L) {
|
|||||||
// If any of the operands is non-constant and if they are
|
// If any of the operands is non-constant and if they are
|
||||||
// non-integer and non-pointer, don't even try to analyze them
|
// non-integer and non-pointer, don't even try to analyze them
|
||||||
// with scev techniques.
|
// with scev techniques.
|
||||||
if (!isa<IntegerType>(Op->getType()) &&
|
if (!isSCEVable(Op->getType()))
|
||||||
!isa<PointerType>(Op->getType()))
|
|
||||||
return V;
|
return V;
|
||||||
|
|
||||||
SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
|
SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV)) {
|
||||||
Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(),
|
Constant *C = SC->getValue();
|
||||||
Op->getType(),
|
if (C->getType() != Op->getType())
|
||||||
false));
|
C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
|
||||||
else if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(OpV)) {
|
Op->getType(),
|
||||||
if (Constant *C = dyn_cast<Constant>(SU->getValue()))
|
false),
|
||||||
Operands.push_back(ConstantExpr::getIntegerCast(C,
|
C, Op->getType());
|
||||||
Op->getType(),
|
Operands.push_back(C);
|
||||||
false));
|
} else if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(OpV)) {
|
||||||
else
|
if (Constant *C = dyn_cast<Constant>(SU->getValue())) {
|
||||||
|
if (C->getType() != Op->getType())
|
||||||
|
C =
|
||||||
|
ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
|
||||||
|
Op->getType(),
|
||||||
|
false),
|
||||||
|
C, Op->getType());
|
||||||
|
Operands.push_back(C);
|
||||||
|
} else
|
||||||
return V;
|
return V;
|
||||||
} else {
|
} else {
|
||||||
return V;
|
return V;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
; RUN: llvm-as < %s | opt -loop-reduce -disable-output
|
; RUN: llvm-as < %s | opt -loop-reduce -disable-output
|
||||||
|
; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output
|
||||||
; PR 3086
|
; PR 3086
|
||||||
|
|
||||||
%struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
|
%struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
|
||||||
|
Loading…
Reference in New Issue
Block a user