[PATCH] D39906: [InstCombine] Allowing GEP Instructions with loop Invariant operands to combine
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 11:03:44 PST 2017
mgrang added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1663
+ // If the source has only one use, then there is no need of waiting for
+ // the chain to be resolved
+ if (!Src->hasOneUse()) {
----------------
nit: Period after comment.
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1697
// merge is never more than that before the merge.
- if (Sum == nullptr)
- return nullptr;
+ if (Sum == nullptr) {
+ if (LI) {
----------------
Please consider using early exits: https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code.
Something like:
```
if (!LI)
return nullptr;
<main logic goes here>
```
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1701
+ //If both the operands are either constants or loop-invariants
+ // then they can also be combined
+ if ((!isa<Constant>(GO1) && !(L->isLoopInvariant(GO1))) ||
----------------
nit: Period after comment.
https://reviews.llvm.org/D39906
More information about the llvm-commits
mailing list