[PATCH] D139209: [IRMover] Remove UB implying parameter attributes when necessary

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 13:45:46 PST 2022


tejohnson added inline comments.


================
Comment at: llvm/lib/Linker/IRMover.cpp:608
+  // The known incompatibilities only apply if `Dst` is a declaration and `Src`
+  // the corresponding definition, ignore other cases.
+  if (Src.isDeclaration() || !Dst.isDeclaration())
----------------
I thought this could only happen if Src's definition is not linked in.

Ah, Src may contain a def but we may not link in that def (depending on whether we decide to invoke linkGlobalValueBody). I believe if the def of Src was linked in, we wouldn't have an issue, since presumably that def would contain the correct attributes? I assume if you remove the "noinline" from inner in the Input file for the test it's def gets linked in - I forget, does that work correctly?

Assuming the answer to the last question above is yes, then I think you would only want to call this when we don't invoke linkGlobalValueBody.

Then I don't think you need or want this if statement at all (we've already checked in the caller that dest is a declaration).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139209/new/

https://reviews.llvm.org/D139209



More information about the llvm-commits mailing list