Files
clang-p2996/llvm/test/CodeGen/AArch64/pr86717.ll
Craig Topper acab142751 [LegalizeDAG] Freeze index when converting insert_elt/insert_subvector to load/store on stack.
We try clamp the index to be within the bounds of the stack object
we create, but if we don't freeze it, poison can propagate into the
clamp code. This can cause the access to leave the bounds of the
stack object.

We have other instances of this issue in type legalization and extract_elt/subvector,
but posting this patch first for direction check.

Fixes #86717
2024-03-27 13:01:23 -07:00

23 lines
736 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
define <16 x i8> @f(i32 %0) {
; CHECK-LABEL: f:
; CHECK: // %bb.0:
; CHECK-NEXT: sub sp, sp, #16
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: movi v0.2d, #0000000000000000
; CHECK-NEXT: mov w8, #1 // =0x1
; CHECK-NEXT: mov x9, sp
; CHECK-NEXT: sub w8, w8, w0
; CHECK-NEXT: bfxil x9, x8, #0, #4
; CHECK-NEXT: mov w8, #3 // =0x3
; CHECK-NEXT: str q0, [sp]
; CHECK-NEXT: strb w8, [x9]
; CHECK-NEXT: ldr q0, [sp], #16
; CHECK-NEXT: ret
%2 = sub nuw i32 1, %0
%3 = insertelement <16 x i8> zeroinitializer, i8 3, i32 %2
ret <16 x i8> %3
}