[PATCH] D113202: [DAG] FoldConstantArithmetic - fold bitlogic(bitcast(x),bitcast(y)) -> bitcast(bitlogic(x,y))

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 04:47:42 PDT 2021


RKSimon added a comment.

Thanks @lebedev.ri - I'm still intending to look at generalizing this in the future



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5300-5301
+      N2->getOpcode() == ISD::BITCAST) {
+    SDValue InnerN1 = peekThroughBitcasts(N1->getOperand(0));
+    SDValue InnerN2 = peekThroughBitcasts(N2->getOperand(0));
+    EVT InnerVT = InnerN1.getValueType();
----------------
lebedev.ri wrote:
> Do we expect to have a bitcast-of-bitcast? These are folded to a single bitcast i think.
Yes, but depending on the order of the calls to the combines these often get missed :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113202



More information about the llvm-commits mailing list