Loading llvm/lib/Transforms/ExprTypeConvert.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty, // If it's a constant... all constants can be converted to a different // type. // if (Constant *CPV = dyn_cast<Constant>(V)) if (isa<Constant>(V) && !isa<GlobalValue>(V)) return true; CTMap[V] = Ty; Loading Loading @@ -984,10 +984,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0; Value *OtherOp = I->getOperand(OtherIdx); Res->setOperand(!OtherIdx, NewVal); Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD); Res->setOperand(OtherIdx, NewOther); Res->setOperand(!OtherIdx, NewVal); break; } case Instruction::Shl: Loading llvm/lib/Transforms/IPO/Inliner.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -54,8 +54,8 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, E = CalleeNode->end(); I != E; ++I) CallerNode->addCalledFunction(*I); // If we inlined the last possible call site to the function, // delete the function body now. // If we inlined the last possible call site to the function, delete the // function body now. if (Callee->use_empty() && Callee->hasInternalLinkage() && !SCCFunctions.count(Callee)) { DEBUG(std::cerr << " -> Deleting dead function: " Loading Loading @@ -167,15 +167,14 @@ bool Inliner::doFinalization(CallGraph &CG) { // from the program. Insert the dead ones in the FunctionsToRemove set. for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) { CallGraphNode *CGN = I->second; Function *F = CGN ? CGN->getFunction() : 0; if (Function *F = CGN ? CGN->getFunction() : 0) { // If the only remaining users of the function are dead constants, // remove them. if (F) F->removeDeadConstantUsers(); bool HadDeadConstantUsers = !F->use_empty(); F->removeDeadConstantUsers(); if (F && (F->hasLinkOnceLinkage() || F->hasInternalLinkage()) && if ((F->hasLinkOnceLinkage() || F->hasInternalLinkage()) && F->use_empty()) { // Remove any call graph edges from the function to its callees. while (CGN->begin() != CGN->end()) CGN->removeCallEdgeTo(*(CGN->end()-1)); Loading @@ -183,13 +182,14 @@ bool Inliner::doFinalization(CallGraph &CG) { // If the function has external linkage (basically if it's a linkonce // function) remove the edge from the external node to the callee // node. if (!F->hasInternalLinkage()) if (!F->hasInternalLinkage() || HadDeadConstantUsers) CG.getExternalCallingNode()->removeCallEdgeTo(CGN); // Removing the node for callee from the call graph and delete it. FunctionsToRemove.insert(CGN); } } } // Now that we know which functions to delete, do so. We didn't want to do // this inline, because that would invalidate our CallGraph::iterator Loading llvm/lib/Transforms/LevelRaise.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { // Make sure the source doesn't change type ConvertedTypes[Src] = Src->getType(); if (ValueConvertibleToType(CI, Src->getType(), ConvertedTypes, TD)) { PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI, *BB->getParent()); //PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI, // *BB->getParent()); DEBUG(std::cerr << "\nCONVERTING EXPR TYPE:\n"); { // ValueMap must be destroyed before function verified! Loading Loading
llvm/lib/Transforms/ExprTypeConvert.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty, // If it's a constant... all constants can be converted to a different // type. // if (Constant *CPV = dyn_cast<Constant>(V)) if (isa<Constant>(V) && !isa<GlobalValue>(V)) return true; CTMap[V] = Ty; Loading Loading @@ -984,10 +984,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0; Value *OtherOp = I->getOperand(OtherIdx); Res->setOperand(!OtherIdx, NewVal); Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD); Res->setOperand(OtherIdx, NewOther); Res->setOperand(!OtherIdx, NewVal); break; } case Instruction::Shl: Loading
llvm/lib/Transforms/IPO/Inliner.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -54,8 +54,8 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, E = CalleeNode->end(); I != E; ++I) CallerNode->addCalledFunction(*I); // If we inlined the last possible call site to the function, // delete the function body now. // If we inlined the last possible call site to the function, delete the // function body now. if (Callee->use_empty() && Callee->hasInternalLinkage() && !SCCFunctions.count(Callee)) { DEBUG(std::cerr << " -> Deleting dead function: " Loading Loading @@ -167,15 +167,14 @@ bool Inliner::doFinalization(CallGraph &CG) { // from the program. Insert the dead ones in the FunctionsToRemove set. for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) { CallGraphNode *CGN = I->second; Function *F = CGN ? CGN->getFunction() : 0; if (Function *F = CGN ? CGN->getFunction() : 0) { // If the only remaining users of the function are dead constants, // remove them. if (F) F->removeDeadConstantUsers(); bool HadDeadConstantUsers = !F->use_empty(); F->removeDeadConstantUsers(); if (F && (F->hasLinkOnceLinkage() || F->hasInternalLinkage()) && if ((F->hasLinkOnceLinkage() || F->hasInternalLinkage()) && F->use_empty()) { // Remove any call graph edges from the function to its callees. while (CGN->begin() != CGN->end()) CGN->removeCallEdgeTo(*(CGN->end()-1)); Loading @@ -183,13 +182,14 @@ bool Inliner::doFinalization(CallGraph &CG) { // If the function has external linkage (basically if it's a linkonce // function) remove the edge from the external node to the callee // node. if (!F->hasInternalLinkage()) if (!F->hasInternalLinkage() || HadDeadConstantUsers) CG.getExternalCallingNode()->removeCallEdgeTo(CGN); // Removing the node for callee from the call graph and delete it. FunctionsToRemove.insert(CGN); } } } // Now that we know which functions to delete, do so. We didn't want to do // this inline, because that would invalidate our CallGraph::iterator Loading
llvm/lib/Transforms/LevelRaise.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { // Make sure the source doesn't change type ConvertedTypes[Src] = Src->getType(); if (ValueConvertibleToType(CI, Src->getType(), ConvertedTypes, TD)) { PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI, *BB->getParent()); //PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI, // *BB->getParent()); DEBUG(std::cerr << "\nCONVERTING EXPR TYPE:\n"); { // ValueMap must be destroyed before function verified! Loading