[llvm-commits] [llvm] r156110 - in /llvm/trunk: lib/Analysis/MemoryBuiltins.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll
Nuno Lopes
nunoplopes at sapo.pt
Fri May 4 19:47:59 PDT 2012
Hi,
The testcase is already included the change to a previous test. The
CHECK-NEXT guarantees that all junk disappears (including the calloc calls).
Nuno
-----Original Message-----
Hi Nuno, testcase?
Ciao, Duncan.
On 04/05/12 00:08, Nuno Lopes wrote:
> Author: nlopes
> Date: Thu May 3 17:08:19 2012
> New Revision: 156110
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156110&view=rev
> Log:
> remove calls to calloc if the allocated memory is not used (it was already
> being done for malloc)
> fix a few typos found by Chad in my previous commit
>
> Modified:
> llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
> llvm/trunk/test/Transforms/InstCombine/objsize.ll
>
> Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=156110&r1=156109&r2=156110&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original)
> +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Thu May 3 17:08:19 2012
> @@ -182,7 +182,7 @@
>
>
>
> //===----------------------------------------------------------------------===//
> -// clloc Call Utility Functions.
> +// calloc Call Utility Functions.
> //
>
> static bool isCallocCall(const CallInst *CI) {
> @@ -197,7 +197,7 @@
>
> // Check malloc prototype.
> // FIXME: workaround for PR5130, this will be obsolete when a
> nobuiltin
> - // attribute will exist.
> + // attribute exists.
> FunctionType *FTy = Callee->getFunctionType();
> return FTy->getReturnType() == Type::getInt8PtrTy(FTy->getContext())&&
> FTy->getNumParams() == 2&&
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=156110&r1=156109&r2=156110&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu May 3
> 17:08:19 2012
> @@ -172,7 +172,7 @@
> Instruction *InstCombiner::visitCallInst(CallInst&CI) {
> if (isFreeCall(&CI))
> return visitFree(CI);
> - if (isMalloc(&CI))
> + if (extractMallocCall(&CI) || extractCallocCall(&CI))
> return visitMalloc(CI);
>
> // If the caller function is nounwind, mark the call as nounwind, even
> if the
>
> Modified: llvm/trunk/test/Transforms/InstCombine/objsize.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=156110&r1=156109&r2=156110&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll Thu May 3 17:08:19
> 2012
> @@ -165,7 +165,7 @@
> %alloc = call noalias i8* @calloc(i32 5, i32 7) nounwind
> %gep = getelementptr inbounds i8* %alloc, i32 5
> %objsize = call i32 @llvm.objectsize.i32(i8* %gep, i1 false) nounwind
> readonly
> -; CHECK: ret i32 30
> +; CHECK-NEXT: ret i32 30
> ret i32 %objsize
> }
>
> @@ -175,6 +175,6 @@
> %alloc = call noalias i8* @calloc(i32 100000000, i32 100000000)
> nounwind
> %gep = getelementptr inbounds i8* %alloc, i32 2
> %objsize = call i32 @llvm.objectsize.i32(i8* %gep, i1 true) nounwind
> readonly
> -; CHECK: ret i32 0
> +; CHECK-NEXT: ret i32 0
> ret i32 %objsize
> }
More information about the llvm-commits
mailing list