mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-13 08:35:46 +00:00
Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e41a115e6a
commit
c6f69e94fa
@ -66,8 +66,7 @@ Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
|
|||||||
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
|
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
|
||||||
/// getelementptr constantexpr, return the constant value being addressed by the
|
/// getelementptr constantexpr, return the constant value being addressed by the
|
||||||
/// constant expression, or null if something is funny and we can't decide.
|
/// constant expression, or null if something is funny and we can't decide.
|
||||||
Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE,
|
Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE);
|
||||||
LLVMContext &Context);
|
|
||||||
|
|
||||||
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
|
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
|
||||||
/// the specified function.
|
/// the specified function.
|
||||||
|
@ -606,8 +606,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
|
|||||||
/// getelementptr constantexpr, return the constant value being addressed by the
|
/// getelementptr constantexpr, return the constant value being addressed by the
|
||||||
/// constant expression, or null if something is funny and we can't decide.
|
/// constant expression, or null if something is funny and we can't decide.
|
||||||
Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
|
Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
|
||||||
ConstantExpr *CE,
|
ConstantExpr *CE) {
|
||||||
LLVMContext &Context) {
|
|
||||||
if (CE->getOperand(1) != Constant::getNullValue(CE->getOperand(1)->getType()))
|
if (CE->getOperand(1) != Constant::getNullValue(CE->getOperand(1)->getType()))
|
||||||
return 0; // Do not allow stepping over the value!
|
return 0; // Do not allow stepping over the value!
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init,
|
|||||||
if (CE->getOpcode() == Instruction::GetElementPtr) {
|
if (CE->getOpcode() == Instruction::GetElementPtr) {
|
||||||
Constant *SubInit = 0;
|
Constant *SubInit = 0;
|
||||||
if (Init)
|
if (Init)
|
||||||
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE, Context);
|
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
|
||||||
Changed |= CleanupConstantGlobalUsers(CE, SubInit, Context);
|
Changed |= CleanupConstantGlobalUsers(CE, SubInit, Context);
|
||||||
} else if (CE->getOpcode() == Instruction::BitCast &&
|
} else if (CE->getOpcode() == Instruction::BitCast &&
|
||||||
isa<PointerType>(CE->getType())) {
|
isa<PointerType>(CE->getType())) {
|
||||||
@ -325,7 +325,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init,
|
|||||||
ConstantExpr *CE =
|
ConstantExpr *CE =
|
||||||
dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP, Context));
|
dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP, Context));
|
||||||
if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr)
|
if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr)
|
||||||
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE, Context);
|
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
|
||||||
}
|
}
|
||||||
Changed |= CleanupConstantGlobalUsers(GEP, SubInit, Context);
|
Changed |= CleanupConstantGlobalUsers(GEP, SubInit, Context);
|
||||||
|
|
||||||
@ -2475,8 +2475,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C, LLVMContext &Context) {
|
|||||||
if (!CE->isGEPWithNoNotionalOverIndexing())
|
if (!CE->isGEPWithNoNotionalOverIndexing())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE,
|
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE);
|
||||||
Context);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2588,8 +2587,7 @@ static Constant *ComputeLoadResult(Constant *P,
|
|||||||
isa<GlobalVariable>(CE->getOperand(0))) {
|
isa<GlobalVariable>(CE->getOperand(0))) {
|
||||||
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
|
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
|
||||||
if (GV->hasDefinitiveInitializer())
|
if (GV->hasDefinitiveInitializer())
|
||||||
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE,
|
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE);
|
||||||
Context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; // don't know how to evaluate.
|
return 0; // don't know how to evaluate.
|
||||||
|
@ -11439,8 +11439,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
|||||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
||||||
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
||||||
if (Constant *V =
|
if (Constant *V =
|
||||||
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE,
|
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE))
|
||||||
*Context))
|
|
||||||
return ReplaceInstUsesWith(LI, V);
|
return ReplaceInstUsesWith(LI, V);
|
||||||
if (CE->getOperand(0)->isNullValue()) {
|
if (CE->getOperand(0)->isNullValue()) {
|
||||||
// Insert a new store to null instruction before the load to indicate
|
// Insert a new store to null instruction before the load to indicate
|
||||||
|
@ -1162,8 +1162,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) {
|
|||||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
||||||
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
||||||
if (Constant *V =
|
if (Constant *V =
|
||||||
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE,
|
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE)) {
|
||||||
*Context)) {
|
|
||||||
markConstant(IV, &I, V);
|
markConstant(IV, &I, V);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ ConstantFoldMappedInstruction(const Instruction *I) {
|
|||||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
||||||
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
if (GV->isConstant() && GV->hasDefinitiveInitializer())
|
||||||
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(),
|
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(),
|
||||||
CE, Context);
|
CE);
|
||||||
|
|
||||||
return ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Ops[0],
|
return ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Ops[0],
|
||||||
Ops.size(), Context, TD);
|
Ops.size(), Context, TD);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user