Skip to content

Commit

Permalink
[X86] Use explicit const SDValue& to avoid implicit copy in for-range…
Browse files Browse the repository at this point in the history
… across op_values(). NFC.

Fixes static analysis warning.
  • Loading branch information
RKSimon committed Feb 14, 2024
1 parent 124cd11 commit 786537e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52816,7 +52816,7 @@ static SDValue getInvertedVectorForFMA(SDValue V, SelectionDAG &DAG) {
SmallVector<SDValue, 8> Ops;
EVT VT = V.getValueType();
EVT EltVT = VT.getVectorElementType();
for (auto Op : V->op_values()) {
for (const SDValue &Op : V->op_values()) {
if (auto *Cst = dyn_cast<ConstantFPSDNode>(Op)) {
Ops.push_back(DAG.getConstantFP(-Cst->getValueAPF(), SDLoc(Op), EltVT));
} else {
Expand All @@ -52838,8 +52838,8 @@ static SDValue getInvertedVectorForFMA(SDValue V, SelectionDAG &DAG) {
// prefer one of the values. We prefer a constant with a negative value on
// the first place.
// N.B. We need to skip undefs that may precede a value.
for (auto op : V->op_values()) {
if (auto *Cst = dyn_cast<ConstantFPSDNode>(op)) {
for (const SDValue &Op : V->op_values()) {
if (auto *Cst = dyn_cast<ConstantFPSDNode>(Op)) {
if (Cst->isNegative())
return SDValue();
break;
Expand Down

0 comments on commit 786537e

Please sign in to comment.