[llvm] Remove redundant assumes (PR #123518)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 19 08:43:52 PST 2025


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 0cb2fe5183c9b25bb96140c27d12b1ad4a80aa92 28fe0189640a16e26f8676b0c44bc3e598ed009c --extensions cpp,h -- llvm/include/llvm/Analysis/SimplifyQuery.h llvm/include/llvm/Analysis/ValueTracking.h llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Analysis/ValueTracking.cpp llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index f3282424d9..a706dadae4 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6465,7 +6465,7 @@ getRangeForUnknownRecurrence(const SCEVUnknown *U) {
     if (!DT.isReachableFromEntry(Pred))
       return FullSet;
 
-  Instruction*BO;
+  Instruction *BO;
   Value *Start, *Step;
   if (!matchSimpleRecurrence(P, BO, Start, Step))
     return FullSet;
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e46dec4273..84949c44e2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1585,7 +1585,9 @@ static void computeKnownBitsFromOperator(const Operator *I,
         auto *OverflowOp = dyn_cast<OverflowingBinaryOperator>(BO);
         if (!isa<GetElementPtrInst, OverflowingBinaryOperator>(BO))
           break;
-        if ((isa<GetElementPtrInst>(BO) && !Q.IIQ.isInBounds(cast<GetElementPtrInst>(BO))) || (OverflowOp && !Q.IIQ.hasNoSignedWrap(OverflowOp)))
+        if ((isa<GetElementPtrInst>(BO) &&
+             !Q.IIQ.isInBounds(cast<GetElementPtrInst>(BO))) ||
+            (OverflowOp && !Q.IIQ.hasNoSignedWrap(OverflowOp)))
           break;
 
         switch (Opcode) {
@@ -1745,12 +1747,11 @@ static void computeKnownBitsFromOperator(const Operator *I,
       }
     }
 
-  // Aligned pointers have trailing zeros - refine Known.Zero set
-  if (isa<PointerType>(CB->getType())) {
-    Align Alignment = CB->getPointerAlignment(Q.DL);
-    Known.Zero.setLowBits(Log2(Alignment));
-  }
-
+    // Aligned pointers have trailing zeros - refine Known.Zero set
+    if (isa<PointerType>(CB->getType())) {
+      Align Alignment = CB->getPointerAlignment(Q.DL);
+      Known.Zero.setLowBits(Log2(Alignment));
+    }
 
     if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
       switch (II->getIntrinsicID()) {
@@ -9256,7 +9257,8 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, Instruction *&BO,
       break; // Match!
     }
     case Instruction::GetElementPtr: {
-      if (LU->getNumOperands() != 2 || !cast<GetElementPtrInst>(L)->getSourceElementType()->isIntegerTy(8))
+      if (LU->getNumOperands() != 2 ||
+          !cast<GetElementPtrInst>(L)->getSourceElementType()->isIntegerTy(8))
         continue;
 
       Value *LL = LU->getOperand(0);
diff --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
index b4b3536ddc..6283a6628f 100644
--- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
+++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
@@ -1028,7 +1028,8 @@ bool MVEGatherScatterLowering::optimiseOffsets(Value *Offsets, BasicBlock *BB,
   Instruction *IncInstruction;
   Value *Start, *IncrementPerRound;
   if (!matchSimpleRecurrence(Phi, IncInstruction, Start, IncrementPerRound) ||
-      IncInstruction->getOpcode() != Instruction::Add || !isa<BinaryOperator>(IncInstruction))
+      IncInstruction->getOpcode() != Instruction::Add ||
+      !isa<BinaryOperator>(IncInstruction))
     return false;
 
   int IncrementingBlock = Phi->getIncomingValue(0) == IncInstruction ? 0 : 1;

``````````

</details>


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


More information about the llvm-commits mailing list