[llvm] [indvars] Always fallback to truncation if AddRec widening fails (PR #70967)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 11:24:36 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 f9a89e6b9c4345df978bf7cbfedfd2b250029278 4c8dc3609da730a435258f9ea67af690b9beea98 -- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 52b86aa088e9..6371f82f228f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1789,7 +1789,7 @@ Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, SCEVExpander &Rewri
     return nullptr;
   }
 
-  auto tryAddRecExpansion = [&]() -> Instruction* {
+  auto tryAddRecExpansion = [&]() -> Instruction * {
     // Does this user itself evaluate to a recurrence after widening?
     WidenedRecTy WideAddRec = getExtendedOperandRecurrence(DU);
     if (!WideAddRec.first)
@@ -1811,14 +1811,15 @@ Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, SCEVExpander &Rewri
         return nullptr;
     }
     // Evaluation of WideAddRec ensured that the narrow expression could be
-    // extended outside the loop without overflow. This suggests that the wide use
-    // evaluates to the same expression as the extended narrow use, but doesn't
-    // absolutely guarantee it. Hence the following failsafe check. In rare cases
-    // where it fails, we simply throw away the newly created wide use.
+    // extended outside the loop without overflow. This suggests that the wide
+    // use evaluates to the same expression as the extended narrow use, but
+    // doesn't absolutely guarantee it. Hence the following failsafe check. In
+    // rare cases where it fails, we simply throw away the newly created wide
+    // use.
     if (WideAddRec.first != SE->getSCEV(WideUse)) {
       LLVM_DEBUG(dbgs() << "Wide use expression mismatch: " << *WideUse << ": "
-                 << *SE->getSCEV(WideUse) << " != " << *WideAddRec.first
-                 << "\n");
+                        << *SE->getSCEV(WideUse) << " != " << *WideAddRec.first
+                        << "\n");
       DeadInsts.emplace_back(WideUse);
       return nullptr;
     };

``````````

</details>


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


More information about the llvm-commits mailing list