[llvm] [LLVM-C] Allow `LLVM{Get,Set}Volatile` to work on memory intrinsics (PR #162810)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 09:01:09 PDT 2025


================
@@ -4117,6 +4119,8 @@ void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) {
     return SI->setVolatile(isVolatile);
   if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
     return AI->setVolatile(isVolatile);
+  if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(P))
+    return MI->setVolatile(ConstantInt::getBool(P->getContext(), isVolatile));
----------------
nikic wrote:

After thinking about this a bit more, I'm not sure we should do this. I am planning to change the volatile representation for memory intrinsics from an argument to an operand bundle. This means that it will no longer be possible to make the intrinsic volatile in-place, it requires creating a new one. So there is a high risk that this support is going to be very short-lived.

https://github.com/llvm/llvm-project/pull/162810


More information about the llvm-commits mailing list