aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-04 01:53:05 +0000
committerDale Johannesen <dalej@apple.com>2009-03-04 01:53:05 +0000
commitcdb16aa5ab6013268d0ee0a8c8c29a8ebafb799b (patch)
tree97a52a9ec6449675d11d4cb378e9a2cdb5c722a0 /lib/Transforms
parent599a6a88ce1925a6349ac7af9a9638aad1d832cc (diff)
Always skip ptr-to-ptr bitcasts when counting,
per Chris' suggestion. Slightly faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp7
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 5b50ab56a3..66ac48181e 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11484,12 +11484,12 @@ 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.
- // Likewise, we skip bitcasts that feed into a llvm.dbg.declare; these are
- // not present when debugging is off.
+ // Don't count debug info directives, lest they affect codegen,
+ // and we skip pointer-to-pointer bitcasts, which are NOPs.
+ // It is necessary for correctness to skip those that feed into a
+ // llvm.dbg.declare, as these are not present when debugging is off.
if (isa<DbgInfoIntrinsic>(BBI) ||
- (isa<BitCastInst>(BBI) && BBI->hasOneUse() &&
- isa<DbgDeclareInst>(BBI->use_begin()))) {
+ (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
ScanInsts++;
continue;
}
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index a96c7ceaa8..9cd38cc55e 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -235,7 +235,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// function.
std::vector<ReturnInst*> Returns;
ClonedCodeInfo InlinedFunctionInfo;
- Function::iterator FirstNewBlock;
+ Function::iterator FirstNewBlock, LastNewBlock;
{ // Scope to destroy ValueMap after cloning.
DenseMap<const Value*, Value*> ValueMap;
@@ -312,6 +312,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Remember the first block that is newly cloned over.
FirstNewBlock = LastBlock; ++FirstNewBlock;
+ LastNewBlock = &Caller->back();
// Update the callgraph if requested.
if (CG)
@@ -537,7 +538,9 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Add a branch to the merge points and remove return instructions.
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
ReturnInst *RI = Returns[i];
- BranchInst::Create(AfterCallBB, RI);
+ // A return in the last block in the function falls through.
+// if (isa<InvokeInst>(TheCall) || RI->getParent() != LastNewBlock)
+ BranchInst::Create(AfterCallBB, RI);
RI->eraseFromParent();
}
} else if (!Returns.empty()) {