[llvm] [InstCombine] Fold icmp(constants[x]) when the range of x is given (PR #67093)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 09:41:25 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 b8df88b41c8a1b4e879b4fd34be3522c9b45e86f 54d49205ef9beb306c6471e38d6323fc3a45edd9 -- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 96e48f7616..f0814df719 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -324,8 +324,7 @@ Instruction *InstCombinerImpl::foldCmpLoadFromIndexedGlobal(
     // If the index is larger than the pointer offset size of the target,
     // truncate the index down like the GEP would do implicitly.  We don't have
     // to do this for an inbounds GEP because the index can't be out of range.
-    if (!GEP->isInBounds() &&
-        Idx->getType()->getScalarSizeInBits() > IndexSize)
+    if (!GEP->isInBounds() && Idx->getType()->getScalarSizeInBits() > IndexSize)
       Idx = Builder.CreateTrunc(Idx, PtrIdxTy);
 
     return MaskIdx(Idx);

``````````

</details>


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


More information about the llvm-commits mailing list