[llvm-commits] SROA regression - alloca <3 x i8>

Tom Stellard tom at stellard.net
Tue Oct 2 07:13:53 PDT 2012


Hi Chandler,

I've spotted a regression in the new SROA pass.  The old scalarrepl pass
will optimize away the alloca in the attached test case, but the new
sroa pass will not.  Would you mind taking a look?

Thanks,
Tom Stellard
-------------- next part --------------
diff --git test/Transforms/SROA/3xi8-alloca.ll test/Transforms/SROA/3xi8-alloca.ll
new file mode 100644
index 0000000..636fe35
--- /dev/null
+++ test/Transforms/SROA/3xi8-alloca.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -sroa -S | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n8:16:32:64"
+target triple = "r600--"
+
+define void @test(<3 x i8> addrspace(1)* nocapture %in, float addrspace(1)* nocapture %out) nounwind {
+;CHECK-NOT: alloca
+entry:
+  %in_vc = alloca <3 x i8>, align 4
+  %0 = load <3 x i8> addrspace(1)* %in
+  store <3 x i8> %0, <3 x i8>* %in_vc, align 4
+  %castToVec4 = bitcast <3 x i8>* %in_vc to <4 x i8>*
+  %loadVec4 = load <4 x i8>* %castToVec4
+  %1 = extractelement <4 x i8> %loadVec4, i32 0
+  %conv.i = uitofp i8 %1 to float
+  store float %conv.i, float addrspace(1)* %out
+  ret void
+}
+
+!opencl.kernels = !{!0}
+
+!0 = metadata !{void (<3 x i8> addrspace(1)*, float addrspace(1)*)* @test}


More information about the llvm-commits mailing list