[PATCH] D113300: [SelectionDAG] Merge FoldConstantVectorArithmetic into FoldConstantArithmetic (PR36544)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 09:48:57 PST 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Seems fine to me, but best to wait for one more review.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5295-5306
   // If this is a bitwise logic opcode see if we can fold bitcasted ops.
   // TODO: Can we generalize this and fold any bitcasted constant data?
-  if (ISD::isBitwiseLogicOp(Opcode) && N1->getOpcode() == ISD::BITCAST &&
-      N2->getOpcode() == ISD::BITCAST) {
-    SDValue InnerN1 = peekThroughBitcasts(N1->getOperand(0));
-    SDValue InnerN2 = peekThroughBitcasts(N2->getOperand(0));
+  if (ISD::isBitwiseLogicOp(Opcode) && Ops[0].getOpcode() == ISD::BITCAST &&
+      Ops[1].getOpcode() == ISD::BITCAST) {
+    SDValue InnerN1 = peekThroughBitcasts(Ops[0].getOperand(0));
+    SDValue InnerN2 = peekThroughBitcasts(Ops[1].getOperand(0));
     EVT InnerVT = InnerN1.getValueType();
----------------
I think this should be in the previous if-block (2 ops)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113300



More information about the llvm-commits mailing list