diff options
author | Victor Hernandez <vhernandez@apple.com> | 2010-01-22 19:05:05 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2010-01-22 19:05:05 +0000 |
commit | 5f8c8c034a300455a6af3e224dc6a1f6e06aa6ee (patch) | |
tree | bdbf92d6f7f692d80d18b24cffc6be73453665a8 /llvm/lib/Transforms | |
parent | 1f49d652356c85a7e32b99d209429c5bb2b79195 (diff) | |
download | bcm5719-llvm-5f8c8c034a300455a6af3e224dc6a1f6e06aa6ee.tar.gz bcm5719-llvm-5f8c8c034a300455a6af3e224dc6a1f6e06aa6ee.zip |
Keep ignoring pointer-to-pointer bitcasts
llvm-svn: 94194
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 91219c45ad7..ae728ddecfd 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -406,8 +406,10 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts; --ScanInsts) { --BBI; - // Don't count debug info directives, lest they affect codegen - if (isa<DbgInfoIntrinsic>(BBI)) { + // Don't count debug info directives, lest they affect codegen, + // and we skip pointer-to-pointer bitcasts, which are NOPs. + if (isa<DbgInfoIntrinsic>(BBI) || + (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) { ScanInsts++; continue; } @@ -476,7 +478,8 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { BBI = &SI; do { ++BBI; - } while (isa<DbgInfoIntrinsic>(BBI)); + } while (isa<DbgInfoIntrinsic>(BBI) || + (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))); if (BranchInst *BI = dyn_cast<BranchInst>(BBI)) if (BI->isUnconditional()) if (SimplifyStoreAtEndOfBlock(SI)) @@ -536,7 +539,8 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) { if (OtherBr->isUnconditional()) { --BBI; // Skip over debugging info. - while (isa<DbgInfoIntrinsic>(BBI)) { + while (isa<DbgInfoIntrinsic>(BBI) || + (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) { if (BBI==OtherBB->begin()) return false; --BBI; diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 291d320636a..9fdcfe5ec3d 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -76,9 +76,6 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) { return false; // Don't allow a store OF the AI, only INTO the AI. if (SI->isVolatile()) return false; - } else if (isa<BitCastInst>(*UI)) { - // A bitcast inhibits promotion. - return false; } else { return false; } |