================
@@ -300,12 +316,8 @@ getIRPGONameForGlobalObject(const GlobalObject &GO,
                             GlobalValue::LinkageTypes Linkage,
                             StringRef FileName) {
   SmallString<64> Name;
-  if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
-    Name.append(FileName.empty() ? "<unknown>" : FileName);
-    Name.append(";");
-  }
   Mangler().getNameWithPrefix(Name, &GO, /*CannotUsePrivateLabel=*/true);
----------------
minglotus-6 wrote:

I also thought it was feasible initially. Two kinds of rough edges came up when 
I tried the implementation. (added some comments to document them)
a) `getIRPGONameForGlobalObject` currently mangles names currently, by passing 
global values to `getNameWithPrefix`.`getNameWithPrefix` with [GlobalValue 
parameter](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/include/llvm/IR/Mangler.h#L33-L39)
 makes use of other information (e.g., 
[linkage](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L123-L127),
 
[calling-conv](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L148-L166)
 of functions, etc). `getNameWithPrefix` with stringified names as parameter 
just [use 
names](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L69-L79).
 For parity we might need a `getGlobalIdentifier` that takes global values (not 
just stringified names).
b) `getGlobalIdentifier` gets called in many places, and the `\1` handling 
function in Mangler does [more than dropping 
`\1`](https://github.com/llvm/llvm-project/blob/cf1a979ccfa722c3f9fce28c66c13a222990eac4/llvm/lib/IR/Mangler.cpp#L33-L60),
 so embedding Mangler's way of handling `\1` might affect all callers.



https://github.com/llvm/llvm-project/pull/74008
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to