[llvm] [IR] Add elementwise modifier to atomic loads (PR #204556)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 01:29:12 PDT 2026


================
@@ -204,14 +205,21 @@ class LoadInst : public UnaryInstruction {
   LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
                     Align Align, AtomicOrdering Order,
                     SyncScope::ID SSID = SyncScope::System,
-                    InsertPosition InsertBefore = nullptr);
+                    InsertPosition InsertBefore = nullptr,
+                    bool IsElementwise = false);
----------------
nikic wrote:

This is adding yet another property that has to be manually copied whenever a load is created based on an old load. You are not updating any of the code doing this right now.

As a preliminary refactoring, I'd like you to introduce something like LoadAttributes that holds all of volatile / order / syncscope and can be copied in one go. That way elementwise will get correctly copied automatically. (Or rather than LoadProperties, generalize so it applies to both loads and stores.)

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


More information about the llvm-commits mailing list