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