mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Adjust to the changes in the AliasSetTracker interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
057f78ab4e
commit
2741c97104
@ -15,9 +15,9 @@
|
|||||||
//
|
//
|
||||||
// This pass uses alias analysis for two purposes:
|
// This pass uses alias analysis for two purposes:
|
||||||
//
|
//
|
||||||
// 1. Moving loop invariant loads out of loops. If we can determine that a
|
// 1. Moving loop invariant loads and calls out of loops. If we can determine
|
||||||
// load inside of a loop never aliases anything stored to, we can hoist it
|
// that a load or call inside of a loop never aliases anything stored to,
|
||||||
// or sink it like any other instruction.
|
// we can hoist it or sink it like any other instruction.
|
||||||
// 2. Scalar Promotion of Memory - If there is a store instruction inside of
|
// 2. Scalar Promotion of Memory - If there is a store instruction inside of
|
||||||
// the loop, we try to move the store to happen AFTER the loop instead of
|
// the loop, we try to move the store to happen AFTER the loop instead of
|
||||||
// inside of the loop. This can only happen if a few conditions are true:
|
// inside of the loop. This can only happen if a few conditions are true:
|
||||||
@ -32,20 +32,19 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Instructions.h"
|
||||||
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Analysis/AliasAnalysis.h"
|
#include "llvm/Analysis/AliasAnalysis.h"
|
||||||
#include "llvm/Analysis/AliasSetTracker.h"
|
#include "llvm/Analysis/AliasSetTracker.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Instructions.h"
|
|
||||||
#include "llvm/DerivedTypes.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
||||||
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
#include "Support/Debug.h"
|
#include "Support/Debug.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -136,7 +135,7 @@ namespace {
|
|||||||
DominatorTree::Node *IDom = DT->getNode(ExitBlock);
|
DominatorTree::Node *IDom = DT->getNode(ExitBlock);
|
||||||
|
|
||||||
// Because the exit block is not in the loop, we know we have to get _at
|
// Because the exit block is not in the loop, we know we have to get _at
|
||||||
// least_ it's immediate dominator.
|
// least_ its immediate dominator.
|
||||||
do {
|
do {
|
||||||
// Get next Immediate Dominator.
|
// Get next Immediate Dominator.
|
||||||
IDom = IDom->getIDom();
|
IDom = IDom->getIDom();
|
||||||
@ -442,7 +441,7 @@ void LICM::sink(Instruction &I) {
|
|||||||
if (ExitBlocks.size() == 1) {
|
if (ExitBlocks.size() == 1) {
|
||||||
if (!isExitBlockDominatedByBlockInLoop(ExitBlocks[0], I.getParent())) {
|
if (!isExitBlockDominatedByBlockInLoop(ExitBlocks[0], I.getParent())) {
|
||||||
// Instruction is not used, just delete it.
|
// Instruction is not used, just delete it.
|
||||||
CurAST->remove(&I);
|
CurAST->deleteValue(&I);
|
||||||
I.getParent()->getInstList().erase(&I);
|
I.getParent()->getInstList().erase(&I);
|
||||||
} else {
|
} else {
|
||||||
// Move the instruction to the start of the exit block, after any PHI
|
// Move the instruction to the start of the exit block, after any PHI
|
||||||
@ -455,7 +454,7 @@ void LICM::sink(Instruction &I) {
|
|||||||
}
|
}
|
||||||
} else if (ExitBlocks.size() == 0) {
|
} else if (ExitBlocks.size() == 0) {
|
||||||
// The instruction is actually dead if there ARE NO exit blocks.
|
// The instruction is actually dead if there ARE NO exit blocks.
|
||||||
CurAST->remove(&I);
|
CurAST->deleteValue(&I);
|
||||||
I.getParent()->getInstList().erase(&I);
|
I.getParent()->getInstList().erase(&I);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, if we have multiple exits, use the PromoteMem2Reg function to
|
// Otherwise, if we have multiple exits, use the PromoteMem2Reg function to
|
||||||
@ -535,7 +534,7 @@ void LICM::sink(Instruction &I) {
|
|||||||
|
|
||||||
// If the instruction doesn't dominate any exit blocks, it must be dead.
|
// If the instruction doesn't dominate any exit blocks, it must be dead.
|
||||||
if (InsertedBlocks.empty()) {
|
if (InsertedBlocks.empty()) {
|
||||||
CurAST->remove(&I);
|
CurAST->deleteValue(&I);
|
||||||
I.getParent()->getInstList().erase(&I);
|
I.getParent()->getInstList().erase(&I);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,9 +549,8 @@ void LICM::sink(Instruction &I) {
|
|||||||
/// that is safe to hoist, this instruction is called to do the dirty work.
|
/// that is safe to hoist, this instruction is called to do the dirty work.
|
||||||
///
|
///
|
||||||
void LICM::hoist(Instruction &I) {
|
void LICM::hoist(Instruction &I) {
|
||||||
DEBUG(std::cerr << "LICM hoisting to";
|
DEBUG(std::cerr << "LICM hoisting to" << Preheader->getName()
|
||||||
WriteAsOperand(std::cerr, Preheader, false);
|
<< ": " << I);
|
||||||
std::cerr << ": " << I);
|
|
||||||
|
|
||||||
// Remove the instruction from its current basic block... but don't delete the
|
// Remove the instruction from its current basic block... but don't delete the
|
||||||
// instruction.
|
// instruction.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user