forked from OSchip/llvm-project
[InlineFunction] use range-for loop; NFCI
llvm-svn: 295179
This commit is contained in:
parent
ead59eeade
commit
ada717e25b
|
@ -1108,11 +1108,9 @@ static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) {
|
|||
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(CallSite CS, InlineFunctionInfo &IFI) {
|
|||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue