mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-19 03:38:26 +00:00
fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
This commit is contained in:
parent
09df97d257
commit
851aea6ce2
@ -569,9 +569,16 @@ static Constant *SymbolicallyEvaluateGEP(Constant *const *Ops, unsigned NumOps,
|
|||||||
SmallVector<Constant*, 32> NewIdxs;
|
SmallVector<Constant*, 32> NewIdxs;
|
||||||
do {
|
do {
|
||||||
if (const SequentialType *ATy = dyn_cast<SequentialType>(Ty)) {
|
if (const SequentialType *ATy = dyn_cast<SequentialType>(Ty)) {
|
||||||
// The only pointer indexing we'll do is on the first index of the GEP.
|
if (isa<PointerType>(ATy)) {
|
||||||
if (isa<PointerType>(ATy) && !NewIdxs.empty())
|
// The only pointer indexing we'll do is on the first index of the GEP.
|
||||||
break;
|
if (!NewIdxs.empty())
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Only handle pointers to sized types, not pointers to functions.
|
||||||
|
if (!ATy->getElementType()->isSized())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine which element of the array the offset points into.
|
// Determine which element of the array the offset points into.
|
||||||
APInt ElemSize(BitWidth, TD->getTypeAllocSize(ATy->getElementType()));
|
APInt ElemSize(BitWidth, TD->getTypeAllocSize(ATy->getElementType()));
|
||||||
if (ElemSize == 0)
|
if (ElemSize == 0)
|
||||||
|
@ -137,3 +137,14 @@ define arm_apcscc void @test5() {
|
|||||||
exit:
|
exit:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; PR5673
|
||||||
|
|
||||||
|
@test6g = external global i32*
|
||||||
|
|
||||||
|
define arm_aapcs_vfpcc i32 @test6(i32 %argc, i8** %argv) nounwind {
|
||||||
|
entry:
|
||||||
|
store i32* getelementptr (i32* bitcast (i32 (i32, i8**)* @test6 to i32*), i32 -2048), i32** @test6g, align 4
|
||||||
|
unreachable
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user