[PATCH] D45537: [CodeGenPrepare] Move Extension Instructions Through Logical And Shift Instructions

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 17:17:55 PDT 2018


qcolombet added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3369
+       Inst->getOpcode() == Instruction::Or) &&
+      isa<ConstantInt>(Inst->getOperand(1)))
+    return true;
----------------
Carrot wrote:
> qcolombet wrote:
> > Do we need to restrict this to constants?
> It is same as DAGCombiner::visitZERO_EXTEND. Extension of constant doesn't cause extra cost at run time, it makes sure moving extension across this instruction doesn't bring another extension on the other operand. Only in rare case the extension on the other operand can also be combined with another load.
Agreed. However, the check of the profitability of creating more than one extension is done later. Here we focus on answering, is it possible to extend?
So constant or not, the answer should be yes (true).

My point is, unless you see a problem with the existing cost model used later, we shouldn't prevent the promotion to get evaluated.


https://reviews.llvm.org/D45537





More information about the llvm-commits mailing list