mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
fix PR13390: do not loop forever with self-referencing self instructions
llvm-svn: 160876
This commit is contained in:
parent
7ec9936cb2
commit
a4d7ce1441
@ -506,6 +506,10 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitPHINode(PHINode&) {
|
||||
}
|
||||
|
||||
SizeOffsetType ObjectSizeOffsetVisitor::visitSelectInst(SelectInst &I) {
|
||||
// ignore malformed self-looping selects
|
||||
if (I.getTrueValue() == &I || I.getFalseValue() == &I)
|
||||
return unknown();
|
||||
|
||||
SizeOffsetType TrueSide = compute(I.getTrueValue());
|
||||
SizeOffsetType FalseSide = compute(I.getFalseValue());
|
||||
if (bothKnown(TrueSide) && bothKnown(FalseSide) && TrueSide == FalseSide)
|
||||
@ -711,6 +715,10 @@ SizeOffsetEvalType ObjectSizeOffsetEvaluator::visitPHINode(PHINode &PHI) {
|
||||
}
|
||||
|
||||
SizeOffsetEvalType ObjectSizeOffsetEvaluator::visitSelectInst(SelectInst &I) {
|
||||
// ignore malformed self-looping selects
|
||||
if (I.getTrueValue() == &I || I.getFalseValue() == &I)
|
||||
return unknown();
|
||||
|
||||
SizeOffsetEvalType TrueSide = compute_(I.getTrueValue());
|
||||
SizeOffsetEvalType FalseSide = compute_(I.getFalseValue());
|
||||
|
||||
|
@ -219,3 +219,22 @@ define i32 @test13(i8** %esc) {
|
||||
; CHECK: ret i32 8
|
||||
ret i32 %1
|
||||
}
|
||||
|
||||
; CHECK: @PR13390
|
||||
define i32 @PR13390(i1 %bool, i8* %a) {
|
||||
entry:
|
||||
%cond = or i1 %bool, true
|
||||
br i1 %cond, label %return, label %xpto
|
||||
|
||||
xpto:
|
||||
%select = select i1 %bool, i8* %select, i8* %a
|
||||
%select2 = select i1 %bool, i8* %a, i8* %select2
|
||||
%0 = tail call i32 @llvm.objectsize.i32(i8* %select, i1 true)
|
||||
%1 = tail call i32 @llvm.objectsize.i32(i8* %select2, i1 true)
|
||||
%2 = add i32 %0, %1
|
||||
; CHECK: ret i32 undef
|
||||
ret i32 %2
|
||||
|
||||
return:
|
||||
ret i32 42
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user