
Use IR analysis to infer when an addrspacecast operand is nonnull, then lower it to an intrinsic that the DAG can use to skip the null check. I did this using an intrinsic as it's non-intrusive. An alternative would have been to allow something like `!nonnull` on `addrspacecast` then lower that to a custom opcode (or add an operand to the addrspacecast MIR/DAG opcodes), but it's a lot of boilerplate for just one target's use case IMO. I'm hoping that when we switch to GISel that we can move all this logic to the MIR level without losing info, but currently the DAG doesn't see enough so we need to act in CGP. Fixes: SWDEV-316445
14 lines
640 B
LLVM
14 lines
640 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
|
|
; RUN: opt -mtriple=amdgcn-- -amdgpu-codegenprepare -S < %s | FileCheck -check-prefix=OPT %s
|
|
|
|
; Check that CGP doesn't try to create a amdgcn.addrspace.nonnull of vector, as that's not supported.
|
|
|
|
define <4 x ptr> @vec_of_local_to_flat_nonnull_arg() {
|
|
; OPT-LABEL: define <4 x ptr> @vec_of_local_to_flat_nonnull_arg() {
|
|
; OPT-NEXT: [[X:%.*]] = addrspacecast <4 x ptr addrspace(3)> zeroinitializer to <4 x ptr>
|
|
; OPT-NEXT: ret <4 x ptr> [[X]]
|
|
;
|
|
%x = addrspacecast <4 x ptr addrspace(3)> zeroinitializer to <4 x ptr>
|
|
ret <4 x ptr> %x
|
|
}
|