mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Make TargetData optional in GlobalOpt and ArgumentPromotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -61,7 +61,6 @@ namespace {
|
||||
struct VISIBILITY_HIDDEN ArgPromotion : public CallGraphSCCPass {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
AU.addRequired<TargetData>();
|
||||
CallGraphSCCPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
@@ -433,7 +432,8 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg, bool isByVal) const {
|
||||
SmallPtrSet<BasicBlock*, 16> TranspBlocks;
|
||||
|
||||
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
|
||||
TargetData &TD = getAnalysis<TargetData>();
|
||||
TargetData *TD = getAnalysisIfAvailable<TargetData>();
|
||||
if (!TD) return false; // Without TargetData, assume the worst.
|
||||
|
||||
for (unsigned i = 0, e = Loads.size(); i != e; ++i) {
|
||||
// Check to see if the load is invalidated from the start of the block to
|
||||
@@ -443,7 +443,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg, bool isByVal) const {
|
||||
|
||||
const PointerType *LoadTy =
|
||||
cast<PointerType>(Load->getPointerOperand()->getType());
|
||||
unsigned LoadSize = (unsigned)TD.getTypeStoreSize(LoadTy->getElementType());
|
||||
unsigned LoadSize =(unsigned)TD->getTypeStoreSize(LoadTy->getElementType());
|
||||
|
||||
if (AA.canInstructionRangeModify(BB->front(), *Load, Arg, LoadSize))
|
||||
return false; // Pointer is invalidated!
|
||||
|
Reference in New Issue
Block a user