[llvm] [DSE] Split memory intrinsics if they are dead in the middle (PR #75478)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 06:48:17 PST 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 d16cf470ac4600bb1a6b462ed843078ad65a3d93 89c3eb2c08a121821836c7e7bd11cac8459f6401 -- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 7e9f1b6350..57ff807745 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -555,8 +555,10 @@ static void shortenAssignment(Instruction *Inst, Value *OriginalDest,
   }
 }
 
-static bool tryToSplitMiddle(Instruction *DeadI, OverlapIntervalsTy &IntervalMap,
-                      int64_t &DeadStart, uint64_t &DeadSize, const TargetTransformInfo& TTI) {
+static bool tryToSplitMiddle(Instruction *DeadI,
+                             OverlapIntervalsTy &IntervalMap,
+                             int64_t &DeadStart, uint64_t &DeadSize,
+                             const TargetTransformInfo &TTI) {
   if (IntervalMap.empty() || !isShortenableAtTheEnd(DeadI))
     return false;
 
@@ -582,8 +584,8 @@ static bool tryToSplitMiddle(Instruction *DeadI, OverlapIntervalsTy &IntervalMap
   // Assume Front is already correctly aligned.
   uint64_t FrontSize = KillingStart - DeadStart;
 
-  int64_t RearStart = alignDown(
-      uint64_t(KillingStart + KillingSize), PrefAlign.value());
+  int64_t RearStart =
+      alignDown(uint64_t(KillingStart + KillingSize), PrefAlign.value());
   uint64_t RearSize = (DeadStart + DeadSize) - RearStart;
 
   // If Front and Rear are both bigger than the threshold they won't be inlined
@@ -934,9 +936,10 @@ struct DSEState {
 
   DSEState(Function &F, AliasAnalysis &AA, MemorySSA &MSSA, DominatorTree &DT,
            PostDominatorTree &PDT, const TargetLibraryInfo &TLI,
-           const LoopInfo &LI, const TargetTransformInfo& TTI)
+           const LoopInfo &LI, const TargetTransformInfo &TTI)
       : F(F), AA(AA), EI(DT, &LI), BatchAA(AA, &EI), MSSA(MSSA), DT(DT),
-        PDT(PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI), TTI(TTI) {
+        PDT(PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI),
+        TTI(TTI) {
     // Collect blocks with throwing instructions not modeled in MemorySSA and
     // alloc-like objects.
     unsigned PO = 0;
@@ -2136,7 +2139,8 @@ struct DSEState {
 static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
                                 DominatorTree &DT, PostDominatorTree &PDT,
                                 const TargetLibraryInfo &TLI,
-                                const LoopInfo &LI, const TargetTransformInfo& TTI) {
+                                const LoopInfo &LI,
+                                const TargetTransformInfo &TTI) {
   bool MadeChange = false;
 
   DSEState State(F, AA, MSSA, DT, PDT, TLI, LI, TTI);

``````````

</details>


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


More information about the llvm-commits mailing list