[llvm] 169ebf0 - Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 15:37:24 PST 2021


Author: Matt Arsenault
Date: 2021-12-15T18:37:18-05:00
New Revision: 169ebf03ab2a6f16bfa32a36305929c7bc8e4784

URL: https://github.com/llvm/llvm-project/commit/169ebf03ab2a6f16bfa32a36305929c7bc8e4784
DIFF: https://github.com/llvm/llvm-project/commit/169ebf03ab2a6f16bfa32a36305929c7bc8e4784.diff

LOG: Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute

It seems we don't have already have any target specific attributes
handled in the inliner. Include a separate tablegen file to define the
rules, similar to the target specific intrinsics.

Added: 
    llvm/include/llvm/IR/AttributesAMDGPU.td

Modified: 
    llvm/include/llvm/IR/Attributes.td
    llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td
index de25b51a6292..40c554c269ca 100644
--- a/llvm/include/llvm/IR/Attributes.td
+++ b/llvm/include/llvm/IR/Attributes.td
@@ -345,3 +345,6 @@ def : MergeRule<"adjustCallerStackProbeSize">;
 def : MergeRule<"adjustMinLegalVectorWidth">;
 def : MergeRule<"adjustNullPointerValidAttr">;
 def : MergeRule<"setAND<MustProgressAttr>">;
+
+// Target dependent attributes
+include "llvm/IR/AttributesAMDGPU.td"

diff  --git a/llvm/include/llvm/IR/AttributesAMDGPU.td b/llvm/include/llvm/IR/AttributesAMDGPU.td
new file mode 100644
index 000000000000..e2a0f045b656
--- /dev/null
+++ b/llvm/include/llvm/IR/AttributesAMDGPU.td
@@ -0,0 +1,14 @@
+//===- AttributesAMDGPU.td - Defines AMDGPU attributes -----*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines AMDGPU specific attributes.
+//
+//===----------------------------------------------------------------------===//
+
+def AMDGPUUnsafeFPAtomics : StrBoolAttr<"amdgpu-unsafe-fp-atomics">;
+def : MergeRule<"setAND<AMDGPUUnsafeFPAtomicsAttr>">;

diff  --git a/llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll b/llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
index 7de6095294fe..46701e7ca52d 100644
--- a/llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
+++ b/llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
@@ -37,7 +37,7 @@ define i32 @default_call_default() #0 {
 
 define i32 @unsafe_fp_atomic_enabled_call_default() #1 {
 ; CHECK-LABEL: define {{[^@]+}}@unsafe_fp_atomic_enabled_call_default
-; CHECK-SAME: () #[[ATTR1]] {
+; CHECK-SAME: () #[[ATTR2]] {
 ; CHECK-NEXT:    ret i32 0
 ;
   %call = call i32 @func_default()
@@ -55,7 +55,7 @@ define i32 @unsafe_fp_atomic_enabled_call_unsafe_fp_atomic_enabled() #1 {
 
 define i32 @unsafe_fp_atomic_enabled_call_unsafe_fp_atomic_disabled() #1 {
 ; CHECK-LABEL: define {{[^@]+}}@unsafe_fp_atomic_enabled_call_unsafe_fp_atomic_disabled
-; CHECK-SAME: () #[[ATTR1]] {
+; CHECK-SAME: () #[[ATTR2]] {
 ; CHECK-NEXT:    ret i32 0
 ;
   %call = call i32 @func_unsafe_fp_atomic_disabled()


        


More information about the llvm-commits mailing list