mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +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:
@ -24,6 +24,7 @@
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Transforms/Utils/SSAUpdater.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
@ -75,6 +76,7 @@ namespace {
|
||||
///
|
||||
class JumpThreading : public FunctionPass {
|
||||
TargetData *TD;
|
||||
TargetLibraryInfo *TLI;
|
||||
LazyValueInfo *LVI;
|
||||
#ifdef NDEBUG
|
||||
SmallPtrSet<BasicBlock*, 16> LoopHeaders;
|
||||
@ -107,6 +109,7 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<LazyValueInfo>();
|
||||
AU.addPreserved<LazyValueInfo>();
|
||||
AU.addRequired<TargetLibraryInfo>();
|
||||
}
|
||||
|
||||
void FindLoopHeaders(Function &F);
|
||||
@ -133,6 +136,7 @@ char JumpThreading::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(JumpThreading, "jump-threading",
|
||||
"Jump Threading", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(LazyValueInfo)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
|
||||
INITIALIZE_PASS_END(JumpThreading, "jump-threading",
|
||||
"Jump Threading", false, false)
|
||||
|
||||
@ -144,6 +148,7 @@ FunctionPass *llvm::createJumpThreadingPass() { return new JumpThreading(); }
|
||||
bool JumpThreading::runOnFunction(Function &F) {
|
||||
DEBUG(dbgs() << "Jump threading on function '" << F.getName() << "'\n");
|
||||
TD = getAnalysisIfAvailable<TargetData>();
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
LVI = &getAnalysis<LazyValueInfo>();
|
||||
|
||||
FindLoopHeaders(F);
|
||||
@ -674,7 +679,7 @@ bool JumpThreading::ProcessBlock(BasicBlock *BB) {
|
||||
// Run constant folding to see if we can reduce the condition to a simple
|
||||
// constant.
|
||||
if (Instruction *I = dyn_cast<Instruction>(Condition)) {
|
||||
Value *SimpleVal = ConstantFoldInstruction(I, TD);
|
||||
Value *SimpleVal = ConstantFoldInstruction(I, TD, TLI);
|
||||
if (SimpleVal) {
|
||||
I->replaceAllUsesWith(SimpleVal);
|
||||
I->eraseFromParent();
|
||||
|
Reference in New Issue
Block a user