[TargetLowering] Speculative fix for a non-determinism issue between different compilers. (#190219)

The evaluation order of function arguments is unspecified by the C++
standard. We had two getNode calls as function arguments which causes
the nodes to be created in a different order depending on the compiler
used. This patch moves them to their own variables to ensure they are
called in the same order on all compilers.

Possible fix for #190148.
This commit is contained in:
Craig Topper 2026-04-02 12:12:28 -07:00 committed by GitHub
parent e97a42d5f9
commit e2e5db8401
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11602,10 +11602,10 @@ void TargetLowering::forceExpandMultiply(SelectionDAG &DAG, const SDLoc &dl,
// If HiLHS and HiRHS are set, multiply them by the opposite low part and add
// the products to Hi.
if (HiLHS) {
SDValue RHLL = DAG.getNode(ISD::MUL, dl, VT, HiRHS, LHS);
SDValue RLLH = DAG.getNode(ISD::MUL, dl, VT, RHS, HiLHS);
Hi = DAG.getNode(ISD::ADD, dl, VT, Hi,
DAG.getNode(ISD::ADD, dl, VT,
DAG.getNode(ISD::MUL, dl, VT, HiRHS, LHS),
DAG.getNode(ISD::MUL, dl, VT, RHS, HiLHS)));
DAG.getNode(ISD::ADD, dl, VT, RHLL, RLLH));
}
}