mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-09 12:34:25 +00:00
[InstCombine] remove dead code from visitExtractElement
Extracting from a splat constant is always handled by InstSimplify. Move the test for this from InstCombine to InstSimplify to make sure that stays true. llvm-svn: 348423
This commit is contained in:
parent
5f1dd03505
commit
81980ee8e7
@ -267,12 +267,6 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
|
||||
SQ.getWithInstruction(&EI)))
|
||||
return replaceInstUsesWith(EI, V);
|
||||
|
||||
// If vector val is constant with all elements the same, replace EI with
|
||||
// that element. We handle a known element # below.
|
||||
if (auto *C = dyn_cast<Constant>(SrcVec))
|
||||
if (cheapToScalarize(C, false))
|
||||
return replaceInstUsesWith(EI, C->getAggregateElement(0U));
|
||||
|
||||
// If extracting a specified index from the vector, see if we can recursively
|
||||
// find a previously computed scalar that was inserted into the vector.
|
||||
auto *IndexC = dyn_cast<ConstantInt>(Index);
|
||||
|
@ -97,14 +97,6 @@ define i32 @extelt_binop_binop_insertelt(<4 x i32> %A, <4 x i32> %B, i32 %f) {
|
||||
ret i32 %E
|
||||
}
|
||||
|
||||
define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
|
||||
; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
|
||||
; CHECK-NEXT: ret float 2.000000e+00
|
||||
;
|
||||
%r = extractelement <4 x float> <float 2.0, float 2.0, float 2.0, float 2.0>, i32 %y
|
||||
ret float %r
|
||||
}
|
||||
|
||||
define float @extract_element_constant_vector_variable_index(i32 %y) {
|
||||
; CHECK-LABEL: @extract_element_constant_vector_variable_index(
|
||||
; CHECK-NEXT: [[R:%.*]] = extractelement <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>, i32 [[Y:%.*]]
|
||||
|
@ -39,9 +39,18 @@ define i129 @vec_extract_undef_index(<3 x i129> %a) {
|
||||
|
||||
define i129 @vec_extract_in_bounds(<3 x i129> %a) {
|
||||
; CHECK-LABEL: @vec_extract_in_bounds(
|
||||
; CHECK-NEXT: %E1 = extractelement <3 x i129> %a, i129 2
|
||||
; CHECK-NEXT: ret i129 %E1
|
||||
; CHECK-NEXT: [[E1:%.*]] = extractelement <3 x i129> [[A:%.*]], i129 2
|
||||
; CHECK-NEXT: ret i129 [[E1]]
|
||||
;
|
||||
%E1 = extractelement <3 x i129> %a, i129 2
|
||||
ret i129 %E1
|
||||
}
|
||||
|
||||
define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
|
||||
; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
|
||||
; CHECK-NEXT: ret float 2.000000e+00
|
||||
;
|
||||
%r = extractelement <4 x float> <float 2.0, float 2.0, float 2.0, float 2.0>, i32 %y
|
||||
ret float %r
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user