[PATCH] D84890: AMDGPU: Put inexpensive ops first in AMDGPUAnnotateUniformValues::visitLoadInst

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 14:20:13 PDT 2020


cfang updated this revision to Diff 282045.
cfang marked an inline comment as done.
cfang added a comment.

1. Add a missing space;
2. Early exit when it is not an EntryFunction.


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

https://reviews.llvm.org/D84890

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
@@ -131,10 +131,20 @@
   // We're tracking up to the Function boundaries, and cannot go beyond because
   // of FunctionPass restrictions. We can ensure that is memory not clobbered
   // for memory operations that are live in to entry points only.
-  bool NotClobbered = isEntryFunc && !isClobberedInFunction(&I);
   Instruction *PtrI = dyn_cast<Instruction>(Ptr);
-  if (!PtrI && NotClobbered && isGlobalLoad(I)) {
-    if (isa<Argument>(Ptr) || isa<GlobalValue>(Ptr)) {
+
+  if (!isEntryFunc) {
+    if (PtrI)
+      setUniformMetadata(PtrI);
+    return;
+  }
+
+  bool NotClobbered = false;
+  if (PtrI)
+    NotClobbered = !isClobberedInFunction(&I);
+  else if (isa<Argument>(Ptr) || isa<GlobalValue>(Ptr)) {
+    if (isGlobalLoad(I) && !isClobberedInFunction(&I)) {
+      NotClobbered = true;
       // Lookup for the existing GEP
       if (noClobberClones.count(Ptr)) {
         PtrI = noClobberClones[Ptr];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84890.282045.patch
Type: text/x-patch
Size: 1167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200730/ef6c2c7c/attachment.bin>


More information about the llvm-commits mailing list