forked from llvm/llvm-project
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SLP]Fix PR101213: Reuse extractelement, only if its vector operand c…
…omes before new vector value. When trying to reuse extractelement instruction, need to check that it is inserted into proper position. Its original vector operand should come before new vector value, otherwise new extractelement instruction must be generated. Fixes llvm#101213 (cherry picked from commit f70f122)
- Loading branch information
1 parent
dae0320
commit df73ee6
Showing
2 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
llvm/test/Transforms/SLPVectorizer/X86/extract-vectorized-operand.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -S --passes=slp-vectorizer -slp-threshold=-99999 < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s | ||
|
||
define void @test() { | ||
; CHECK-LABEL: define void @test() { | ||
; CHECK-NEXT: [[BB:.*]]: | ||
; CHECK-NEXT: br label %[[BB43:.*]] | ||
; CHECK: [[BB20:.*]]: | ||
; CHECK-NEXT: br label %[[BB105:.*]] | ||
; CHECK: [[BB43]]: | ||
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x ptr addrspace(1)> [ [[TMP1:%.*]], %[[BB51:.*]] ], [ zeroinitializer, %[[BB]] ] | ||
; CHECK-NEXT: br i1 false, label %[[BB105]], label %[[BB51]] | ||
; CHECK: [[BB51]]: | ||
; CHECK-NEXT: [[TMP1]] = phi <2 x ptr addrspace(1)> [ poison, %[[BB54:.*]] ], [ zeroinitializer, %[[BB43]] ] | ||
; CHECK-NEXT: br label %[[BB43]] | ||
; CHECK: [[BB54]]: | ||
; CHECK-NEXT: br label %[[BB51]] | ||
; CHECK: [[BB105]]: | ||
; CHECK-NEXT: [[PHI106:%.*]] = phi ptr addrspace(1) [ null, %[[BB20]] ], [ null, %[[BB43]] ] | ||
; CHECK-NEXT: ret void | ||
; | ||
bb: | ||
%0 = shufflevector <2 x ptr addrspace(1)> zeroinitializer, <2 x ptr addrspace(1)> zeroinitializer, <2 x i32> <i32 1, i32 0> | ||
%1 = extractelement <2 x ptr addrspace(1)> %0, i32 0 | ||
%2 = extractelement <2 x ptr addrspace(1)> %0, i32 1 | ||
br label %bb43 | ||
|
||
bb20: | ||
br label %bb105 | ||
|
||
bb43: | ||
%phi441 = phi ptr addrspace(1) [ %4, %bb51 ], [ %2, %bb ] | ||
%phi452 = phi ptr addrspace(1) [ %5, %bb51 ], [ %1, %bb ] | ||
br i1 false, label %bb105, label %bb51 | ||
|
||
bb51: | ||
%3 = phi <2 x ptr addrspace(1)> [ poison, %bb54 ], [ zeroinitializer, %bb43 ] | ||
%4 = extractelement <2 x ptr addrspace(1)> %3, i32 0 | ||
%5 = extractelement <2 x ptr addrspace(1)> %3, i32 1 | ||
br label %bb43 | ||
|
||
bb54: | ||
br label %bb51 | ||
|
||
bb105: | ||
%phi106 = phi ptr addrspace(1) [ %1, %bb20 ], [ null, %bb43 ] | ||
ret void | ||
} | ||
|