X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FScalar%2FSimplifyLibCalls.cpp;h=66c302844144334dd392e8d3301474648a97b24d;hb=f362affa3a695164a94d275fb44d18f44ebb855a;hp=54eaada3e4325a39517531375423a727a7dc96a6;hpb=ea2578c63ffe09d030ed5520b6b82f7cc0026340;p=oota-llvm.git diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 54eaada3e43..66c30284414 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -992,7 +992,7 @@ struct FFSOpt : public LibCallOptimization { } // ffs(x) -> x != 0 ? (i32)llvm.cttz(x)+1 : 0 - const Type *ArgType = Op->getType(); + Type *ArgType = Op->getType(); Value *F = Intrinsic::getDeclaration(Callee->getParent(), Intrinsic::cttz, &ArgType, 1); Value *V = B.CreateCall(F, Op, "cttz"); @@ -1616,6 +1616,9 @@ bool SimplifyLibCalls::runOnFunction(Function &F) { // Set the builder to the instruction after the call. Builder.SetInsertPoint(BB, I); + // Use debug location of CI for all new instructions. + Builder.SetCurrentDebugLocation(CI->getDebugLoc()); + // Try to optimize this call. Value *Result = LCO->OptimizeCall(CI, TD, TLI, Builder); if (Result == 0) continue;