-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lint] Fix crash for insert/extract on scalable vector
Don't assume the vector is fixed size. For scalable vectors, do not report an error, as indices outside the minimum range may be valid.
- Loading branch information
Showing
2 changed files
with
24 additions
and
18 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
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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -S -passes=lint < %s | FileCheck %s | ||
; RUN: opt -S -passes=lint -disable-output < %s 2>&1 | FileCheck %s --allow-empty | ||
|
||
; Make sure we don't crash. | ||
|
||
define <vscale x 8 x i8> @test() { | ||
; CHECK-LABEL: define <vscale x 8 x i8> @test() { | ||
; CHECK-NEXT: [[A:%.*]] = alloca <vscale x 8 x i8>, align 8 | ||
; CHECK-NEXT: [[V:%.*]] = load <vscale x 8 x i8>, ptr [[A]], align 8 | ||
; CHECK-NEXT: ret <vscale x 8 x i8> [[V]] | ||
; | ||
; CHECK-NOT: Buffer overflow | ||
define <vscale x 8 x i8> @alloca_access() { | ||
%a = alloca <vscale x 8 x i8> | ||
%v = load <vscale x 8 x i8>, ptr %a | ||
ret <vscale x 8 x i8> %v | ||
} | ||
|
||
; CHECK-NOT: insertelement index out of range | ||
define <vscale x 8 x half> @insertelement() { | ||
%insert = insertelement <vscale x 8 x half> poison, half 0xH0000, i64 100 | ||
ret <vscale x 8 x half> %insert | ||
} | ||
|
||
; CHECK-NOT: extract index out of range | ||
define half @extractelement(<vscale x 8 x half> %v) { | ||
%insert = extractelement <vscale x 8 x half> %v, i64 100 | ||
ret half %insert | ||
} |