[llvm-commits] [llvm] r122236 - in /llvm/trunk: lib/Transforms/Utils/InlineFunction.cpp test/Transforms/Inline/byval.ll

Chris Lattner sabre at nondot.org
Sat Dec 25 12:46:07 PST 2010


>> +      // If the alignment has an unspecified alignment, then we can only modify
>> +      // it if we have TD information.  Doing so without TD info could end up
>> +      // with us rounding the alignment *down* accidentally, which is badness.
>> +      if (IFI.TD) {
>> +        AIAlign = std::max(ByValAlignment, IFI.TD->getPrefTypeAlignment(AggTy));
>> +        AI->setAlignment(AIAlign);
>> +        return Arg;
>> +      }
>> +    }
> 
> -instcombine has a method that does much the same thing, except more
> aggressively, in InstCombineCalls.cpp
> (InstCombiner::GetOrEnforceKnownAlignment()).
> Maybe this should be factored out and placed somewhere in
> Transforms/Util/ so it can be used here too?
> 
> Then you could replace the quoted code with:
>  if (GetOrEnforceKnownAlignment(Arg, ByValAlignment) >= ByValAlignment)
>    return Arg;

Yep, it was on my todo list.  Done in r122555, thanks a lot for the great reviews.

-Chris



More information about the llvm-commits mailing list