[PATCH] Lower idempotent RMWs to fence+load

JF Bastien jfb at chromium.org
Tue Sep 23 13:53:34 PDT 2014


================
Comment at: include/llvm/Target/TargetLowering.h:1011
@@ +1010,3 @@
+  /// This method tries doing that transformation, returning the atomic load if
+  /// it succeeds, and nullptr otherwise.
+  virtual LoadInst *lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *RMWI) const {
----------------
I still find the interaction between this function and `shouldExpandAtomicLoadInIR` very confusing: it's not clear from this documentation that the implementation of `lowerIdempotentRMWIntoFencedLoad` can return a simple `load atomic` that will then be lowered appropriately if `shouldExpandAtomicLoadInIR` is true.

Overall the code is more understandable, though. I think updating this documentation is good enough.

================
Comment at: lib/CodeGen/AtomicExpandPass.cpp:488
@@ +487,3 @@
+      return false;
+  }
+}
----------------
Leave a FIXME that documents the other optimizations that can be done here.

http://reviews.llvm.org/D5422






More information about the llvm-commits mailing list