[llvm] [DAG] Peek through bitcasts when canonicalizing constants to the RHS on commutable instructions (PR #112682)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 02:40:18 PDT 2024


================
@@ -2668,8 +2668,8 @@ SDValue DAGCombiner::visitADDLike(SDNode *N) {
     return C;
 
   // canonicalize constant to RHS
-  if (DAG.isConstantIntBuildVectorOrConstantInt(N0) &&
-      !DAG.isConstantIntBuildVectorOrConstantInt(N1))
+  if (DAG.isConstantIntBuildVectorOrConstantInt(peekThroughBitcasts(N0)) &&
----------------
phoebewang wrote:

Can we do it in `isConstantIntBuildVectorOrConstantInt` instead?

https://github.com/llvm/llvm-project/pull/112682


More information about the llvm-commits mailing list