forked from OSchip/llvm-project
[LoopUnrollAnalyzer] Fix a crash in UnrolledInstAnalyzer::visitCastInst.
This fixes PR27847. Now for real. llvm-svn: 270629
This commit is contained in:
parent
4caa1bf0bd
commit
7216dd4668
|
@ -141,11 +141,7 @@ bool UnrolledInstAnalyzer::visitCastInst(CastInst &I) {
|
|||
Constant *COp = dyn_cast<Constant>(I.getOperand(0));
|
||||
if (!COp)
|
||||
COp = SimplifiedValues.lookup(I.getOperand(0));
|
||||
if (COp) {
|
||||
if (COp->getType() == I.getType()) {
|
||||
SimplifiedValues[&I] = cast<Constant>(COp);
|
||||
return true;
|
||||
}
|
||||
if (COp && CastInst::castIsValid(I.getOpcode(), COp, I.getType())) {
|
||||
if (Constant *C =
|
||||
ConstantExpr::getCast(I.getOpcode(), COp, I.getType())) {
|
||||
SimplifiedValues[&I] = C;
|
||||
|
|
|
@ -119,3 +119,21 @@ for.inc:
|
|||
for.cond.cleanup:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @ptrtoint_cast2() {
|
||||
entry:
|
||||
br i1 false, label %for.body.lr.ph, label %exit
|
||||
|
||||
for.body.lr.ph:
|
||||
br label %for.body
|
||||
|
||||
for.body:
|
||||
%iv = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
|
||||
%offset = getelementptr inbounds float, float* null, i32 3
|
||||
%bc = bitcast float* %offset to i64*
|
||||
%inc = add nuw nsw i32 %iv, 1
|
||||
br i1 false, label %for.body, label %exit
|
||||
|
||||
exit:
|
||||
ret void
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue