[llvm] [AggressiveInstCombine] Check profitability of low-bits mask table folds (PR #228736)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 09:33:11 PDT 2026


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/lib/Analysis/TargetTransformInfo.cpp llvm/lib/Target/X86/X86TargetTransformInfo.cpp llvm/lib/Target/X86/X86TargetTransformInfo.h llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
index d30182f70..8f0483302 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -1251,12 +1251,9 @@ static bool tryToRecognizeTableBasedLog2(LoadInst *LI, Type *AccessType,
 //
 // Shares the load/GEP/offset match with the cttz and log2 recognizers above;
 // see tryToRecognizeTableBasedPatterns().
-static bool tryToRecognizeTableBasedLowBitsMask(LoadInst *LI, Type *AccessType,
-                                                GlobalVariable *GVTable,
-                                                Value *GepIdx,
-                                                const APInt &GEPScale,
-                                                const DataLayout &DL,
-                                                TargetTransformInfo &TTI) {
+static bool tryToRecognizeTableBasedLowBitsMask(
+    LoadInst *LI, Type *AccessType, GlobalVariable *GVTable, Value *GepIdx,
+    const APInt &GEPScale, const DataLayout &DL, TargetTransformInfo &TTI) {
   // The value must be exactly the table element; refuse volatile/atomic loads.
   if (!LI->isSimple())
     return false;

``````````

</details>


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


More information about the llvm-commits mailing list