[PATCH] D130885: [AtomicExpandPass] Always copy pcsections Metadata to expanded atomics
Marco Elver via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 10:14:26 PDT 2022
melver added inline comments.
================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:130-133
+ // Preserves the DebugLoc from I, and preserves still valid metadata.
+ explicit ReplacementIRBuilder(Instruction *I) : IRBuilder<>(I) {
+ this->CollectMetadataToCopy(I, {LLVMContext::MD_pcsections});
+ }
----------------
arsenm wrote:
> This seems too specific. Why do we need a new IRBuilder subclass just for this? Isn't there already an existing helper for metadata? We could also preserve a lot more metadata, like any aliasing info
There's no existing helper (except CollectMetadataToCopy()) AFAIK.
The alternative is to explicitly add a Builder.CollectMetadataToCopy everywhere, but I felt that this is more concise given it's done everywhere.
This subclass is only available to AtomicExpandPass. I tried to have a local BuildIRBuilder() function, but IR builder doesn't like being copied. Having a subclass that does something extra in the constructor seemed just as elegant and simple.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130885/new/
https://reviews.llvm.org/D130885
More information about the llvm-commits
mailing list