llvm.org GIT mirror llvm / 4acd12a
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 Dan Gohman 10 years ago
2 changed file(s) with 20 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
26122612 // If any of the operands is non-constant and if they are
26132613 // non-integer and non-pointer, don't even try to analyze them
26142614 // with scev techniques.
2615 if (!isa(Op->getType()) &&
2616 !isa(Op->getType()))
2615 if (!isSCEVable(Op->getType()))
26172616 return V;
26182617
26192618 SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
2620 if (SCEVConstant *SC = dyn_cast(OpV))
2621 Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(),
2622 Op->getType(),
2623 false));
2624 else if (SCEVUnknown *SU = dyn_cast(OpV)) {
2625 if (Constant *C = dyn_cast(SU->getValue()))
2626 Operands.push_back(ConstantExpr::getIntegerCast(C,
2627 Op->getType(),
2628 false));
2629 else
2619 if (SCEVConstant *SC = dyn_cast(OpV)) {
2620 Constant *C = SC->getValue();
2621 if (C->getType() != Op->getType())
2622 C = ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
2623 Op->getType(),
2624 false),
2625 C, Op->getType());
2626 Operands.push_back(C);
2627 } else if (SCEVUnknown *SU = dyn_cast(OpV)) {
2628 if (Constant *C = dyn_cast(SU->getValue())) {
2629 if (C->getType() != Op->getType())
2630 C =
2631 ConstantExpr::getCast(CastInst::getCastOpcode(C, false,
2632 Op->getType(),
2633 false),
2634 C, Op->getType());
2635 Operands.push_back(C);
2636 } else
26302637 return V;
26312638 } else {
26322639 return V;
0 ; RUN: llvm-as < %s | opt -loop-reduce -disable-output
1 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output
12 ; PR 3086
23
34 %struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }