[llvm-commits] [llvm] r97866 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll

Eric Christopher echristo at apple.com
Fri Mar 5 19:11:35 PST 2010


Author: echristo
Date: Fri Mar  5 21:11:35 2010
New Revision: 97866

URL: http://llvm.org/viewvc/llvm-project?rev=97866&view=rev
Log:
Temporarily revert:

Log:
Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.

Modified:
   llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
   llvm/trunk/test/Transforms/InstCombine/objsize.ll

It appears to be causing swb and nightly test failures.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
    llvm/trunk/test/Transforms/InstCombine/objsize.ll

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=97866&r1=97865&r2=97866&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Mar  5 21:11:35 2010
@@ -336,16 +336,6 @@
         }
         return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy, AllocaSize));
       }
-    } else if (CallInst *MI = extractMallocCall(Op1)) {
-      const Type* MallocType = getMallocAllocatedType(MI);
-      // Get alloca size.
-      if (MallocType->isSized()) {
-        if (Value *NElems = getMallocArraySize(MI, TD, true)) {
-          if (ConstantInt *NElements = dyn_cast<ConstantInt>(NElems))
-        return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy,
-               (NElements->getZExtValue() * TD->getTypeAllocSize(MallocType))));
-        }
-      }
     } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op1)) {      
       // Only handle constant GEPs here.
       if (CE->getOpcode() != Instruction::GetElementPtr) break;

Modified: llvm/trunk/test/Transforms/InstCombine/objsize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=97866&r1=97865&r2=97866&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/objsize.ll Fri Mar  5 21:11:35 2010
@@ -118,24 +118,8 @@
   ret i32 0
 }
 
- at s = external global i8*
-
-define void @test5(i32 %n) nounwind ssp {
-; CHECK: @test5
-entry:
-  %0 = tail call noalias i8* @malloc(i32 20) nounwind
-  %1 = tail call i32 @llvm.objectsize.i32(i8* %0, i1 false)
-  %2 = load i8** @s, align 8
-; CHECK-NOT: @llvm.objectsize
-; CHECK: @__memcpy_chk(i8* %0, i8* %1, i32 10, i32 20)
-  %3 = tail call i8* @__memcpy_chk(i8* %0, i8* %2, i32 10, i32 %1) nounwind
-  ret void
-}
-
 declare i8* @__memset_chk(i8*, i32, i64, i64) nounwind
 
-declare noalias i8* @malloc(i32) nounwind
-
 declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
 
 declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly





More information about the llvm-commits mailing list