[PATCH] D27413: Simplify gep (gep p, a), (b-a)

Andrea Canciani via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 14:13:12 PST 2016


ranma42 added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1566-1570
+      Value* Sum = SimplifyAddInst(GO1, SO1, false, false, DL, &TLI, &DT, &AC);
+      // Only do the combine when we are sure the cost after the
+      // merge is never more than that before the merge.
+      if (Sum == nullptr)
+        return nullptr;
----------------
davide wrote:
> ranma42 wrote:
> > davide wrote:
> > > You can fold the `SimplifyAddInst` inside the if, no?
> > As in
> > ```
> >   if (!(Sum = SimplifyAddInst(GO1, SO1, false, false, DL, &TLI, &DT, &AC)))
> > ```
> > ?
> > I was afraid that it was less readable, but I can definitely do that :)
> up to you.  The API is actually quite verbose already because it takes a lot of arguments. Anyway, I'm OK with this but please wait for others to comment.
I received no other comments on this. Should I proceed with your suggestion?


https://reviews.llvm.org/D27413





More information about the llvm-commits mailing list