[PATCH] [X86] Don't transform atomic-load-add into an inc/dec when inc/dec is slow

JF Bastien jfb at chromium.org
Wed Oct 8 15:50:42 PDT 2014


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1711
@@ -1710,1 +1710,3 @@
+getAtomicLoadArithTargetConstant(SelectionDAG *CurDAG, SDLoc dl,
+                                 enum AtomicOpc &Op, MVT NVT, SDValue Val) {
   if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Val)) {
----------------
morisset wrote:
> jfb wrote:
> > Can you keep this `static` and pass in the `Subtarget`?
> I could easily do that. I don't see how exactly it would be better, could you explain it to me ?
It makes it easier to understand the side-effects that the function can have: it can't access or modify any of the class' internals. It makes it harder to inadvertently add things like this to the function: you have to pass them in as parameters.

http://reviews.llvm.org/D5678






More information about the llvm-commits mailing list