[cfe-commits] r108884 - /cfe/trunk/lib/CodeGen/CGExprCXX.cpp
Chris Lattner
sabre at nondot.org
Tue Jul 20 11:49:34 PDT 2010
Author: lattner
Date: Tue Jul 20 13:49:33 2010
New Revision: 108884
URL: http://llvm.org/viewvc/llvm-project?rev=108884&view=rev
Log:
delete a loop that just generates dead code. In an example
like this:
void *test(long N) {
return new int[N][42][42];
}
the loop generates two dead mul instructions:
%tmp = load i64* %N.addr ; <i64> [#uses=2]
%0 = mul i64 %tmp, 7056 ; <i64> [#uses=1]
%1 = mul i64 %tmp, 42 ; <i64> [#uses=1]
%2 = mul i64 %1, 42 ; <i64> [#uses=0]
%call = call noalias i8* @_Znam(i64 %0) ; <i8*> [#uses=1]
The scale of these multiplies is already handled by the typesize stuff.
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=108884&r1=108883&r2=108884&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Jul 20 13:49:33 2010
@@ -440,16 +440,6 @@
CGF.Builder.CreateMul(NumElements,
llvm::ConstantInt::get(SizeTy,
TypeSize.getQuantity()));
-
- while (const ArrayType *AType = Context.getAsArrayType(Type)) {
- const llvm::ArrayType *llvmAType =
- cast<llvm::ArrayType>(CGF.ConvertType(Type));
- NumElements =
- CGF.Builder.CreateMul(NumElements,
- llvm::ConstantInt::get(
- SizeTy, llvmAType->getNumElements()));
- Type = AType->getElementType();
- }
// And add the cookie padding if necessary.
if (!CookiePadding.isZero())
More information about the cfe-commits
mailing list