[PATCH] D90286: [Analysis] Improve EmitGEPOffset by avoiding summ with zero
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 29 04:12:09 PDT 2020
yrouban added a comment.
In D90286#2358263 <https://reviews.llvm.org/D90286#2358263>, @jdoerfert wrote:
> Drive by: Tests needed, commit message missing, and we should see if we can avoid 3-5 line assignments.
//EmitGEPOffset()// is used by instcombine and we do not see the redundant //add 0, X// instruction because it is immediately optimized out in the same iteration. It prevents a simple lit test for this patch. On the other hand you can see the fix in //InstCombinerImpl::OptimizePointerDifference()// which changes the code to expect X in place of //add 0, X// and there is a related test (test/Transforms/InstCombine/sub-gep.ll), which I believe is enough for this small improvement.
Keep in mind that //EmitGEPOffset()// could be used in other custom passes that might not require subsequent instcombine to run.
I believe we do not have to adjust sources to make them look better being formatted by the clang formatter. We should improve the formatter instead. But this should not prevent this patch to be accepted.
I'm ok to rename the variables for a better look if this is the only thing that is needed for LGTM, though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90286/new/
https://reviews.llvm.org/D90286
More information about the llvm-commits
mailing list