github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cl,h,cpp -- 
clang/test/CodeGenOpenCL/builtins-amdgcn-make-buffer-rsrc.cl 
llvm/include/llvm/Transforms/IPO/Attributor.h 
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp 
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h 
b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 297dd296a..107ab0d1c 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1364,7 +1364,6 @@ struct InformationCache {
 
   virtual unsigned getMaxAddrSpace() const { return ~0U; }
 
-
 private:
   struct FunctionInfo {
     LLVM_ABI ~FunctionInfo();
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
index c7d43c80c..c4b7406ef 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
@@ -235,7 +235,6 @@ public:
     return ST.getMaxWavesPerEU();
   }
 
-
   bool shouldTrackUse(const AbstractAttribute *QueryingAA,
                       Value &AssociatedValue, const Use *U,
                       const Instruction *I) const override {
@@ -245,90 +244,90 @@ public:
     }
     return false;
 
-  unsigned getMaxAddrSpace() const override {
-    return AMDGPUAS::MAX_AMDGPU_ADDRESS;
-  }
-
-private:
-  /// Check if the ConstantExpr \p CE uses an addrspacecast from private or
-  /// local to flat. These casts may require the queue pointer.
-  static uint8_t visitConstExpr(const ConstantExpr *CE) {
-    uint8_t Status = NONE;
-
-    if (CE->getOpcode() == Instruction::AddrSpaceCast) {
-      unsigned SrcAS = CE->getOperand(0)->getType()->getPointerAddressSpace();
-      if (SrcAS == AMDGPUAS::PRIVATE_ADDRESS)
-        Status |= ADDR_SPACE_CAST_PRIVATE_TO_FLAT;
-      else if (SrcAS == AMDGPUAS::LOCAL_ADDRESS)
-        Status |= ADDR_SPACE_CAST_LOCAL_TO_FLAT;
+    unsigned getMaxAddrSpace() const override {
+      return AMDGPUAS::MAX_AMDGPU_ADDRESS;
     }
 
-    return Status;
-  }
+  private:
+    /// Check if the ConstantExpr \p CE uses an addrspacecast from private or
+    /// local to flat. These casts may require the queue pointer.
+    static uint8_t visitConstExpr(const ConstantExpr *CE) {
+      uint8_t Status = NONE;
+
+      if (CE->getOpcode() == Instruction::AddrSpaceCast) {
+        unsigned SrcAS = 
CE->getOperand(0)->getType()->getPointerAddressSpace();
+        if (SrcAS == AMDGPUAS::PRIVATE_ADDRESS)
+          Status |= ADDR_SPACE_CAST_PRIVATE_TO_FLAT;
+        else if (SrcAS == AMDGPUAS::LOCAL_ADDRESS)
+          Status |= ADDR_SPACE_CAST_LOCAL_TO_FLAT;
+      }
 
-  /// Returns the minimum amount of LDS space used by a workgroup running
-  /// function \p F.
-  static unsigned getLDSSize(const Function &F) {
-    return AMDGPU::getIntegerPairAttribute(F, "amdgpu-lds-size",
-                                           {0, UINT32_MAX}, true)
-        .first;
-  }
+      return Status;
+    }
+
+    /// Returns the minimum amount of LDS space used by a workgroup running
+    /// function \p F.
+    static unsigned getLDSSize(const Function &F) {
+      return AMDGPU::getIntegerPairAttribute(F, "amdgpu-lds-size",
+                                             {0, UINT32_MAX}, true)
+          .first;
+    }
 
-  /// Get the constant access bitmap for \p C.
-  uint8_t getConstantAccess(const Constant *C,
-                            SmallPtrSetImpl<const Constant *> &Visited) {
-    auto It = ConstantStatus.find(C);
-    if (It != ConstantStatus.end())
-      return It->second;
+    /// Get the constant access bitmap for \p C.
+    uint8_t getConstantAccess(const Constant *C,
+                              SmallPtrSetImpl<const Constant *> &Visited) {
+      auto It = ConstantStatus.find(C);
+      if (It != ConstantStatus.end())
+        return It->second;
 
-    uint8_t Result = 0;
-    if (isDSAddress(C))
-      Result = DS_GLOBAL;
+      uint8_t Result = 0;
+      if (isDSAddress(C))
+        Result = DS_GLOBAL;
 
-    if (const auto *CE = dyn_cast<ConstantExpr>(C))
-      Result |= visitConstExpr(CE);
+      if (const auto *CE = dyn_cast<ConstantExpr>(C))
+        Result |= visitConstExpr(CE);
 
-    for (const Use &U : C->operands()) {
-      const auto *OpC = dyn_cast<Constant>(U);
-      if (!OpC || !Visited.insert(OpC).second)
-        continue;
+      for (const Use &U : C->operands()) {
+        const auto *OpC = dyn_cast<Constant>(U);
+        if (!OpC || !Visited.insert(OpC).second)
+          continue;
 
-      Result |= getConstantAccess(OpC, Visited);
+        Result |= getConstantAccess(OpC, Visited);
+      }
+      return Result;
     }
-    return Result;
-  }
 
-public:
-  /// Returns true if \p Fn needs the queue pointer because of \p C.
-  bool needsQueuePtr(const Constant *C, Function &Fn) {
-    bool IsNonEntryFunc = !AMDGPU::isEntryFunctionCC(Fn.getCallingConv());
-    bool HasAperture = hasApertureRegs(Fn);
+  public:
+    /// Returns true if \p Fn needs the queue pointer because of \p C.
+    bool needsQueuePtr(const Constant *C, Function &Fn) {
+      bool IsNonEntryFunc = !AMDGPU::isEntryFunctionCC(Fn.getCallingConv());
+      bool HasAperture = hasApertureRegs(Fn);
 
-    // No need to explore the constants.
-    if (!IsNonEntryFunc && HasAperture)
-      return false;
+      // No need to explore the constants.
+      if (!IsNonEntryFunc && HasAperture)
+        return false;
 
-    SmallPtrSet<const Constant *, 8> Visited;
-    uint8_t Access = getConstantAccess(C, Visited);
+      SmallPtrSet<const Constant *, 8> Visited;
+      uint8_t Access = getConstantAccess(C, Visited);
 
-    // We need to trap on DS globals in non-entry functions.
-    if (IsNonEntryFunc && (Access & DS_GLOBAL))
-      return true;
+      // We need to trap on DS globals in non-entry functions.
+      if (IsNonEntryFunc && (Access & DS_GLOBAL))
+        return true;
 
-    return !HasAperture && (Access & ADDR_SPACE_CAST_BOTH_TO_FLAT);
-  }
+      return !HasAperture && (Access & ADDR_SPACE_CAST_BOTH_TO_FLAT);
+    }
 
-  bool checkConstForAddrSpaceCastFromPrivate(const Constant *C) {
-    SmallPtrSet<const Constant *, 8> Visited;
-    uint8_t Access = getConstantAccess(C, Visited);
-    return Access & ADDR_SPACE_CAST_PRIVATE_TO_FLAT;
-  }
+    bool checkConstForAddrSpaceCastFromPrivate(const Constant *C) {
+      SmallPtrSet<const Constant *, 8> Visited;
+      uint8_t Access = getConstantAccess(C, Visited);
+      return Access & ADDR_SPACE_CAST_PRIVATE_TO_FLAT;
+    }
 
-private:
-  /// Used to determine if the Constant needs the queue pointer.
-  DenseMap<const Constant *, uint8_t> ConstantStatus;
-  const unsigned CodeObjectVersion;
-};
+  private:
+    /// Used to determine if the Constant needs the queue pointer.
+    DenseMap<const Constant *, uint8_t> ConstantStatus;
+    const unsigned CodeObjectVersion;
+  };
 
 struct AAAMDAttributes
     : public StateWrapper<BitIntegerState<uint32_t, ALL_ARGUMENT_MASK, 0>,
@@ -1465,12 +1464,11 @@ static bool runImpl(Module &M, AnalysisGetter &AG, 
TargetMachine &TM,
           A.getOrCreateAAFor<AAAlign>(IRP);
         }
 
-      if (Ptr) {
-        A.getOrCreateAAFor<AAAddressSpace>(IRPosition::value(*Ptr));
-        A.getOrCreateAAFor<AANoAliasAddrSpace>(IRPosition::value(*Ptr));
-
+        if (Ptr) {
+          A.getOrCreateAAFor<AAAddressSpace>(IRPosition::value(*Ptr));
+          A.getOrCreateAAFor<AANoAliasAddrSpace>(IRPosition::value(*Ptr));
+        }
       }
-    }
   }
 
   bool Changed = A.run() == ChangeStatus::CHANGED;

``````````

</details>


https://github.com/llvm/llvm-project/pull/145278
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to