1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[MetaRenamer] Leave @main alone.

To the best of my knowledge -metarenamer is used in two cases:
1) obfuscate names, when e.g. they contain informations that
can't be shared.
2) Improve clarity of the textual IR for testcases.

One of the usecases if getting the output of `opt` and passing it
to the lli interpreter to run the test. If metarenamer renames
@main, lli can't find an entry point.

llvm-svn: 309657
This commit is contained in:
Davide Italiano 2017-08-01 05:14:45 +00:00
parent a53dfb3621
commit da86042768
2 changed files with 20 additions and 1 deletions

View File

@ -123,7 +123,11 @@ namespace {
TLI.getLibFunc(F, Tmp))
continue;
F.setName(renamer.newName());
// Leave @main alone. The output of -metarenamer might be passed to
// lli for execution and the latter needs a main entry point.
if (Name != "main")
F.setName(renamer.newName());
runOnFunction(F);
}
return true;

View File

@ -0,0 +1,15 @@
; Make sure @main is left untouched.
; RUN: opt -metarenamer -S %s | FileCheck %s
; CHECK: define void @main
; CHECK: call void @main
define void @main() {
call void @patatino()
ret void
}
define void @patatino() {
call void @main()
ret void
}