[PATCH] D34629: Add isElementAtomic query method to MemInstrinsic class.

Daniel Neilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 09:08:26 PDT 2017


dneilson created this revision.

We are working towards being able to insert the element unordered atomic memcpy (see: https://reviews.llvm.org/D33240) to the introspection hierarchy as a subclass of MemCpyInst.

This NFC is a first step that introduces a method to the MemIntrinsic class that can be used to query whether, or not, a given memory intrinsic is element atomic; this is being added to MemIntrinsic, rather than MemCpyInst, because the intention is to introduce element atomic memset & memmove intrinsics in the near future as well.

The plan is that future patches will, one at a time, update passes and introduce test cases to ensure that isElementAtomic() of a MemIntrinsic is properly handled -- ensuring fall-through to current behaviour when isElementAtomic() is false, and at least a graceful exit when it returns true. Once that is complete a final change that adds the element atomic memcpy intrinsic as a subclass of MemCpyInst will be proposed that also updates tests to show that passes do the right thing with the element atomic memcpy.


https://reviews.llvm.org/D34629

Files:
  include/llvm/IR/IntrinsicInst.h


Index: include/llvm/IR/IntrinsicInst.h
===================================================================
--- include/llvm/IR/IntrinsicInst.h
+++ include/llvm/IR/IntrinsicInst.h
@@ -357,6 +357,10 @@
       return getArgOperand(3)->getType();
     }
 
+    // Query for whether the instruction is one of the unordered element
+    // atomic variants of memory intrinsic.
+    bool isElementAtomic() const { return false; }
+
     // Methods for support type inquiry through isa, cast, and dyn_cast:
     static inline bool classof(const IntrinsicInst *I) {
       switch (I->getIntrinsicID()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34629.103963.patch
Type: text/x-patch
Size: 595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170626/2465950c/attachment.bin>


More information about the llvm-commits mailing list