mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
ConstantFoldConstantExpression can theoretically return null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104948 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2278,7 +2278,8 @@ const SCEV *ScalarEvolution::getSizeOfExpr(const Type *AllocTy) {
|
|||||||
|
|
||||||
Constant *C = ConstantExpr::getSizeOf(AllocTy);
|
Constant *C = ConstantExpr::getSizeOf(AllocTy);
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
||||||
C = ConstantFoldConstantExpression(CE, TD);
|
if (Constant *Folded = ConstantFoldConstantExpression(CE, TD))
|
||||||
|
C = Folded;
|
||||||
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(AllocTy));
|
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(AllocTy));
|
||||||
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
||||||
}
|
}
|
||||||
@@ -2286,7 +2287,8 @@ const SCEV *ScalarEvolution::getSizeOfExpr(const Type *AllocTy) {
|
|||||||
const SCEV *ScalarEvolution::getAlignOfExpr(const Type *AllocTy) {
|
const SCEV *ScalarEvolution::getAlignOfExpr(const Type *AllocTy) {
|
||||||
Constant *C = ConstantExpr::getAlignOf(AllocTy);
|
Constant *C = ConstantExpr::getAlignOf(AllocTy);
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
||||||
C = ConstantFoldConstantExpression(CE, TD);
|
if (Constant *Folded = ConstantFoldConstantExpression(CE, TD))
|
||||||
|
C = Folded;
|
||||||
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(AllocTy));
|
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(AllocTy));
|
||||||
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
||||||
}
|
}
|
||||||
@@ -2302,7 +2304,8 @@ const SCEV *ScalarEvolution::getOffsetOfExpr(const StructType *STy,
|
|||||||
|
|
||||||
Constant *C = ConstantExpr::getOffsetOf(STy, FieldNo);
|
Constant *C = ConstantExpr::getOffsetOf(STy, FieldNo);
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
||||||
C = ConstantFoldConstantExpression(CE, TD);
|
if (Constant *Folded = ConstantFoldConstantExpression(CE, TD))
|
||||||
|
C = Folded;
|
||||||
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(STy));
|
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(STy));
|
||||||
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
||||||
}
|
}
|
||||||
@@ -2311,7 +2314,8 @@ const SCEV *ScalarEvolution::getOffsetOfExpr(const Type *CTy,
|
|||||||
Constant *FieldNo) {
|
Constant *FieldNo) {
|
||||||
Constant *C = ConstantExpr::getOffsetOf(CTy, FieldNo);
|
Constant *C = ConstantExpr::getOffsetOf(CTy, FieldNo);
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
||||||
C = ConstantFoldConstantExpression(CE, TD);
|
if (Constant *Folded = ConstantFoldConstantExpression(CE, TD))
|
||||||
|
C = Folded;
|
||||||
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(CTy));
|
const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(CTy));
|
||||||
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
return getTruncateOrZeroExtend(getSCEV(C), Ty);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user