[PATCH] D55435: [AMDGPU] Fix discarded result of addAttribute

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 9 07:28:07 PST 2018


modocache updated this revision to Diff 177427.
modocache added a comment.

Thanks for the review, @nhaehnle! I changed the FileCheck variable `NOUNWIND_READONLY` to not use a dollar-sign prefix. I'm not sure why the other lines in this test do, but I left them alone for now. Any other suggestions for this, or is it good to go?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55435/new/

https://reviews.llvm.org/D55435

Files:
  lib/Target/AMDGPU/AMDGPULibFunc.cpp
  test/CodeGen/AMDGPU/simplify-libcalls.ll


Index: test/CodeGen/AMDGPU/simplify-libcalls.ll
===================================================================
--- test/CodeGen/AMDGPU/simplify-libcalls.ll
+++ test/CodeGen/AMDGPU/simplify-libcalls.ll
@@ -783,5 +783,10 @@
   ret void
 }
 
+; GCN-PRELINK: declare float @_Z4fabsf(float) local_unnamed_addr #[[NOUNWIND_READONLY:[0-9]+]]
+; GCN-PRELINK: declare float @_Z4cbrtf(float) local_unnamed_addr #[[NOUNWIND_READONLY]]
+; GCN-PRELINK: declare float @_Z11native_sqrtf(float) local_unnamed_addr #[[NOUNWIND_READONLY]]
+
 ; CGN-PRELINK: attributes #[[$NOUNWIND]] = { nounwind }
+; GCN-PRELINK: attributes #[[NOUNWIND_READONLY]] = { nounwind readonly }
 attributes #0 = { nounwind }
Index: lib/Target/AMDGPU/AMDGPULibFunc.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPULibFunc.cpp
+++ lib/Target/AMDGPU/AMDGPULibFunc.cpp
@@ -995,8 +995,10 @@
   } else {
     AttributeList Attr;
     LLVMContext &Ctx = M->getContext();
-    Attr.addAttribute(Ctx, AttributeList::FunctionIndex, Attribute::ReadOnly);
-    Attr.addAttribute(Ctx, AttributeList::FunctionIndex, Attribute::NoUnwind);
+    Attr = Attr.addAttribute(Ctx, AttributeList::FunctionIndex,
+                             Attribute::ReadOnly);
+    Attr = Attr.addAttribute(Ctx, AttributeList::FunctionIndex,
+                             Attribute::NoUnwind);
     C = M->getOrInsertFunction(FuncName, FuncTy, Attr);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55435.177427.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181209/099056d3/attachment.bin>


More information about the llvm-commits mailing list