[llvm] [EarlyCSE] Compare GEP instructions based on offset (PR #65875)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 06:56:18 PDT 2023
================
@@ -1561,6 +1646,31 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
continue;
}
+ // Compare GEP instructions based on offset.
+ if (GEPValue::canHandle(&Inst)) {
+ auto *GEP = cast<GetElementPtrInst>(&Inst);
+ APInt Offset = APInt(SQ.DL.getIndexTypeSizeInBits(GEP->getType()), 0);
+ GEPValue GEPVal(GEP, GEP->accumulateConstantOffset(SQ.DL, Offset)
+ ? Offset.tryZExtValue()
----------------
DianQK wrote:
Yes, it's more clear to use `int64_t`.
https://github.com/llvm/llvm-project/pull/65875
More information about the llvm-commits
mailing list