The bitcast case here is actually handled uniformly earlier in the function, so
authorCameron Zwarich <zwarich@apple.com>
Wed, 20 Apr 2011 21:48:34 +0000 (21:48 +0000)
committerCameron Zwarich <zwarich@apple.com>
Wed, 20 Apr 2011 21:48:34 +0000 (21:48 +0000)
delete it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129877 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ScalarReplAggregates.cpp

index 984f5c85d8be2b590a556bcc6adf32fea688a92a..82bb645567037b3757f17a1f3adf3c153496d231 100644 (file)
@@ -914,18 +914,13 @@ ConvertScalar_InsertValue(Value *SV, Value *Old,
       return Builder.CreateBitCast(Insert, AllocaType, "tmp");
     }
 
-    uint64_t EltSize = TD.getTypeAllocSizeInBits(VTy->getElementType());
-
     // Must be an element insertion.
+    assert(SV->getType() == VTy->getElementType());
+    uint64_t EltSize = TD.getTypeAllocSizeInBits(VTy->getElementType());
     unsigned Elt = Offset/EltSize;
-
-    if (SV->getType() != VTy->getElementType())
-      SV = Builder.CreateBitCast(SV, VTy->getElementType(), "tmp");
-
-    SV = Builder.CreateInsertElement(Old, SV,
+    return Builder.CreateInsertElement(Old, SV,
                      ConstantInt::get(Type::getInt32Ty(SV->getContext()), Elt),
                                      "tmp");
-    return SV;
   }
 
   // If SV is a first-class aggregate value, insert each value recursively.