[llvm] r295179 - [InlineFunction] use range-for loop; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 06:56:12 PST 2017
Author: spatel
Date: Wed Feb 15 08:56:11 2017
New Revision: 295179
URL: http://llvm.org/viewvc/llvm-project?rev=295179&view=rev
Log:
[InlineFunction] use range-for loop; NFCI
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=295179&r1=295178&r2=295179&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Feb 15 08:56:11 2017
@@ -1108,11 +1108,9 @@ static void AddAlignmentAssumptions(Call
bool DTCalculated = false;
Function *CalledFunc = CS.getCalledFunction();
- for (Function::arg_iterator I = CalledFunc->arg_begin(),
- E = CalledFunc->arg_end();
- I != E; ++I) {
- unsigned Align = I->getType()->isPointerTy() ? I->getParamAlignment() : 0;
- if (Align && !I->hasByValOrInAllocaAttr() && !I->hasNUses(0)) {
+ for (Argument &Arg : CalledFunc->args()) {
+ unsigned Align = Arg.getType()->isPointerTy() ? Arg.getParamAlignment() : 0;
+ if (Align && !Arg.hasByValOrInAllocaAttr() && !Arg.hasNUses(0)) {
if (!DTCalculated) {
DT.recalculate(const_cast<Function&>(*CS.getInstruction()->getParent()
->getParent()));
@@ -1121,13 +1119,13 @@ static void AddAlignmentAssumptions(Call
// If we can already prove the asserted alignment in the context of the
// caller, then don't bother inserting the assumption.
- Value *Arg = CS.getArgument(I->getArgNo());
- if (getKnownAlignment(Arg, DL, CS.getInstruction(), AC, &DT) >= Align)
+ Value *ArgVal = CS.getArgument(Arg.getArgNo());
+ if (getKnownAlignment(ArgVal, DL, CS.getInstruction(), AC, &DT) >= Align)
continue;
- CallInst *NewAssumption = IRBuilder<>(CS.getInstruction())
- .CreateAlignmentAssumption(DL, Arg, Align);
- AC->registerAssumption(NewAssumption);
+ CallInst *NewAsmp = IRBuilder<>(CS.getInstruction())
+ .CreateAlignmentAssumption(DL, ArgVal, Align);
+ AC->registerAssumption(NewAsmp);
}
}
}
More information about the llvm-commits
mailing list