[PATCH] D115633: Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 06:41:51 PST 2021


arsenm created this revision.
arsenm added reviewers: ahatanak, jdoerfert, void, xbolva00.
Herald added subscribers: dexonsmith, kerbowa, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D115633

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


Index: llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
===================================================================
--- llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
+++ llvm/test/Transforms/Inline/AMDGPU/inline-amdgpu-unsafe-fp-atomics.ll
@@ -37,7 +37,7 @@
 
 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_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()
Index: llvm/include/llvm/IR/AttributesAMDGPU.td
===================================================================
--- /dev/null
+++ 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>">;
Index: llvm/include/llvm/IR/Attributes.td
===================================================================
--- llvm/include/llvm/IR/Attributes.td
+++ llvm/include/llvm/IR/Attributes.td
@@ -345,3 +345,6 @@
 def : MergeRule<"adjustMinLegalVectorWidth">;
 def : MergeRule<"adjustNullPointerValidAttr">;
 def : MergeRule<"setAND<MustProgressAttr>">;
+
+// Target dependent attributes
+include "llvm/IR/AttributesAMDGPU.td"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115633.393873.patch
Type: text/x-patch
Size: 2160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211213/c14d8759/attachment.bin>


More information about the llvm-commits mailing list