[clang] [llvm] [InstCombine] Split GEPs with multiple non-zero offsets (PR #151333)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 06:27:48 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,c -- clang/test/CodeGen/union-tbaa1.c 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/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index c56d2ffda..979191c98 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2684,7 +2684,7 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP,
// Replace: gep (gep %P, long B), long A, ...
// With: T = long A+B; gep %P, T, ...
- Value *SO1 = Src->getOperand(Src->getNumOperands()-1);
+ Value *SO1 = Src->getOperand(Src->getNumOperands() - 1);
Value *GO1 = GEP.getOperand(1);
// If they aren't the same type, then the input hasn't been processed
@@ -2702,9 +2702,9 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP,
return nullptr;
SmallVector<Value *, 8> Indices;
- Indices.append(Src->op_begin()+1, Src->op_end()-1);
+ Indices.append(Src->op_begin() + 1, Src->op_end() - 1);
Indices.push_back(Sum);
- Indices.append(GEP.op_begin()+2, GEP.op_end());
+ Indices.append(GEP.op_begin() + 2, GEP.op_end());
// Don't create GEPs with more than one non-zero index.
unsigned NumNonZeroIndices = count_if(Indices, [](Value *Idx) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/151333
More information about the llvm-commits
mailing list