Test Failure: Transforms/SROA/vector-promotion.ll

Test source: git

Comments: LLVM PR52971

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
ERROR: Unsupported instruction:   %val0 = load ptr addrspace(3), ptr %init, align 8
-- 1. PassManager<Function> : Skipping NOP
-- 2. SROAPass

----------------------------------------
define i32 @test1(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %tmp1 = load i32, ptr %a.tmp1, align 4
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 4
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct! (syntactically equal)

-- 3. SROAPass

----------------------------------------
define i32 @test1(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %tmp1 = load i32, ptr %a.tmp1, align 8
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 16
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
=>
define i32 @test1(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a.sroa.0.8.vec.extract = extractelement <4 x i32> %x, i32 2
  %a.sroa.2.28.vec.extract = extractelement <4 x i32> %y, i32 3
  %a.sroa.2.16.vec.extract = extractelement <4 x i32> %y, i32 0
  %tmp4 = add i32 %a.sroa.0.8.vec.extract, %a.sroa.2.28.vec.extract
  %tmp5 = add i32 %a.sroa.2.16.vec.extract, %tmp4
  ret i32 %tmp5
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. SROAPass

----------------------------------------
define i32 @test2(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %tmp1 = load i32, ptr %a.tmp1, align 4
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3.vec = load <2 x i32>, ptr %a.tmp3, align 8
  %tmp3 = extractelement <2 x i32> %tmp3.vec, i32 0
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct! (syntactically equal)

-- 7. SROAPass

----------------------------------------
define i32 @test2(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %tmp1 = load i32, ptr %a.tmp1, align 8
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3.vec = load <2 x i32>, ptr %a.tmp3, align 16
  %tmp3 = extractelement <2 x i32> %tmp3.vec, i32 0
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
=>
define i32 @test2(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a.sroa.0.8.vec.extract = extractelement <4 x i32> %x, i32 2
  %a.sroa.2.28.vec.extract = extractelement <4 x i32> %y, i32 3
  %a.sroa.2.16.vec.extract = shufflevector <4 x i32> %y, <4 x i32> poison, 0, 1
  %tmp3 = extractelement <2 x i32> %a.sroa.2.16.vec.extract, i32 0
  %tmp4 = add i32 %a.sroa.0.8.vec.extract, %a.sroa.2.28.vec.extract
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Function> : Skipping NOP
-- 10. SROAPass

----------------------------------------
define i32 @test3(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memset ptr %a.y align 1, i8 0, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  memset ptr %a.tmp1 align 1, i8 255, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 4
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 4
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct! (syntactically equal)

-- 11. SROAPass

----------------------------------------
define i32 @test3(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memset ptr %a.y align 16, i8 0, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  memset ptr %a.tmp1 align 8, i8 255, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 8
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 16
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
=>
define i32 @test3(<4 x i32> %x, <4 x i32> %y) {
entry:
  %a.sroa.0.8.vec.insert = insertelement <4 x i32> %x, i32 4294967295, i32 2
  %a.sroa.0.8.vec.extract = extractelement <4 x i32> %a.sroa.0.8.vec.insert, i32 2
  %a.sroa.3.28.vec.extract = extractelement <4 x i32> { 0, 0, 0, 0 }, i32 3
  %a.sroa.3.16.vec.extract = extractelement <4 x i32> { 0, 0, 0, 0 }, i32 0
  %tmp4 = add i32 %a.sroa.0.8.vec.extract, %a.sroa.3.28.vec.extract
  %tmp5 = add i32 %a.sroa.3.16.vec.extract, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct!

-- 12. PassManager<Function> : Skipping NOP
-- 13. PassManager<Function> : Skipping NOP
-- 14. SROAPass

----------------------------------------
define i32 @test4(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memcpy ptr %a.y align 1, ptr %z align 1, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  memcpy ptr %a.tmp1 align 1, ptr %z.tmp1 align 1, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 4
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 4
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct! (syntactically equal)

-- 15. SROAPass

----------------------------------------
define i32 @test4(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memcpy ptr %a.y align 16, ptr %z align 1, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  memcpy ptr %a.tmp1 align 8, ptr %z.tmp1 align 1, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 8
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 16
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
=>
define i32 @test4(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %a.sroa.3.16.copyload = load <4 x i32>, ptr %z, align 1
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  %a.sroa.0.8.copyload = load i32, ptr %z.tmp1, align 1
  %a.sroa.0.8.vec.insert = insertelement <4 x i32> %x, i32 %a.sroa.0.8.copyload, i32 2
  %a.sroa.0.8.vec.extract = extractelement <4 x i32> %a.sroa.0.8.vec.insert, i32 2
  %a.sroa.3.28.vec.extract = extractelement <4 x i32> %a.sroa.3.16.copyload, i32 3
  %a.sroa.3.16.vec.extract = extractelement <4 x i32> %a.sroa.3.16.copyload, i32 0
  %tmp4 = add i32 %a.sroa.0.8.vec.extract, %a.sroa.3.28.vec.extract
  %tmp5 = add i32 %a.sroa.3.16.vec.extract, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct!

-- 16. PassManager<Function> : Skipping NOP
-- 17. PassManager<Function> : Skipping NOP
-- 18. SROAPass
-- 19. SROAPass
-- 20. PassManager<Function> : Skipping NOP
-- 21. PassManager<Function> : Skipping NOP
-- 22. SROAPass

----------------------------------------
define i32 @test5(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memcpy ptr %a align 1, ptr %a.y align 1, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  memcpy ptr %z.tmp1 align 1, ptr %a.tmp1 align 1, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 4
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 4
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
Transformation seems to be correct! (syntactically equal)

-- 23. SROAPass

----------------------------------------
define i32 @test5(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %a = alloca i64 32, align 16
  store <4 x i32> %x, ptr %a, align 16
  %a.y = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1
  store <4 x i32> %y, ptr %a.y, align 16
  memcpy ptr %a align 16, ptr %a.y align 16, i32 16
  %a.tmp1 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 0, 4 x i64 2
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  memcpy ptr %z.tmp1 align 1, ptr %a.tmp1 align 8, i32 4
  %tmp1 = load i32, ptr %a.tmp1, align 8
  %a.tmp2 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 3
  %tmp2 = load i32, ptr %a.tmp2, align 4
  %a.tmp3 = gep inbounds ptr %a, 32 x i64 0, 16 x i64 1, 4 x i64 0
  %tmp3 = load i32, ptr %a.tmp3, align 16
  %tmp4 = add i32 %tmp1, %tmp2
  %tmp5 = add i32 %tmp3, %tmp4
  ret i32 %tmp5
}
=>
define i32 @test5(<4 x i32> %x, <4 x i32> %y, ptr %z) {
entry:
  %z.tmp1 = gep inbounds ptr %z, 16 x i64 0, 4 x i64 2
  %a.sroa.0.8.vec.extract3 = extractelement <4 x i32> %y, i32 2
  store i32 %a.sroa.0.8.vec.extract3, ptr %z.tmp1, align 1
  %a.sroa.0.8.vec.extract = extractelement <4 x i32> %y, i32 2
  %a.sroa.4.12.vec.extract = extractelement <4 x i32> %y, i32 3
  %a.sroa.4.0.vec.extract = extractelement <4 x i32> %y, i32 0
  %tmp4 = add i32 %a.sroa.0.8.vec.extract, %a.sroa.4.12.vec.extract
  %tmp5 = add i32 %a.sroa.4.0.vec.extract, %tmp4
  ret i32 %tmp5
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 24. PassManager<Function> : Skipping NOP
-- 25. PassManager<Function> : Skipping NOP
-- 26. SROAPass

----------------------------------------
define i64 @test6(<4 x i64> %x, <4 x i64> %y, i64 %n) {
#0:
  %tmp = alloca i64 64, align 32
  %p0 = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 0
  store <4 x i64> %x, ptr %p0, align 32
  %p1 = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 32
  store <4 x i64> %y, ptr %p1, align 32
  %addr = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 0, 8 x i64 %n
  %res = load i64, ptr %addr, align 4
  ret i64 %res
}
Transformation seems to be correct! (syntactically equal)

-- 27. SROAPass

----------------------------------------
define i64 @test6(<4 x i64> %x, <4 x i64> %y, i64 %n) {
#0:
  %tmp = alloca i64 64, align 32
  %p0 = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 0
  store <4 x i64> %x, ptr %p0, align 32
  %p1 = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 32
  store <4 x i64> %y, ptr %p1, align 32
  %addr = gep inbounds ptr %tmp, 64 x i32 0, 1 x i64 0, 8 x i64 %n
  %res = load i64, ptr %addr, align 4
  ret i64 %res
}
Transformation seems to be correct! (syntactically equal)

-- 28. PassManager<Function> : Skipping NOP
-- 29. PassManager<Function> : Skipping NOP
-- 30. SROAPass

----------------------------------------
define <4 x i32> @test_subvec_store() {
entry:
  %a = alloca i64 16, align 16
  store <2 x i32> { 0, 0 }, ptr %a, align 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  store <2 x i32> { 1, 1 }, ptr %a.gep1, align 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  store <2 x i32> { 2, 2 }, ptr %a.gep2, align 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  store i32 3, ptr %a.gep3, align 4
  %ret = load <4 x i32>, ptr %a, align 16
  ret <4 x i32> %ret
}
Transformation seems to be correct! (syntactically equal)

-- 31. SROAPass

----------------------------------------
define <4 x i32> @test_subvec_store() {
entry:
  %a = alloca i64 16, align 16
  store <2 x i32> { 0, 0 }, ptr %a, align 16
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  store <2 x i32> { 1, 1 }, ptr %a.gep1, align 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  store <2 x i32> { 2, 2 }, ptr %a.gep2, align 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  store i32 3, ptr %a.gep3, align 4
  %ret = load <4 x i32>, ptr %a, align 16
  ret <4 x i32> %ret
}
=>
define <4 x i32> @test_subvec_store() {
entry:
  %a.0.vecblend = select <4 x i1> { 1, 1, 0, 0 }, <4 x i32> { 0, 0, undef, undef }, <4 x i32> undef
  %a.4.vecblend = select <4 x i1> { 0, 1, 1, 0 }, <4 x i32> { undef, 1, 1, undef }, <4 x i32> %a.0.vecblend
  %a.8.vecblend = select <4 x i1> { 0, 0, 1, 1 }, <4 x i32> { undef, undef, 2, 2 }, <4 x i32> %a.4.vecblend
  %a.12.vec.insert = insertelement <4 x i32> %a.8.vecblend, i32 3, i32 3
  ret <4 x i32> %a.12.vec.insert
}

****************************************
WARNING: Source function is always UB.
It can be refined by any target function.
Please make sure this is what you wanted.
****************************************

Transformation seems to be correct!

-- 32. PassManager<Function> : Skipping NOP
-- 33. PassManager<Function> : Skipping NOP
-- 34. SROAPass

----------------------------------------
define <4 x i32> @test_subvec_load() {
entry:
  %a = alloca i64 16, align 16
  store <4 x i32> { 0, 1, 2, 3 }, ptr %a, align 16
  %first = load <2 x i32>, ptr %a, align 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  %second = load <2 x i32>, ptr %a.gep1, align 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  %third = load <2 x i32>, ptr %a.gep2, align 8
  %tmp = shufflevector <2 x i32> %first, <2 x i32> %second, 0, 2
  %ret = shufflevector <2 x i32> %tmp, <2 x i32> %third, 0, 1, 2, 3
  ret <4 x i32> %ret
}
Transformation seems to be correct! (syntactically equal)

-- 35. SROAPass

----------------------------------------
define <4 x i32> @test_subvec_load() {
entry:
  %a = alloca i64 16, align 16
  store <4 x i32> { 0, 1, 2, 3 }, ptr %a, align 16
  %first = load <2 x i32>, ptr %a, align 16
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  %second = load <2 x i32>, ptr %a.gep1, align 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  %third = load <2 x i32>, ptr %a.gep2, align 8
  %tmp = shufflevector <2 x i32> %first, <2 x i32> %second, 0, 2
  %ret = shufflevector <2 x i32> %tmp, <2 x i32> %third, 0, 1, 2, 3
  ret <4 x i32> %ret
}
=>
define <4 x i32> @test_subvec_load() {
entry:
  %a.0.vec.extract = shufflevector <4 x i32> { 0, 1, 2, 3 }, <4 x i32> poison, 0, 1
  %a.4.vec.extract = shufflevector <4 x i32> { 0, 1, 2, 3 }, <4 x i32> poison, 1, 2
  %a.8.vec.extract = shufflevector <4 x i32> { 0, 1, 2, 3 }, <4 x i32> poison, 2, 3
  %tmp = shufflevector <2 x i32> %a.0.vec.extract, <2 x i32> %a.4.vec.extract, 0, 2
  %ret = shufflevector <2 x i32> %tmp, <2 x i32> %a.8.vec.extract, 0, 1, 2, 3
  ret <4 x i32> %ret
}

****************************************
WARNING: Source function is always UB.
It can be refined by any target function.
Please make sure this is what you wanted.
****************************************

Transformation seems to be correct!

-- 36. PassManager<Function> : Skipping NOP
-- 37. PassManager<Function> : Skipping NOP
-- 38. SROAPass

----------------------------------------
define <4 x float> @test_subvec_memset() {
entry:
  %a = alloca i64 16, align 16
  memset ptr %a align 1, i8 0, i32 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  memset ptr %a.gep1 align 1, i8 1, i32 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  memset ptr %a.gep2 align 1, i8 3, i32 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  memset ptr %a.gep3 align 1, i8 7, i32 4
  %ret = load <4 x float>, ptr %a, align 16
  ret <4 x float> %ret
}
Transformation seems to be correct! (syntactically equal)

-- 39. SROAPass

----------------------------------------
define <4 x float> @test_subvec_memset() {
entry:
  %a = alloca i64 16, align 16
  memset ptr %a align 16, i8 0, i32 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  memset ptr %a.gep1 align 4, i8 1, i32 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  memset ptr %a.gep2 align 8, i8 3, i32 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  memset ptr %a.gep3 align 4, i8 7, i32 4
  %ret = load <4 x float>, ptr %a, align 16
  ret <4 x float> %ret
}
=>
define <4 x float> @test_subvec_memset() {
entry:
  %a.0.vecblend = select <4 x i1> { 1, 1, 0, 0 }, <4 x float> { 0.000000, 0.000000, undef, undef }, <4 x float> undef
  %a.4.vecblend = select <4 x i1> { 0, 1, 1, 0 }, <4 x float> { undef, 0.000000, 0.000000, undef }, <4 x float> %a.0.vecblend
  %a.8.vecblend = select <4 x i1> { 0, 0, 1, 1 }, <4 x float> { undef, undef, 0.000000, 0.000000 }, <4 x float> %a.4.vecblend
  %a.12.vec.insert = insertelement <4 x float> %a.8.vecblend, float 0.000000, i32 3
  ret <4 x float> %a.12.vec.insert
}
Transformation seems to be correct!

-- 40. PassManager<Function> : Skipping NOP
-- 41. PassManager<Function> : Skipping NOP
-- 42. SROAPass

----------------------------------------
define <4 x float> @test_subvec_memcpy(ptr %x, ptr %y, ptr %z, ptr %f, ptr %out) {
entry:
  %a = alloca i64 16, align 16
  memcpy ptr %a align 1, ptr %x align 1, i32 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  memcpy ptr %a.gep1 align 1, ptr %y align 1, i32 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  memcpy ptr %a.gep2 align 1, ptr %z align 1, i32 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  memcpy ptr %a.gep3 align 1, ptr %f align 1, i32 4
  memcpy ptr %out align 1, ptr %a.gep2 align 1, i32 8
  %ret = load <4 x float>, ptr %a, align 16
  ret <4 x float> %ret
}
Transformation seems to be correct! (syntactically equal)

-- 43. SROAPass

----------------------------------------
define <4 x float> @test_subvec_memcpy(ptr %x, ptr %y, ptr %z, ptr %f, ptr %out) {
entry:
  %a = alloca i64 16, align 16
  memcpy ptr %a align 16, ptr %x align 1, i32 8
  %a.gep1 = gep ptr %a, 16 x i32 0, 4 x i32 1
  memcpy ptr %a.gep1 align 4, ptr %y align 1, i32 8
  %a.gep2 = gep ptr %a, 16 x i32 0, 4 x i32 2
  memcpy ptr %a.gep2 align 8, ptr %z align 1, i32 8
  %a.gep3 = gep ptr %a, 16 x i32 0, 4 x i32 3
  memcpy ptr %a.gep3 align 4, ptr %f align 1, i32 4
  memcpy ptr %out align 1, ptr %a.gep2 align 8, i32 8
  %ret = load <4 x float>, ptr %a, align 16
  ret <4 x float> %ret
}
=>
define <4 x float> @test_subvec_memcpy(ptr %x, ptr %y, ptr %z, ptr %f, ptr %out) {
entry:
  %a.0.copyload = load <2 x float>, ptr %x, align 1
  %a.0.vec.expand = shufflevector <2 x float> %a.0.copyload, <2 x float> poison, 0, 1, 4294967295, 4294967295
  %a.0.vecblend = select <4 x i1> { 1, 1, 0, 0 }, <4 x float> %a.0.vec.expand, <4 x float> undef
  %a.4.copyload = load <2 x float>, ptr %y, align 1
  %a.4.vec.expand = shufflevector <2 x float> %a.4.copyload, <2 x float> poison, 4294967295, 0, 1, 4294967295
  %a.4.vecblend = select <4 x i1> { 0, 1, 1, 0 }, <4 x float> %a.4.vec.expand, <4 x float> %a.0.vecblend
  %a.8.copyload = load <2 x float>, ptr %z, align 1
  %a.8.vec.expand = shufflevector <2 x float> %a.8.copyload, <2 x float> poison, 4294967295, 4294967295, 0, 1
  %a.8.vecblend = select <4 x i1> { 0, 0, 1, 1 }, <4 x float> %a.8.vec.expand, <4 x float> %a.4.vecblend
  %a.12.copyload = load float, ptr %f, align 1
  %a.12.vec.insert = insertelement <4 x float> %a.8.vecblend, float %a.12.copyload, i32 3
  %a.8.vec.extract = shufflevector <4 x float> %a.12.vec.insert, <4 x float> poison, 2, 3
  store <2 x float> %a.8.vec.extract, ptr %out, align 1
  ret <4 x float> %a.12.vec.insert
}
Transformation doesn't verify! (unsound)
ERROR: Mismatch in memory

Example:
ptr %x = pointer(non-local, block_id=1, offset=0) / Address=#x003
ptr %y = pointer(non-local, block_id=1, offset=0) / Address=#x003
ptr %z = pointer(non-local, block_id=1, offset=0) / Address=#x003
ptr %f = pointer(non-local, block_id=1, offset=4) / Address=#x007
ptr %out = pointer(non-local, block_id=4, offset=0) / Address=#x00e

Source:
ptr %a = pointer(local, block_id=0, offset=0) / Address=#x100
ptr %a.gep1 = pointer(local, block_id=0, offset=4) / Address=#x104
ptr %a.gep2 = pointer(local, block_id=0, offset=8) / Address=#x108
ptr %a.gep3 = pointer(local, block_id=0, offset=12) / Address=#x10c
<4 x float> %ret = < poison, poison, poison, poison >

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0
Block 1 >	size: 8	align: 1	alloc type: 0	alive: true	address: 3
Contents:
7: #bppppp00p
4: #b00pppppp
1: #bpp0ppppp
6: #bp1pppppp
2: #bp0pppppp
3: #bp000p0pp
*: poison

Block 2 >	size: 1	align: 1	alloc type: 0	alive: true	address: 1
Contents:
6: #bpp1pppp0
*: poison

Block 3 >	size: 2	align: 1	alloc type: 0	alive: true	address: 11
Contents:
6: #xff
*: poison

Block 4 >	size: 9	align: 1	alloc type: 0	alive: true	address: 14
Contents:
6: #bppppp0pp
*: #bpp0ppppp

Block 5 >	size: 1	align: 1	alloc type: 0	alive: true	address: 2
Contents:
6: pointer(non-local, block_id=1, offset=-157), byte offset=0
*: #bp0pppppp


LOCAL BLOCKS:
Block 8 >	size: 16	align: 16	alloc type: 1	alive: true	address: 256

Target:
<2 x float> %a.0.copyload = < poison, poison >
<4 x float> %a.0.vec.expand = < poison, poison, poison, poison >
<4 x float> %a.0.vecblend = < poison, poison, #x00000000 (+0.0)	[based on undef value], #x00000000 (+0.0)	[based on undef value] >
<2 x float> %a.4.copyload = < poison, poison >
<4 x float> %a.4.vec.expand = < poison, poison, poison, poison >
<4 x float> %a.4.vecblend = < poison, poison, poison, #x00000000 (+0.0) >
<2 x float> %a.8.copyload = < poison, poison >
<4 x float> %a.8.vec.expand = < poison, poison, poison, poison >
<4 x float> %a.8.vecblend = < poison, poison, poison, poison >
float %a.12.copyload = poison
<4 x float> %a.12.vec.insert = < poison, poison, poison, poison >
<2 x float> %a.8.vec.extract = < poison, poison >

Mismatch in pointer(non-local, block_id=4, offset=6)
Source value: #bp1pppppp
Target value: poison

Pass: SROAPass
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-load-pass-plugin=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-passes=sroa<preserve-cfg>' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_1KnFHNOH_xyCe.bc"


------------------- SMT STATS -------------------
Num queries: 90
Num invalid: 0
Num skips:   0
Num trivial: 49 (35.3%)
Num timeout: 3 (3.3%)
Num errors:  0 (0.0%)
Num SAT:     47 (52.2%)
Num UNSAT:   40 (44.4%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/SROA/vector-promotion.ll -passes='sroa<preserve-cfg>' -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SROA/vector-promotion.ll --check-prefixes=CHECK,CHECK-PRESERVE-CFG
+ /home/nlopes/alive2/build/opt-alive.sh '-passes=sroa<preserve-cfg>' -S
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SROA/vector-promotion.ll --check-prefixes=CHECK,CHECK-PRESERVE-CFG

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SROA/vector-promotion.ll --check-prefixes=CHECK,CHECK-PRESERVE-CFG

 

<-- Back