[PATCH] D41791: [DAG Legalization] Zero-extend the value compared in cmpxchg

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 16:53:06 PST 2018

efriedma added inline comments.

Comment at: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:236
-  SDValue Op2 = GetPromotedInteger(N->getOperand(2));
+  SDValue Op2 = ZExtPromotedInteger(N->getOperand(2));
   SDValue Op3 = GetPromotedInteger(N->getOperand(3));
The value operand to a store is implicitly truncated.  The same thing happens for ATOMIC_LOAD_*.  The same thing happens for the third operand of ATOMIC_CMP_SWAP.  I think it's more confusing than helpful to add a special case for the compare operand of a compare.  Atomic compare-and-swap doesn't zero-extend on all targets, anyway; see getExtendForAtomicOps().



More information about the llvm-commits mailing list