@@ -4321,26 +4321,24 @@ SDValue DAGCombiner::visitIMINMAX(SDNode *N) {
4321
4321
SDValue N0 = N->getOperand(0);
4322
4322
SDValue N1 = N->getOperand(1);
4323
4323
EVT VT = N0.getValueType();
4324
+ unsigned Opcode = N->getOpcode();
4324
4325
4325
4326
// fold vector ops
4326
4327
if (VT.isVector())
4327
4328
if (SDValue FoldedVOp = SimplifyVBinOp(N))
4328
4329
return FoldedVOp;
4329
4330
4330
4331
// fold operation with constant operands.
4331
- ConstantSDNode *N0C = getAsNonOpaqueConstant(N0);
4332
- ConstantSDNode *N1C = getAsNonOpaqueConstant(N1);
4333
- if (N0C && N1C)
4334
- return DAG.FoldConstantArithmetic(N->getOpcode(), SDLoc(N), VT, N0C, N1C);
4332
+ if (SDValue C = DAG.FoldConstantArithmetic(Opcode, SDLoc(N), VT, {N0, N1}))
4333
+ return C;
4335
4334
4336
4335
// canonicalize constant to RHS
4337
4336
if (DAG.isConstantIntBuildVectorOrConstantInt(N0) &&
4338
- !DAG.isConstantIntBuildVectorOrConstantInt(N1))
4337
+ !DAG.isConstantIntBuildVectorOrConstantInt(N1))
4339
4338
return DAG.getNode(N->getOpcode(), SDLoc(N), VT, N1, N0);
4340
4339
4341
4340
// Is sign bits are zero, flip between UMIN/UMAX and SMIN/SMAX.
4342
4341
// Only do this if the current op isn't legal and the flipped is.
4343
- unsigned Opcode = N->getOpcode();
4344
4342
if (!TLI.isOperationLegal(Opcode, VT) &&
4345
4343
(N0.isUndef() || DAG.SignBitIsZero(N0)) &&
4346
4344
(N1.isUndef() || DAG.SignBitIsZero(N1))) {
0 commit comments