mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 23:57:48 +00:00
Revert a patch that is unsafe, due to out of range array accesses in inner
array scopes possibly accessing valid memory in outer subscripts. llvm-svn: 28478
This commit is contained in:
parent
227c09e7d2
commit
d3eff919d8
@ -274,7 +274,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
|
||||
} else if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand())) {
|
||||
if (const ArrayType *ATy = dyn_cast<ArrayType>(*I)) {
|
||||
if ((uint64_t)CI->getRawValue() >= ATy->getNumElements())
|
||||
C = UndefValue::get(ATy->getElementType());
|
||||
return 0;
|
||||
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
|
||||
C = CA->getOperand((unsigned)CI->getRawValue());
|
||||
else if (isa<ConstantAggregateZero>(C))
|
||||
@ -285,7 +285,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
|
||||
return 0;
|
||||
} else if (const PackedType *PTy = dyn_cast<PackedType>(*I)) {
|
||||
if ((uint64_t)CI->getRawValue() >= PTy->getNumElements())
|
||||
C = UndefValue::get(PTy->getElementType());
|
||||
return 0;
|
||||
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C))
|
||||
C = CP->getOperand((unsigned)CI->getRawValue());
|
||||
else if (isa<ConstantAggregateZero>(C))
|
||||
|
Loading…
Reference in New Issue
Block a user