forked from swiftlang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VectorUtils] Skip interleave members with diff type and alloca sizes.
Currently, codegen doesn't support cases where the type size doesn't match the alloc size. Skip them for now. Fixes llvm#58722. (cherry picked from commit 758699c)
- Loading branch information
Showing
2 changed files
with
89 additions
and
1 deletion.
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
83 changes: 83 additions & 0 deletions
83
llvm/test/Transforms/LoopVectorize/AArch64/interleave-allocsize-not-equal-typesize.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,83 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -passes=loop-vectorize -S %s | FileCheck %s | ||
|
||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64-unknown-linux-gnu" | ||
|
||
; Make sure LV does not crash when analyzing potential interleave groups with | ||
; accesses where the typesize doesn't match to allocsize. | ||
define void @pr58722_load_interleave_group(ptr %src, ptr %dst) { | ||
; CHECK-LABEL: @pr58722_load_interleave_group( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: br label [[LOOP:%.*]] | ||
; CHECK: loop: | ||
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] | ||
; CHECK-NEXT: [[GEP_IV:%.*]] = getelementptr inbounds i64, ptr [[SRC:%.*]], i64 [[IV]] | ||
; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[GEP_IV]], align 4 | ||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[GEP_IV]], i64 1 | ||
; CHECK-NEXT: [[V2:%.*]] = load i24, ptr [[GEP]], align 4 | ||
; CHECK-NEXT: [[V2_EXT:%.*]] = zext i24 [[V2]] to i32 | ||
; CHECK-NEXT: [[SUM:%.*]] = add i32 [[V1]], [[V2_EXT]] | ||
; CHECK-NEXT: [[GEP_DST:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[IV]] | ||
; CHECK-NEXT: store i32 [[SUM]], ptr [[GEP_DST]], align 4 | ||
; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1 | ||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV]], 10000 | ||
; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] | ||
; CHECK: exit: | ||
; CHECK-NEXT: ret void | ||
; | ||
entry: | ||
br label %loop | ||
|
||
loop: | ||
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] | ||
%gep.iv = getelementptr inbounds i64, ptr %src, i64 %iv | ||
%v1 = load i32, ptr %gep.iv, align 4 | ||
%gep = getelementptr inbounds i32, ptr %gep.iv, i64 1 | ||
%v2 = load i24, ptr %gep, align 4 | ||
%v2.ext = zext i24 %v2 to i32 | ||
%sum = add i32 %v1, %v2.ext | ||
%gep.dst = getelementptr inbounds i32, ptr %dst, i64 %iv | ||
store i32 %sum, ptr %gep.dst | ||
%iv.next = add i64 %iv, 1 | ||
%cmp = icmp eq i64 %iv, 10000 | ||
br i1 %cmp, label %exit, label %loop | ||
|
||
exit: | ||
ret void | ||
} | ||
|
||
define void @pr58722_store_interleave_group(ptr %src, ptr %dst) { | ||
; CHECK-LABEL: @pr58722_store_interleave_group( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: br label [[LOOP:%.*]] | ||
; CHECK: loop: | ||
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] | ||
; CHECK-NEXT: [[GEP_IV:%.*]] = getelementptr inbounds i64, ptr [[SRC:%.*]], i32 [[IV]] | ||
; CHECK-NEXT: store i32 [[IV]], ptr [[GEP_IV]], align 4 | ||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i64, ptr [[GEP_IV]], i64 1 | ||
; CHECK-NEXT: [[TRUNC_IV:%.*]] = trunc i32 [[IV]] to i24 | ||
; CHECK-NEXT: store i24 [[TRUNC_IV]], ptr [[GEP]], align 4 | ||
; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 2 | ||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[IV]], 10000 | ||
; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]] | ||
; CHECK: exit: | ||
; CHECK-NEXT: ret void | ||
; | ||
entry: | ||
br label %loop | ||
|
||
loop: | ||
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] | ||
%gep.iv = getelementptr inbounds i64, ptr %src, i32 %iv | ||
store i32 %iv, ptr %gep.iv | ||
%gep = getelementptr inbounds i64, ptr %gep.iv, i64 1 | ||
%trunc.iv = trunc i32 %iv to i24 | ||
store i24 %trunc.iv, ptr %gep | ||
%iv.next = add i32 %iv, 2 | ||
%cmp = icmp eq i32 %iv, 10000 | ||
br i1 %cmp, label %exit, label %loop | ||
|
||
exit: | ||
ret void | ||
} |