[PATCH] D62871: [Codegen] (X & (C l>>/<< Y)) ==/!= 0 --> ((X <</l>> Y) & C) ==/!= 0 fold

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 15:14:10 PDT 2019


spatel added inline comments.


================
Comment at: include/llvm/CodeGen/TargetLowering.h:579
+  virtual bool shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(
+      SDValue X, ConstantSDNode *XC, ConstantSDNode *CC, SDValue Y,
+      unsigned OldShiftOpcode, unsigned NewShiftOpcode,
----------------
lebedev.ri wrote:
> spatel wrote:
> > Is there some reason to send XC in as a parameter rather than asking if it is a constant within this function and giving that constant a local name?
> I'm pretty sure i have tried that.
> As far as i recall, i can't do that because `isConstOrConstSplat()` is defined in `DAGCombine.cpp`,
> which isn't guaranteed to be linked in every library where this hook could end up.
> 
Ah yes, we have a mess of misplaced helper functions like that. No need to hold this patch up any more then, but it would be good to add a comment somewhere with that explanation.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62871





More information about the llvm-commits mailing list