[llvm] [InstCombine] Only fold extract element to trunc if vector `hasOneUse` (PR #115627)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 9 17:50:50 PST 2024
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 0ac4821b718dd14e80d3856efa532d52df6878bb 149078c6807da8f0670123a855f7b6c173675e9b --extensions cpp -- llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 7d1d053edd..76878ce4ff 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -205,7 +205,8 @@ Instruction *InstCombinerImpl::foldBitcastExtElt(ExtractElementInst &Ext) {
if (IsBigEndian)
ExtIndexC = NumElts.getKnownMinValue() - 1 - ExtIndexC;
unsigned ShiftAmountC = ExtIndexC * DestWidth;
- if ((!ShiftAmountC || isDesirableIntType(X->getType()->getPrimitiveSizeInBits())) &&
+ if ((!ShiftAmountC ||
+ isDesirableIntType(X->getType()->getPrimitiveSizeInBits())) &&
Ext.getVectorOperand()->hasOneUse()) {
if (ShiftAmountC)
X = Builder.CreateLShr(X, ShiftAmountC, "extelt.offset");
``````````
</details>
https://github.com/llvm/llvm-project/pull/115627
More information about the llvm-commits
mailing list