[PATCH] D48130: [AtomicExpandPass]: Add a hook for custom cmpxchg expansion in IR

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 06:22:18 PDT 2018


t.p.northover added a comment.

It seems a bit of a shame to hide that masked expansion away in lib/Target/RISCV when MIPS (at least) needs similar logic. I suppose someone who wants to refactor MIPS can move it out again though.



================
Comment at: include/llvm/CodeGen/TargetLowering.h:1533-1534
+  /// Emits a custom expansion of the AtomicCmpXchg. The implementer has
+  /// responsibility for replacing the passed instruction. Returns the
+  /// appropriately shifted/masked oldval.
+  virtual Value *emitAtomicCmpXchg(IRBuilder<> &Builder,
----------------
The return value is never used, so it might be an idea to remove it. If not, I'm not really convinced by the comment: "appropriately shifted/masked oldval" is both not what actually gets returned and overly specific to RISC-V's reasons for doing it in custom code.


https://reviews.llvm.org/D48130





More information about the llvm-commits mailing list