mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix a few more places where TargetData/TargetLibraryInfo is not being passed.
Add FIXMEs to places that are non-trivial to fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145661 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,6 +45,8 @@
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Transforms/Utils/SSAUpdater.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@@ -84,6 +86,7 @@ namespace {
|
||||
AU.addPreserved<AliasAnalysis>();
|
||||
AU.addPreserved("scalar-evolution");
|
||||
AU.addPreservedID(LoopSimplifyID);
|
||||
AU.addRequired<TargetLibraryInfo>();
|
||||
}
|
||||
|
||||
bool doFinalization() {
|
||||
@@ -96,6 +99,9 @@ namespace {
|
||||
LoopInfo *LI; // Current LoopInfo
|
||||
DominatorTree *DT; // Dominator Tree for the current Loop.
|
||||
|
||||
TargetData *TD; // TargetData for constant folding.
|
||||
TargetLibraryInfo *TLI; // TargetLibraryInfo for constant folding.
|
||||
|
||||
// State that is updated as we process loops.
|
||||
bool Changed; // Set to true when we change anything.
|
||||
BasicBlock *Preheader; // The preheader block of the current loop...
|
||||
@@ -177,6 +183,7 @@ INITIALIZE_PASS_BEGIN(LICM, "licm", "Loop Invariant Code Motion", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(DominatorTree)
|
||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
||||
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
||||
INITIALIZE_PASS_END(LICM, "licm", "Loop Invariant Code Motion", false, false)
|
||||
|
||||
@@ -194,6 +201,9 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
DT = &getAnalysis<DominatorTree>();
|
||||
|
||||
TD = getAnalysisIfAvailable<TargetData>();
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
CurAST = new AliasSetTracker(*AA);
|
||||
// Collect Alias info from subloops.
|
||||
for (Loop::iterator LoopItr = L->begin(), LoopItrE = L->end();
|
||||
@@ -333,7 +343,7 @@ void LICM::HoistRegion(DomTreeNode *N) {
|
||||
// Try constant folding this instruction. If all the operands are
|
||||
// constants, it is technically hoistable, but it would be better to just
|
||||
// fold it.
|
||||
if (Constant *C = ConstantFoldInstruction(&I)) {
|
||||
if (Constant *C = ConstantFoldInstruction(&I, TD, TLI)) {
|
||||
DEBUG(dbgs() << "LICM folding inst: " << I << " --> " << *C << '\n');
|
||||
CurAST->copyValue(&I, C);
|
||||
CurAST->deleteValue(&I);
|
||||
|
Reference in New Issue
Block a user