Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. InstCombinePass
----------------------------------------
define float @extract_one_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
ret float %extract
}
Transformation seems to be correct! (syntactically equal)
-- 3. InstCombinePass
----------------------------------------
define float @extract_one_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
ret float %extract
}
=>
define float @extract_one_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp.not = icmp eq i32 %c, 0
%sel = select i1 %cmp.not, <4 x float> %b, <4 x float> %a
%extract = extractelement <4 x float> %sel, i64 2
ret float %extract
}
Transformation seems to be correct!
-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. InstCombinePass
----------------------------------------
define <2 x float> @extract_two_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract1 = extractelement <4 x float> %sel, i32 1
%extract2 = extractelement <4 x float> %sel, i32 2
%build1 = insertelement <2 x float> undef, float %extract1, i32 0
%build2 = insertelement <2 x float> %build1, float %extract2, i32 1
ret <2 x float> %build2
}
Transformation seems to be correct! (syntactically equal)
-- 7. InstCombinePass
----------------------------------------
define <2 x float> @extract_two_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract1 = extractelement <4 x float> %sel, i32 1
%extract2 = extractelement <4 x float> %sel, i32 2
%build1 = insertelement <2 x float> undef, float %extract1, i32 0
%build2 = insertelement <2 x float> %build1, float %extract2, i32 1
ret <2 x float> %build2
}
=>
define <2 x float> @extract_two_select(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp.not = icmp eq i32 %c, 0
%sel = select i1 %cmp.not, <4 x float> %b, <4 x float> %a
%build2 = shufflevector <4 x float> %sel, <4 x float> poison, 1, 2
ret <2 x float> %build2
}
Transformation seems to be correct!
-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Function> : Skipping NOP
-- 10. InstCombinePass
----------------------------------------
declare void @v4float_user(<4 x float>)
define float @extract_one_select_user(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
Transformation seems to be correct! (syntactically equal)
-- 11. InstCombinePass
----------------------------------------
declare void @v4float_user(<4 x float>)
define float @extract_one_select_user(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp = icmp ne i32 %c, 0
%sel = select i1 %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
=>
declare void @v4float_user(<4 x float>)
define float @extract_one_select_user(<4 x float> %a, <4 x float> %b, i32 %c) {
#0:
%cmp.not = icmp eq i32 %c, 0
%sel = select i1 %cmp.not, <4 x float> %b, <4 x float> %a
%extract = extractelement <4 x float> %sel, i64 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 12. PassManager<Function> : Skipping NOP
-- 13. PassManager<Function> : Skipping NOP
-- 14. InstCombinePass
----------------------------------------
declare void @v4float_user(<4 x float>)
define float @extract_one_vselect_user(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
Transformation seems to be correct! (syntactically equal)
-- 15. InstCombinePass
----------------------------------------
declare void @v4float_user(<4 x float>)
define float @extract_one_vselect_user(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %sel, i32 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
=>
declare void @v4float_user(<4 x float>)
define float @extract_one_vselect_user(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp.not = icmp eq <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp.not, <4 x float> %b, <4 x float> %a
%extract = extractelement <4 x float> %sel, i64 2
call void @v4float_user(<4 x float> %sel)
ret float %extract
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 16. PassManager<Function> : Skipping NOP
-- 17. PassManager<Function> : Skipping NOP
-- 18. InstCombinePass
----------------------------------------
define float @extract_one_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%select = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %select, i32 0
ret float %extract
}
Transformation seems to be correct! (syntactically equal)
-- 19. InstCombinePass
----------------------------------------
define float @extract_one_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%select = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract = extractelement <4 x float> %select, i32 0
ret float %extract
}
=>
define float @extract_one_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp.not = icmp eq <4 x i32> %c, { 0, 0, 0, 0 }
%select = select <4 x i1> %cmp.not, <4 x float> %b, <4 x float> %a
%extract = extractelement <4 x float> %select, i64 0
ret float %extract
}
Transformation seems to be correct!
-- 20. PassManager<Function> : Skipping NOP
-- 21. PassManager<Function> : Skipping NOP
-- 22. InstCombinePass
----------------------------------------
define <2 x float> @extract_two_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract1 = extractelement <4 x float> %sel, i32 1
%extract2 = extractelement <4 x float> %sel, i32 2
%build1 = insertelement <2 x float> undef, float %extract1, i32 0
%build2 = insertelement <2 x float> %build1, float %extract2, i32 1
ret <2 x float> %build2
}
Transformation seems to be correct! (syntactically equal)
-- 23. InstCombinePass
----------------------------------------
define <2 x float> @extract_two_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp = icmp ne <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
%extract1 = extractelement <4 x float> %sel, i32 1
%extract2 = extractelement <4 x float> %sel, i32 2
%build1 = insertelement <2 x float> undef, float %extract1, i32 0
%build2 = insertelement <2 x float> %build1, float %extract2, i32 1
ret <2 x float> %build2
}
=>
define <2 x float> @extract_two_vselect(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
#0:
%cmp.not = icmp eq <4 x i32> %c, { 0, 0, 0, 0 }
%sel = select <4 x i1> %cmp.not, <4 x float> %b, <4 x float> %a
%build2 = shufflevector <4 x float> %sel, <4 x float> poison, 1, 2
ret <2 x float> %build2
}
Transformation seems to be correct!
-- 24. PassManager<Function> : Skipping NOP
-- 25. PassManager<Function> : Skipping NOP
-- 26. InstCombinePass
----------------------------------------
define <4 x float> @simple_vector_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
entry:
%#0 = extractelement <4 x i32> %c, i32 0
%tobool = icmp ne i32 %#0, 0
%a.sink = select i1 %tobool, <4 x float> %a, <4 x float> %b
%#1 = extractelement <4 x float> %a.sink, i32 0
%#2 = insertelement <4 x float> undef, float %#1, i32 0
%#3 = extractelement <4 x i32> %c, i32 1
%tobool1 = icmp ne i32 %#3, 0
%a.sink1 = select i1 %tobool1, <4 x float> %a, <4 x float> %b
%#4 = extractelement <4 x float> %a.sink1, i32 1
%#5 = insertelement <4 x float> %#2, float %#4, i32 1
%#6 = extractelement <4 x i32> %c, i32 2
%tobool6 = icmp ne i32 %#6, 0
%a.sink2 = select i1 %tobool6, <4 x float> %a, <4 x float> %b
%#7 = extractelement <4 x float> %a.sink2, i32 2
%#8 = insertelement <4 x float> %#5, float %#7, i32 2
%#9 = extractelement <4 x i32> %c, i32 3
%tobool11 = icmp ne i32 %#9, 0
%a.sink3 = select i1 %tobool11, <4 x float> %a, <4 x float> %b
%#10 = extractelement <4 x float> %a.sink3, i32 3
%#11 = insertelement <4 x float> %#8, float %#10, i32 3
ret <4 x float> %#11
}
Transformation seems to be correct! (syntactically equal)
-- 27. InstCombinePass
----------------------------------------
define <4 x float> @simple_vector_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
entry:
%#0 = extractelement <4 x i32> %c, i32 0
%tobool = icmp ne i32 %#0, 0
%a.sink = select i1 %tobool, <4 x float> %a, <4 x float> %b
%#1 = extractelement <4 x float> %a.sink, i32 0
%#2 = insertelement <4 x float> undef, float %#1, i32 0
%#3 = extractelement <4 x i32> %c, i32 1
%tobool1 = icmp ne i32 %#3, 0
%a.sink1 = select i1 %tobool1, <4 x float> %a, <4 x float> %b
%#4 = extractelement <4 x float> %a.sink1, i32 1
%#5 = insertelement <4 x float> %#2, float %#4, i32 1
%#6 = extractelement <4 x i32> %c, i32 2
%tobool6 = icmp ne i32 %#6, 0
%a.sink2 = select i1 %tobool6, <4 x float> %a, <4 x float> %b
%#7 = extractelement <4 x float> %a.sink2, i32 2
%#8 = insertelement <4 x float> %#5, float %#7, i32 2
%#9 = extractelement <4 x i32> %c, i32 3
%tobool11 = icmp ne i32 %#9, 0
%a.sink3 = select i1 %tobool11, <4 x float> %a, <4 x float> %b
%#10 = extractelement <4 x float> %a.sink3, i32 3
%#11 = insertelement <4 x float> %#8, float %#10, i32 3
ret <4 x float> %#11
}
=>
define <4 x float> @simple_vector_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
entry:
%#0 = extractelement <4 x i32> %c, i64 0
%tobool.not = icmp eq i32 %#0, 0
%a.sink = select i1 %tobool.not, <4 x float> %b, <4 x float> %a
%#1 = extractelement <4 x i32> %c, i64 1
%tobool1.not = icmp eq i32 %#1, 0
%a.sink1 = select i1 %tobool1.not, <4 x float> %b, <4 x float> %a
%#2 = shufflevector <4 x float> %a.sink, <4 x float> %a.sink1, 0, 5, 4294967295, 4294967295
%#3 = extractelement <4 x i32> %c, i64 2
%tobool6.not = icmp eq i32 %#3, 0
%a.sink2 = select i1 %tobool6.not, <4 x float> %b, <4 x float> %a
%#4 = shufflevector <4 x float> %#2, <4 x float> %a.sink2, 0, 1, 6, 4294967295
%#5 = extractelement <4 x i32> %c, i64 3
%tobool11.not = icmp eq i32 %#5, 0
%a.sink3 = select i1 %tobool11.not, <4 x float> %b, <4 x float> %a
%#6 = shufflevector <4 x float> %#4, <4 x float> %a.sink3, 0, 1, 2, 7
ret <4 x float> %#6
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 28. PassManager<Function> : Skipping NOP
-- 29. PassManager<Function> : Skipping NOP
-- 30. InstCombinePass
----------------------------------------
define <4 x i32> @extract_cond(<4 x i32> %x, <4 x i32> %y, <4 x i1> %condv) {
#0:
%cond = extractelement <4 x i1> %condv, i32 3
%r = select i1 %cond, <4 x i32> %x, <4 x i32> %y
ret <4 x i32> %r
}
Transformation seems to be correct! (syntactically equal)
-- 31. InstCombinePass
----------------------------------------
define <4 x i32> @extract_cond(<4 x i32> %x, <4 x i32> %y, <4 x i1> %condv) {
#0:
%cond = extractelement <4 x i1> %condv, i32 3
%r = select i1 %cond, <4 x i32> %x, <4 x i32> %y
ret <4 x i32> %r
}
=>
define <4 x i32> @extract_cond(<4 x i32> %x, <4 x i32> %y, <4 x i1> %condv) {
#0:
%.splat = shufflevector <4 x i1> %condv, <4 x i1> poison, 3, 3, 3, 3
%r = select <4 x i1> %.splat, <4 x i32> %x, <4 x i32> %y
ret <4 x i32> %r
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source
Example:
<4 x i32> %x = < #x00000000 (0) [based on undef value], #x00000000 (0) [based on undef value], #x00000000 (0) [based on undef value], poison >
<4 x i32> %y = < #x00000000 (0) [based on undef value], poison, #x00000000 (0) [based on undef value], #x00000000 (0) [based on undef value] >
<4 x i1> %condv = < poison, poison, poison, undef >
Source:
i1 %cond = #x0 (0) [based on undef value]
<4 x i32> %r = < #x00000000 (0), poison, #x00000000 (0), #x00000000 (0) >
Target:
<4 x i1> %.splat = < #x0 (0), #x0 (0), #x0 (0), #x1 (1) >
<4 x i32> %r = < #x00000000 (0), poison, #x00000000 (0), poison >
Source value: < #x00000000 (0), poison, #x00000000 (0), #x00000000 (0) >
Target value: < #x00000000 (0), poison, #x00000000 (0), poison >
Pass: InstCombinePass
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' '-S' '-passes=instcombine' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_AzwqzorM_2VrI.bc"
------------------- SMT STATS -------------------
Num queries: 52
Num invalid: 0
Num skips: 0
Num trivial: 38 (42.2%)
Num timeout: 3 (5.8%)
Num errors: 0 (0.0%)
Num SAT: 31 (59.6%)
Num UNSAT: 18 (34.6%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -passes=instcombine < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/select-extractelement.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/select-extractelement.ll + /home/nlopes/alive2/build/opt-alive.sh -S -passes=instcombine + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/select-extractelement.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/select-extractelement.ll
NOTE: This test would pass if undef didn't exist!