Probably not a good idea to convert a single vector load into a memcpy. We
authorChad Rosier <mcrosier@apple.com>
Tue, 6 Dec 2011 00:19:08 +0000 (00:19 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 6 Dec 2011 00:19:08 +0000 (00:19 +0000)
don't do this now, but add a test case to prevent this from happening in the
future.
Additional test for rdar://9892684

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

lib/Analysis/ValueTracking.cpp
test/Transforms/MemCpyOpt/form-memset.ll

index 0d016e21f2680e24a17c8d7a0b72a6222311c17e..ecc83dfceb65a6b682bf97030587056e3b1782cd 100644 (file)
@@ -1370,6 +1370,8 @@ Value *llvm::isBytewiseValue(Value *V) {
     
     return Val;
   }
+
+  // FIXME: Vector types (e.g., <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>).
   
   // Conceptually, we could handle things like:
   //   %a = zext i8 %X to i16
index e5ace33270296cc133388b5cbbcf247a6b31c45a..8832f897b089f1e9420ad49e4a55508974ea22f0 100644 (file)
@@ -236,3 +236,15 @@ define void @test7(i32* nocapture %c) nounwind optsize {
 ; CHECK: call void @llvm.memset.p0i8.i64(i8* %5, i8 -1, i64 20, i32 4, i1 false)
   ret void
 }
+
+%struct.test8 = type { [4 x i32] }
+
+define void @test8() {
+entry:
+  %memtmp = alloca %struct.test8, align 16
+  %0 = bitcast %struct.test8* %memtmp to <4 x i32>*
+  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* %0, align 16
+  ret void
+; CHECK: @test8
+; CHECK: store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, <4 x i32>* %0, align 16
+}