[llvm] select (sext m), (add X, C), X --> (add X, (and C, (sext m)))) (PR #83640)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 19:11:55 PST 2024


================
@@ -12070,6 +12070,15 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) {
   if (SDValue F = extractBooleanFlip(N0, DAG, TLI, false))
     return DAG.getSelect(DL, VT, F, N2, N1);
 
+  // select (sext m), (add X, C), X --> (add X, (and C, (sext m))))
----------------
topperc wrote:

Some targets you use 00000001 as a true value for a vector instead of 11111111. So we need to check what kind of target we're optimizing for.

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


More information about the llvm-commits mailing list