[PATCH] D79145: Allow gep (select) combine with non-constant operands

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 17:50:26 PDT 2020


rampitec marked an inline comment as done.
rampitec added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1731-1732
+  if (!(isa<Constant>(True) && isa<Constant>(False)) &&
+      !isa<AllocaInst>(GetUnderlyingObject(True, DL)) &&
+      !isa<AllocaInst>(GetUnderlyingObject(False, DL)))
+    return nullptr;
----------------
arsenm wrote:
> Calling GetUnderlyingObject so often seems potentially expensive
I can just disable this combine unconditionally. In many cases gep is a no-op. However, I in some situations gep really results in some arithmetic.

I.e. it is a tradeoff between code quality and compile time. Also note, GetUnderlyingObject has a threshold, which will limit compile time impact on one hand, but also limit optimization on another.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79145/new/

https://reviews.llvm.org/D79145





More information about the llvm-commits mailing list