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

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 14:37:54 PDT 2020


cfang created this revision.
cfang added a reviewer: arsenm.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
cfang requested review of this revision.
Herald added a subscriber: wdng.

This is in response to the review of https://reviews.llvm.org/D84873:
The expensive check should be reordered last


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,13 @@
   // 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)) {
+  bool NotClobbered = false;
+  if (PtrI)
+    NotClobbered= isEntryFunc && !isClobberedInFunction(&I);
+  else if (isa<Argument>(Ptr) || isa<GlobalValue>(Ptr)) {
+    if (isGlobalLoad(I) && isEntryFunc && !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.281740.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/6c805106/attachment.bin>


More information about the llvm-commits mailing list