[llvm-commits] [llvm] r160733 - in /llvm/trunk: include/llvm/Target/TargetLibraryInfo.h include/llvm/Transforms/Utils/BuildLibCalls.h lib/Target/TargetLibraryInfo.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp lib/Transforms/Scalar/CodeGenPr

Nuno Lopes nunoplopes at sapo.pt
Wed Jul 25 10:31:49 PDT 2012


Quoting Eli Friedman <eli.friedman at gmail.com>:

> On Wed, Jul 25, 2012 at 9:46 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>> Author: nlopes
>> Date: Wed Jul 25 11:46:31 2012
>> New Revision: 160733
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=160733&view=rev
>> Log:
>> make all Emit*() functions consult the TargetLibraryInfo  
>> information before creating a call to a library function.
>> Update all clients to pass the TLI information around.
>> Previous draft reviewed by Eli.
>
> @@ -1179,7 +1186,7 @@
>
>      // printf("x") -> putchar('x'), even for '%'.
>      if (FormatStr.size() == 1) {
> -      Value *Res = EmitPutChar(B.getInt32(FormatStr[0]), B, TD);
> +      Value *Res = EmitPutChar(B.getInt32(FormatStr[0]), B, TD, TLI);
>        if (CI->use_empty()) return CI;
>        return B.CreateIntCast(Res, CI->getType(), true);
>      }
>
> Missing null check?
>
>      // Optimize specific format strings.
>      // printf("%c", chr) --> putchar(chr)
>      if (FormatStr == "%c" && CI->getNumArgOperands() > 1 &&
>          CI->getArgOperand(1)->getType()->isIntegerTy()) {
> -      Value *Res = EmitPutChar(CI->getArgOperand(1), B, TD);
> +      Value *Res = EmitPutChar(CI->getArgOperand(1), B, TD, TLI);
>
>        if (CI->use_empty()) return CI;
>        return B.CreateIntCast(Res, CI->getType(), true);
>
> Missing null check?
>
> @@ -495,7 +497,7 @@
>      // We have enough information to now generate the memcpy call to do the
>      // copy for us.  Make a memcpy to copy the nul byte with align = 1.
>      if (OptChkCall)
> -      EmitMemCpyChk(Dst, Src, LenV, CI->getArgOperand(2), B, TD);
> +      EmitMemCpyChk(Dst, Src, LenV, CI->getArgOperand(2), B, TD, TLI);
>      else
>        B.CreateMemCpy(Dst, Src, LenV, 1);
>      return DstEnd;
>
> Missing null check?
>
> @@ -164,7 +164,7 @@
>    void EmitStrLenMemCpy(Value *Src, Value *Dst, uint64_t Len,  
> IRBuilder<> &B) {
>      // We need to find the end of the destination string.  That's where the
>      // memory is to be moved to. We just generate a call to strlen.
> -    Value *DstLen = EmitStrLen(Dst, B, TD);
> +    Value *DstLen = EmitStrLen(Dst, B, TD, TLI);
>
>      // Now that we have the destination's length, we must index into the
>      // destination's pointer to get the actual memcpy destination (end of
>
> Missing null check?
>
> Not sure if that's a complete list.
>
> -Eli

Wow, your eyes are way better than mine.  Will fix those and review  
the whole patch again.

Thanks,
Nuno



More information about the llvm-commits mailing list