[PATCH] D19800: [PR27599] [SystemZ] [SelectionDAG] Fix extension of atomic cmpxchg result.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 05:03:14 PDT 2016


dsanders added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2863
@@ +2862,3 @@
+      RHS = DAG.getNode(ISD::ZERO_EXTEND, dl, OuterType, Node->getOperand(2),
+                        DAG.getValueType(AtomicType));
+      break;
----------------
ISD::ZERO_EXTEND only takes one operand so the `DAG.getValueType(AtomicType)` argument isn't necessary.

================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2872
@@ -2857,3 +2871,3 @@
 
-    Results.push_back(LHS.getValue(0));
+    Results.push_back(ExtRes.getValue(0));
     Results.push_back(Success);
----------------
I'm not sure why the ANY_EXTEND case returns `ExtRes.getValue(0)` instead of `LHS.getValue(0)`. Is there a reason for it?

I'm currently thinking that returning LHS allows SelectionDAG to take advantage of the additional known-zero bits from the zero extend but returning ExtRes allows more scheduling freedom because it can be used before the comparison completes. I'm not sure which is the better choice though.


Repository:
  rL LLVM

http://reviews.llvm.org/D19800





More information about the llvm-commits mailing list