[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

Reid Spencer reid at x10sys.com
Mon Aug 1 19:31:32 PDT 2005


I audited the remaining 3 ConstantInt::get calls in SimplifyLibCalls
pass. The only remaining calls all pass 0 as the second argument so they
are within range of the restrictions of that call.

Reid.

On Mon, 2005-08-01 at 11:53 -0500, Chris Lattner wrote:
> 
> Changes in directory llvm/lib/Transforms/IPO:
> 
> SimplifyLibCalls.cpp updated: 1.46 -> 1.47
> ---
> Log message:
> 
> ConstantInt::get only works for arguments < 128.
> 
> SimplifyLibCalls probably has to be audited to make sure it does not make
> this mistake elsewhere.  Also, if this code knows that the type will be
> unsigned, obviously one arm of this is dead.
> 
> Reid, can you take a look into this further?
> 
> 
> 
> ---
> Diffs of the changes:  (+6 -2)
> 
>  SimplifyLibCalls.cpp |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> 
> Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
> diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.46 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.47
> --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.46	Wed Jul 27 01:12:34 2005
> +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Mon Aug  1 11:52:50 2005
> @@ -962,8 +962,12 @@
>        return false;
>  
>      // strlen("xyz") -> 3 (for example)
> -    ci->replaceAllUsesWith(
> -        ConstantInt::get(SLC.getTargetData()->getIntPtrType(),len));
> +    const Type *Ty = SLC.getTargetData()->getIntPtrType();
> +    if (Ty->isSigned())
> +      ci->replaceAllUsesWith(ConstantSInt::get(Ty, len));
> +    else
> +      ci->replaceAllUsesWith(ConstantUInt::get(Ty, len));
> +     
>      ci->eraseFromParent();
>      return true;
>    }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20050801/2f38bf53/attachment.sig>


More information about the llvm-commits mailing list