mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
IR: Properly canonicalize PointerType in ConstantExpr GEPs
No additional test was needed, Other/constant-fold-gep.ll detects this just fine. llvm-svn: 194221
This commit is contained in:
parent
d1c4acb898
commit
1cc343770a
@ -1966,11 +1966,12 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
|
||||
else if (VectorType *VTy = dyn_cast<VectorType>(LastTy))
|
||||
NumElements = VTy->getNumElements();
|
||||
|
||||
if (NumElements > 0) {
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx0)) {
|
||||
int64_t Idx0Val = CI->getSExtValue();
|
||||
if (NumElements > 0 && Idx0Val >= 0 &&
|
||||
(uint64_t)Idx0Val < NumElements)
|
||||
if (Idx0Val >= 0 && (uint64_t)Idx0Val < NumElements)
|
||||
IsSequentialAccessInRange = true;
|
||||
}
|
||||
} else if (PointerType *PTy = dyn_cast<PointerType>(LastTy))
|
||||
// Only handle pointers to sized types, not pointers to functions.
|
||||
if (PTy->getElementType()->isSized())
|
||||
|
Loading…
Reference in New Issue
Block a user