[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:08 PDT 2025


================
@@ -4106,6 +4106,8 @@ LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst) {
     return SI->isVolatile();
   if (AtomicRMWInst *AI = dyn_cast<AtomicRMWInst>(P))
     return AI->isVolatile();
+  if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(P))
+    return MI->isVolatile();
   return cast<AtomicCmpXchgInst>(P)->isVolatile();
----------------
nikic wrote:

We could replace this whole function with `cast<Instruction>(P)->isVolatile()`. This would just return false for instructions that don't support volatile.

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


More information about the llvm-commits mailing list