[llvm] [X86] Fix a>b being different than b<a on -mattr=+avx2 (PR #195712)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 12:59:11 PDT 2026


================
@@ -25060,6 +25060,13 @@ static SDValue LowerVSETCC(SDValue Op, const X86Subtarget &Subtarget,
   if (ISD::isUnsignedIntSetCC(Cond) &&
       (FlipSigns || ISD::isTrueWhenEqual(Cond)) &&
       TLI.isOperationLegal(ISD::UMIN, VT)) {
+    // If Op0 is a load and Op1 is not, swap them to allow folding the load
+    // into the min/max operation.
+    if (Op0.getOpcode() == ISD::LOAD && Op1.getOpcode() != ISD::LOAD) {
----------------
RKSimon wrote:

Yes, try to use mayFoldLoad here, and add a test with both being loads, but only one having multiuses.

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


More information about the llvm-commits mailing list