diff options
author | Nikita Popov <npopov@redhat.com> | 2024-04-26 10:53:03 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-26 10:53:03 +0900 |
commit | cbe1760f02882328c91e5764648f97fe644f44c9 (patch) | |
tree | c8edaf332938feb3106c21b0a650aa4806b3cec6 /llvm/lib/IR/Function.cpp | |
parent | e21d89eb8b0798d842b1240cc992cb979d54809c (diff) | |
download | llvm-cbe1760f02882328c91e5764648f97fe644f44c9.zip llvm-cbe1760f02882328c91e5764648f97fe644f44c9.tar.gz llvm-cbe1760f02882328c91e5764648f97fe644f44c9.tar.bz2 |
[InstCombine] Allow multi-use OptimizePointerDifference() with two GEPs (#90017)
Currently, the OptimizePointerDifference fold does not trigger when
working on the sub of two geps where one of the geps has multiple uses,
to avoid duplicating the offset arithmetic too much.
However, there are cases where performing it would still be
clearly profitable, e.g. test_sub_ptradd_multiuse.
This patch drops the one-use restriction using the same strategy we use
in GEP comparison folds: If there are multiple uses, we rewrite the GEP
to use the expanded offset arithmetic instead (effectively
canonicalizing it into ptradd representation).
Fixes https://github.com/llvm/llvm-project/issues/88231.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
0 files changed, 0 insertions, 0 deletions