mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Wrap some long lines.
Make IPSCCP strip off dead constant exprs that are using functions, making them appear as though their address is taken. This allows us to propagate some more pool descriptors, lowering the overhead of pool alloc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a6dcd0ef73
commit
7d27fc0252
@ -1141,6 +1141,9 @@ ModulePass *llvm::createIPSCCPPass() {
|
|||||||
|
|
||||||
|
|
||||||
static bool AddressIsTaken(GlobalValue *GV) {
|
static bool AddressIsTaken(GlobalValue *GV) {
|
||||||
|
// Delete any dead constantexpr klingons.
|
||||||
|
GV->removeDeadConstantUsers();
|
||||||
|
|
||||||
for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end();
|
for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end();
|
||||||
UI != E; ++UI)
|
UI != E; ++UI)
|
||||||
if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
|
if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
|
||||||
@ -1173,7 +1176,8 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
|
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
|
||||||
if (!F->isExternal())
|
if (!F->isExternal())
|
||||||
Solver.MarkBlockExecutable(F->begin());
|
Solver.MarkBlockExecutable(F->begin());
|
||||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
|
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
||||||
|
AI != E; ++AI)
|
||||||
Values[AI].markOverdefined();
|
Values[AI].markOverdefined();
|
||||||
} else {
|
} else {
|
||||||
Solver.AddTrackedFunction(F);
|
Solver.AddTrackedFunction(F);
|
||||||
@ -1182,7 +1186,8 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
// Loop over global variables. We inform the solver about any internal global
|
// Loop over global variables. We inform the solver about any internal global
|
||||||
// variables that do not have their 'addresses taken'. If they don't have
|
// variables that do not have their 'addresses taken'. If they don't have
|
||||||
// their addresses taken, we can propagate constants through them.
|
// their addresses taken, we can propagate constants through them.
|
||||||
for (Module::global_iterator G = M.global_begin(), E = M.global_end(); G != E; ++G)
|
for (Module::global_iterator G = M.global_begin(), E = M.global_end();
|
||||||
|
G != E; ++G)
|
||||||
if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G))
|
if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G))
|
||||||
Solver.TrackValueOfGlobalVariable(G);
|
Solver.TrackValueOfGlobalVariable(G);
|
||||||
|
|
||||||
@ -1204,7 +1209,8 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
//
|
//
|
||||||
std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks();
|
std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks();
|
||||||
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
|
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
|
||||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
|
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
||||||
|
AI != E; ++AI)
|
||||||
if (!AI->use_empty()) {
|
if (!AI->use_empty()) {
|
||||||
LatticeVal &IV = Values[AI];
|
LatticeVal &IV = Values[AI];
|
||||||
if (IV.isConstant() || IV.isUndefined()) {
|
if (IV.isConstant() || IV.isUndefined()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user