[llvm] [LICM]The store instruction is prevented from (PR #69413)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 20:34:48 PDT 2023


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 b42738805acffafee158b56320d725e51908761f bc09933b1bc8753c53bb924778bb32a6d701d60e -- llvm/lib/Transforms/Scalar/LICM.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index ca307a5f60fe..74a52a9f5923 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -2050,7 +2050,7 @@ bool llvm::promoteLoopAccessesToScalars(
   // We cannot (yet) promote a memory location that is loaded and stored in
   // different sizes.  While we are at it, collect alignment and AA info.
   Type *AccessTy = nullptr;
-  const char* FunName = "signal";
+  const char *FunName = "signal";
   for (Value *ASIV : PointerMustAliases) {
     for (Use &U : ASIV->uses()) {
       // Ignore instructions that are outside the loop.
@@ -2058,22 +2058,25 @@ bool llvm::promoteLoopAccessesToScalars(
       if (!UI)
         continue;
 
-      if(StoreSafety == StoreSafe && !CurLoop->contains(UI)){
-        if(LoadInst *NotCurLoopLoad = dyn_cast<LoadInst>(UI)){
+      if (StoreSafety == StoreSafe && !CurLoop->contains(UI)) {
+        if (LoadInst *NotCurLoopLoad = dyn_cast<LoadInst>(UI)) {
           Function *NotCurLoopFun = UI->getParent()->getParent();
-          for(Use &UseFun : NotCurLoopFun->uses()){
+          for (Use &UseFun : NotCurLoopFun->uses()) {
             Instruction *UUseFun = dyn_cast<Instruction>(UseFun.getUser());
-            if(UUseFun){
+            if (UUseFun) {
               bool isSignal = false;
-              for(int i = 0; i < UUseFun->getNumOperands(); ++i){
-                if(!strcmp(FunName, UUseFun->getOperand(i)->getName().data()))
+              for (int i = 0; i < UUseFun->getNumOperands(); ++i) {
+                if (!strcmp(FunName, UUseFun->getOperand(i)->getName().data()))
                   isSignal = true;
               }
-              if(!isSignal)
+              if (!isSignal)
                 continue;
-              for(BasicBlock *BB = &CurLoop->getLoopPreheader()->getParent()->getEntryBlock();
-                  BB != CurLoop->getLoopPreheader()->getNextNode(); BB = BB->getNextNode()){
-                if(BB == UUseFun->getParent())
+              for (BasicBlock *BB = &CurLoop->getLoopPreheader()
+                                         ->getParent()
+                                         ->getEntryBlock();
+                   BB != CurLoop->getLoopPreheader()->getNextNode();
+                   BB = BB->getNextNode()) {
+                if (BB == UUseFun->getParent())
                   return false;
               }
             }
@@ -2081,8 +2084,8 @@ bool llvm::promoteLoopAccessesToScalars(
         }
       }
 
-      if(!CurLoop->contains(UI))
-	continue;
+      if (!CurLoop->contains(UI))
+        continue;
 
       // If there is an non-load/store instruction in the loop, we can't promote
       // it.

``````````

</details>


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


More information about the llvm-commits mailing list