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

Andrea Canciani via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 16:57:07 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:
> 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 :)


More information about the llvm-commits mailing list