[llvm] [SimplifyCfg] Add nneg to zext for switch to table conversion (PR #147180)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 6 10:16:33 PDT 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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index a471a2bbe..459a8d1ad 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6606,7 +6606,8 @@ Value *SwitchLookupTable::buildLookup(Value *Index, IRBuilder<> &Builder,
       unsigned OldBitWidth = Index->getType()->getIntegerBitWidth();
       Index = Builder.CreateZExtOrTrunc(Index, IndexTy);
       if (auto *Zext = dyn_cast<ZExtInst>(Index))
-        Zext->setNonNeg(isUIntN(OldBitWidth - 1, ArrayTy->getNumElements() - 1));
+        Zext->setNonNeg(
+            isUIntN(OldBitWidth - 1, ArrayTy->getNumElements() - 1));
     }
 
     Value *GEPIndices[] = {ConstantInt::get(IndexTy, 0), Index};

``````````

</details>


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


More information about the llvm-commits mailing list