mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Various code simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95044 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -351,17 +351,15 @@ bool SCEVUnknown::isSizeOf(const Type *&AllocTy) const {
|
||||
if (ConstantExpr *VCE = dyn_cast<ConstantExpr>(V))
|
||||
if (VCE->getOpcode() == Instruction::PtrToInt)
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(VCE->getOperand(0)))
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr)
|
||||
if (CE->getOperand(0)->isNullValue()) {
|
||||
const Type *Ty =
|
||||
cast<PointerType>(CE->getOperand(0)->getType())->getElementType();
|
||||
if (CE->getNumOperands() == 2)
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr &&
|
||||
CE->getOperand(0)->isNullValue() &&
|
||||
CE->getNumOperands() == 2)
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(CE->getOperand(1)))
|
||||
if (CI->isOne()) {
|
||||
AllocTy = Ty;
|
||||
AllocTy = cast<PointerType>(CE->getOperand(0)->getType())
|
||||
->getElementType();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -370,8 +368,8 @@ bool SCEVUnknown::isAlignOf(const Type *&AllocTy) const {
|
||||
if (ConstantExpr *VCE = dyn_cast<ConstantExpr>(V))
|
||||
if (VCE->getOpcode() == Instruction::PtrToInt)
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(VCE->getOperand(0)))
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr)
|
||||
if (CE->getOperand(0)->isNullValue()) {
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr &&
|
||||
CE->getOperand(0)->isNullValue()) {
|
||||
const Type *Ty =
|
||||
cast<PointerType>(CE->getOperand(0)->getType())->getElementType();
|
||||
if (const StructType *STy = dyn_cast<StructType>(Ty))
|
||||
@@ -2720,7 +2718,6 @@ const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
|
||||
} else {
|
||||
// For an array, add the element offset, explicitly scaled.
|
||||
const SCEV *LocalOffset = getSCEV(Index);
|
||||
if (!isa<PointerType>(LocalOffset->getType()))
|
||||
// Getelementptr indicies are signed.
|
||||
LocalOffset = getTruncateOrSignExtend(LocalOffset, IntPtrTy);
|
||||
// Lower "inbounds" GEPs to NSW arithmetic.
|
||||
|
Reference in New Issue
Block a user