[llvm] [InstCombine] Make indexed compare fold GEP source type independent (PR #71663)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 8 08:28:51 PST 2023
================
@@ -675,14 +651,14 @@ static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS,
if (!GEPLHS->hasAllConstantIndices())
return nullptr;
- Type *ElemTy = GEPLHS->getSourceElementType();
- Value *PtrBase, *Index;
- std::tie(PtrBase, Index) = getAsConstantIndexedAddress(ElemTy, GEPLHS, DL);
+ Value *PtrBase;
+ APInt Offset;
+ std::tie(PtrBase, Offset) = getAsConstantIndexedAddress(GEPLHS, DL);
----------------
dtcxzyw wrote:
```suggestion
auto [PtrBase, Offset] = getAsConstantIndexedAddress(GEPLHS, DL);
```
https://github.com/llvm/llvm-project/pull/71663
More information about the llvm-commits
mailing list