[PATCH] D85670: [Instruction] Add updateLocationAfterHoist helper

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 16:52:04 PDT 2020


vsk added inline comments.


================
Comment at: llvm/lib/IR/DebugInfo.cpp:723-724
+    // The parent function has no scope. Absent a better alternative, create a
+    // line 0 location with the existing scope/inlinedAt info.
+    setDebugLoc(DebugLoc::get(0, 0, DL.getScope(), DL.getInlinedAt()));
+}
----------------
dblaikie wrote:
> This alternative seems a bit problematic, as it may lead to differences in location depending on the order of inlining, which might be problematic/volatile/unpredictable for developers? but maybe there's no good answer. The other option only seems to be "drop the location entirely" (I think that's correct in the case where it isn't in a function with debug info? IF it gets inlined into such a function, it'll get a location at that point?)
Thanks for the suggestion. I wasn't aware that the inliner provided a location when inlining a call without a location from a function without a subprogram. But I suppose it must, because the inlined call may reference a function that /does/ have a subprogram attached.

Dropping the location seems less arbitrary than preserving the old scope/inlinedAt info.


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

https://reviews.llvm.org/D85670



More information about the llvm-commits mailing list