[llvm] [llvm] fix few copypaste typos (PR #119881)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 04:48:42 PST 2024


https://github.com/klensy updated https://github.com/llvm/llvm-project/pull/119881

>From 4aa3b110635c9670b7b2c3407919548369c1265a Mon Sep 17 00:00:00 2001
From: klensy <nightouser at gmail.com>
Date: Fri, 13 Dec 2024 17:21:13 +0300
Subject: [PATCH 1/2] lfix typos

---
 llvm/lib/Transforms/Scalar/JumpThreading.cpp    | 2 +-
 llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 300a564e222e16..a3059c8fe2d37b 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -2516,7 +2516,7 @@ void JumpThreadingPass::updateBlockFreqAndEdgeWeight(BasicBlock *PredBB,
                                                      BlockFrequencyInfo *BFI,
                                                      BranchProbabilityInfo *BPI,
                                                      bool HasProfile) {
-  assert(((BFI && BPI) || (!BFI && !BFI)) &&
+  assert(((BFI && BPI) || (!BFI && !BPI)) &&
          "Both BFI & BPI should either be set or unset");
 
   if (!BFI) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 6b71e3e7585ed3..ee501de59d76b2 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -13859,7 +13859,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
     Value *createShuffleVector(Value *V1, Value *V2, ArrayRef<int> Mask) {
       if (V1->getType() != V2->getType()) {
         assert(V1->getType()->isIntOrIntVectorTy() &&
-               V1->getType()->isIntOrIntVectorTy() &&
+               V2->getType()->isIntOrIntVectorTy() &&
                "Expected integer vector types only.");
         if (V1->getType() != V2->getType()) {
           if (cast<VectorType>(V2->getType())

>From fb5a0054df371fb47896be3d6fe33d2f5f89a166 Mon Sep 17 00:00:00 2001
From: klensy <nightouser at gmail.com>
Date: Fri, 20 Dec 2024 15:48:21 +0300
Subject: [PATCH 2/2] remove needless if

---
 .../Transforms/Vectorize/SLPVectorizer.cpp    | 22 +++++++++----------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index ee501de59d76b2..ad9ff942324c51 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -13861,18 +13861,16 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
         assert(V1->getType()->isIntOrIntVectorTy() &&
                V2->getType()->isIntOrIntVectorTy() &&
                "Expected integer vector types only.");
-        if (V1->getType() != V2->getType()) {
-          if (cast<VectorType>(V2->getType())
-                  ->getElementType()
-                  ->getIntegerBitWidth() < cast<VectorType>(V1->getType())
-                                               ->getElementType()
-                                               ->getIntegerBitWidth())
-            V2 = Builder.CreateIntCast(
-                V2, V1->getType(), !isKnownNonNegative(V2, SimplifyQuery(DL)));
-          else
-            V1 = Builder.CreateIntCast(
-                V1, V2->getType(), !isKnownNonNegative(V1, SimplifyQuery(DL)));
-        }
+        if (cast<VectorType>(V2->getType())
+                ->getElementType()
+                ->getIntegerBitWidth() < cast<VectorType>(V1->getType())
+                                             ->getElementType()
+                                             ->getIntegerBitWidth())
+          V2 = Builder.CreateIntCast(
+              V2, V1->getType(), !isKnownNonNegative(V2, SimplifyQuery(DL)));
+        else
+          V1 = Builder.CreateIntCast(
+              V1, V2->getType(), !isKnownNonNegative(V1, SimplifyQuery(DL)));
       }
       Value *Vec = Builder.CreateShuffleVector(V1, V2, Mask);
       if (auto *I = dyn_cast<Instruction>(Vec)) {



More information about the llvm-commits mailing list