[llvm] [Attributor]: AApointerInfo - store the full chain of instructions that make up the access (PR #96526)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 13:25:06 PDT 2024


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 31a94bd783ae61f418bd730109992dfb30b70e87 530e8b2e7d41a74934feec3633b6ab5b5e621ca9 -- llvm/include/llvm/Transforms/IPO/Attributor.h 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 5df684c2ed..c50b79b62d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -6235,8 +6235,9 @@ struct AAPointerInfo : public AbstractAttribute {
 
     // void findAccessPathsHelper(OffsetInfoMapTy &OffsetInfoMap,
     //                            SmallPtrSet<Value *, 16> &Visited,
-    //                            Value *Instruction, AccessPathTy *CurrentChain,
-    //                            AccessPathSetTy *AccessPathsSet) {
+    //                            Value *Instruction, AccessPathTy
+    //                            *CurrentChain, AccessPathSetTy
+    //                            *AccessPathsSet) {
     //   // Add all the successors
     //   if (!OffsetInfoMap.contains(Instruction))
     //     return;
@@ -6284,24 +6285,22 @@ struct AAPointerInfo : public AbstractAttribute {
     //   Visited.erase(Instruction);
     // }
 
-
-     AccessPathSetTy *findAllAccessPaths(OffsetInfoMapTy &OffsetInfoMap) {
+    AccessPathSetTy *findAllAccessPaths(OffsetInfoMapTy &OffsetInfoMap) {
 
       AccessPathSetTy *AccessPathsSet = new AccessPathSetTy();
       AccessPathTy *Start = new AccessPathTy();
       AccessPathsSet->insert(Start);
       Start->push_back(LocalI);
 
-      SmallVector<std::pair<Instruction*, AccessPathTy*>, 16> Stack;
+      SmallVector<std::pair<Instruction *, AccessPathTy *>, 16> Stack;
       SmallPtrSet<Value *, 16> Visited;
 
       for (auto *It = LocalI->op_begin(); It != LocalI->op_end(); It++)
         if (Instruction *I = dyn_cast<Instruction>(It))
-               Stack.push_back(std::make_pair(I, Start));
+          Stack.push_back(std::make_pair(I, Start));
+
+      while (!Stack.empty()) {
 
-      
-      while(!Stack.empty()){
-        
         auto Entry = Stack.pop_back_val();
         Instruction *Top = Entry.first;
         AccessPathTy *CurrentChain = Entry.second;
@@ -6334,7 +6333,7 @@ struct AAPointerInfo : public AbstractAttribute {
         NewPaths.push_back(CurrentChain);
         for (size_t Index = 1; Index < Successors.size(); Index++) {
           AccessPathTy *NewPath =
-             new AccessPathTy(CurrentChain->begin(), CurrentChain->end());
+              new AccessPathTy(CurrentChain->begin(), CurrentChain->end());
           NewPaths.push_back(NewPath);
         }
 
@@ -6345,7 +6344,6 @@ struct AAPointerInfo : public AbstractAttribute {
           Stack.push_back(std::make_pair(Successor, NextChain));
           Index++;
         }
-        
       }
 
       return AccessPathsSet;

``````````

</details>


https://github.com/llvm/llvm-project/pull/96526


More information about the llvm-commits mailing list