[PATCH] D35499: [InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index
Chad Rosier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 05:53:52 PDT 2017
mcrosier added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1468
- // Avoid duplicating the arithmetic if GEP2 has non-constant indices and
- // multiple users.
- if (!GEP1 ||
- (GEP2 && !GEP2->hasAllConstantIndices() && !GEP2->hasOneUse()))
+ if (GEP1 == nullptr) {
+ // No GEP found.
----------------
!GEP1 is the preferred condition style and you don't need the extra curly brackets.
if (!GEP1)
return nullptr;
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1473
+
+ if (GEP2 != nullptr) {
+ // (gep X, ...) - (gep X, ...)
----------------
Similarly, !GEP2 is preferred.
https://reviews.llvm.org/D35499
More information about the llvm-commits
mailing list