[llvm-branch-commits] [llvm] AMDGPU: Add noundef to mbcnt intrinsic returns (PR #136304)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 18 06:32:05 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
I started to add the range, but it probably can't be done on
the declaration due to the second added operand.
---
Full diff: https://github.com/llvm/llvm-project/pull/136304.diff
2 Files Affected:
- (modified) llvm/include/llvm/IR/IntrinsicsAMDGPU.td (+9-9)
- (modified) llvm/test/Assembler/amdgcn-intrinsic-attributes.ll (+15-2)
``````````diff
diff --git a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
index a57eb4a6dba49..9803693253853 100644
--- a/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
+++ b/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
@@ -2215,15 +2215,15 @@ def int_amdgcn_live_mask : DefaultAttrsIntrinsic <[llvm_i1_ty],
[], [NoUndef<RetIndex>, IntrReadMem, IntrInaccessibleMemOnly]
>;
-def int_amdgcn_mbcnt_lo :
- ClangBuiltin<"__builtin_amdgcn_mbcnt_lo">,
- DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
- [IntrNoMem]>;
-
-def int_amdgcn_mbcnt_hi :
- ClangBuiltin<"__builtin_amdgcn_mbcnt_hi">,
- DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
- [IntrNoMem]>;
+def int_amdgcn_mbcnt_lo
+ : ClangBuiltin<"__builtin_amdgcn_mbcnt_lo">,
+ DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
+ [NoUndef<RetIndex>, IntrNoMem]>;
+
+def int_amdgcn_mbcnt_hi
+ : ClangBuiltin<"__builtin_amdgcn_mbcnt_hi">,
+ DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
+ [NoUndef<RetIndex>, IntrNoMem]>;
// llvm.amdgcn.ds.swizzle src offset
def int_amdgcn_ds_swizzle :
diff --git a/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll b/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll
index 744c94ac85410..b965bef634f9d 100644
--- a/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll
+++ b/llvm/test/Assembler/amdgcn-intrinsic-attributes.ll
@@ -18,12 +18,25 @@ define i32 @ds_consume(ptr addrspace(3) %ptr) {
ret i32 %ret
}
+; CHECK: declare noundef i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #1
+define i32 @mbcnt_hi(i32 %a, i32 %b) {
+ %ret = call i32 @llvm.amdgcn.mbcnt.hi(i32 %a, i32 %b)
+ ret i32 %ret
+}
+
+; CHECK: declare noundef i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #1
+define i32 @mbcnt_lo(i32 %a, i32 %b) {
+ %ret = call i32 @llvm.amdgcn.mbcnt.lo(i32 %a, i32 %b)
+ ret i32 %ret
+}
+
; Test assumed range
-; CHECK: declare noundef range(i32 32, 65) i32 @llvm.amdgcn.wavefrontsize() #1
+; CHECK: declare noundef range(i32 32, 65) i32 @llvm.amdgcn.wavefrontsize() #2
define i32 @wavefrontsize() {
%ret = call i32 @llvm.amdgcn.wavefrontsize()
ret i32 %ret
}
; CHECK: attributes #0 = { convergent nocallback nofree nounwind willreturn memory(argmem: readwrite) }
-; CHECK: attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
+; CHECK: attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
``````````
</details>
https://github.com/llvm/llvm-project/pull/136304
More information about the llvm-branch-commits
mailing list