mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[LoopUnrollAnalyzer] Fix a crash in UnrolledInstAnalyzer::visitCastInst.
This fixes PR27847. llvm-svn: 270517
This commit is contained in:
parent
5844629626
commit
32f621fe89
@ -141,12 +141,17 @@ bool UnrolledInstAnalyzer::visitCastInst(CastInst &I) {
|
|||||||
Constant *COp = dyn_cast<Constant>(I.getOperand(0));
|
Constant *COp = dyn_cast<Constant>(I.getOperand(0));
|
||||||
if (!COp)
|
if (!COp)
|
||||||
COp = SimplifiedValues.lookup(I.getOperand(0));
|
COp = SimplifiedValues.lookup(I.getOperand(0));
|
||||||
if (COp)
|
if (COp) {
|
||||||
|
if (COp->getType() == I.getType()) {
|
||||||
|
SimplifiedValues[&I] = cast<Constant>(COp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (Constant *C =
|
if (Constant *C =
|
||||||
ConstantExpr::getCast(I.getOpcode(), COp, I.getType())) {
|
ConstantExpr::getCast(I.getOpcode(), COp, I.getType())) {
|
||||||
SimplifiedValues[&I] = C;
|
SimplifiedValues[&I] = C;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Base::visitCastInst(I);
|
return Base::visitCastInst(I);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
; Check that we don't crash on corner cases.
|
; Check that we don't crash on corner cases.
|
||||||
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-percent-dynamic-cost-saved-threshold=20 -o /dev/null
|
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-percent-dynamic-cost-saved-threshold=20 -o /dev/null
|
||||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
|
||||||
@known_constant = internal unnamed_addr constant [10 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 16
|
@known_constant = internal unnamed_addr constant [10 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 16
|
||||||
@ -100,3 +100,22 @@ for.body:
|
|||||||
for.exit:
|
for.exit:
|
||||||
ret <4 x i32> %r
|
ret <4 x i32> %r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define void @ptrtoint_cast() optsize {
|
||||||
|
entry:
|
||||||
|
br label %for.body
|
||||||
|
|
||||||
|
for.body:
|
||||||
|
br i1 true, label %for.inc, label %if.then
|
||||||
|
|
||||||
|
if.then:
|
||||||
|
%arraydecay = getelementptr inbounds [1 x i32], [1 x i32]* null, i64 0, i64 0
|
||||||
|
%x = ptrtoint i32* %arraydecay to i64
|
||||||
|
br label %for.inc
|
||||||
|
|
||||||
|
for.inc:
|
||||||
|
br i1 false, label %for.body, label %for.cond.cleanup
|
||||||
|
|
||||||
|
for.cond.cleanup:
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user