mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-11 15:08:16 +00:00
Revert "add support for PHI nodes to ObjectSizeOffsetVisitor"
This reverts r171298. Breaks clang selfhost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171318 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
526057921d
commit
44365353a4
@ -543,20 +543,9 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitLoadInst(LoadInst&) {
|
|||||||
return unknown();
|
return unknown();
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeOffsetType ObjectSizeOffsetVisitor::visitPHINode(PHINode &PHI) {
|
SizeOffsetType ObjectSizeOffsetVisitor::visitPHINode(PHINode&) {
|
||||||
if (PHI.getNumIncomingValues() == 0)
|
// too complex to analyze statically.
|
||||||
return unknown();
|
return unknown();
|
||||||
|
|
||||||
SizeOffsetType Ret = compute(PHI.getIncomingValue(0));
|
|
||||||
if (!bothKnown(Ret))
|
|
||||||
return unknown();
|
|
||||||
|
|
||||||
// verify that all PHI incoming pointers have the same size and offset
|
|
||||||
for (unsigned i = 1, e = PHI.getNumIncomingValues(); i != e; ++i) {
|
|
||||||
if (compute(PHI.getIncomingValue(i)) != Ret)
|
|
||||||
return unknown();
|
|
||||||
}
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeOffsetType ObjectSizeOffsetVisitor::visitSelectInst(SelectInst &I) {
|
SizeOffsetType ObjectSizeOffsetVisitor::visitSelectInst(SelectInst &I) {
|
||||||
|
@ -256,57 +256,3 @@ xpto:
|
|||||||
return:
|
return:
|
||||||
ret i32 7
|
ret i32 7
|
||||||
}
|
}
|
||||||
|
|
||||||
declare noalias i8* @valloc(i32) nounwind
|
|
||||||
|
|
||||||
; CHECK: @test14
|
|
||||||
; CHECK: ret i32 6
|
|
||||||
define i32 @test14(i32 %a) nounwind {
|
|
||||||
switch i32 %a, label %sw.default [
|
|
||||||
i32 1, label %sw.bb
|
|
||||||
i32 2, label %sw.bb1
|
|
||||||
]
|
|
||||||
|
|
||||||
sw.bb:
|
|
||||||
%call = tail call noalias i8* @malloc(i32 6) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.bb1:
|
|
||||||
%call2 = tail call noalias i8* @calloc(i32 3, i32 2) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.default:
|
|
||||||
%call3 = tail call noalias i8* @valloc(i32 6) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.epilog:
|
|
||||||
%b.0 = phi i8* [ %call3, %sw.default ], [ %call2, %sw.bb1 ], [ %call, %sw.bb ]
|
|
||||||
%1 = tail call i32 @llvm.objectsize.i32(i8* %b.0, i1 false)
|
|
||||||
ret i32 %1
|
|
||||||
}
|
|
||||||
|
|
||||||
; CHECK: @test15
|
|
||||||
; CHECK: llvm.objectsize
|
|
||||||
define i32 @test15(i32 %a) nounwind {
|
|
||||||
switch i32 %a, label %sw.default [
|
|
||||||
i32 1, label %sw.bb
|
|
||||||
i32 2, label %sw.bb1
|
|
||||||
]
|
|
||||||
|
|
||||||
sw.bb:
|
|
||||||
%call = tail call noalias i8* @malloc(i32 3) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.bb1:
|
|
||||||
%call2 = tail call noalias i8* @calloc(i32 2, i32 1) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.default:
|
|
||||||
%call3 = tail call noalias i8* @valloc(i32 3) nounwind
|
|
||||||
br label %sw.epilog
|
|
||||||
|
|
||||||
sw.epilog:
|
|
||||||
%b.0 = phi i8* [ %call3, %sw.default ], [ %call2, %sw.bb1 ], [ %call, %sw.bb ]
|
|
||||||
%1 = tail call i32 @llvm.objectsize.i32(i8* %b.0, i1 false)
|
|
||||||
ret i32 %1
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user