Davide Italiano via llvm-dev
2016-Apr-20 21:59 UTC
[llvm-dev] Dead (or untested?) code in the gold plugin
If I remove this code,
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 46a5f46..a8978d5 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -428,8 +428,6 @@ getMinVisibility(GlobalValue::VisibilityTypes A,
return A;
if (B == GlobalValue::HiddenVisibility)
return B;
- if (A == GlobalValue::ProtectedVisibility)
- return A;
return B;
}
@@ -520,15 +518,9 @@ static ld_plugin_status claim_file_hook(const
ld_plugin_input_file *file,
Res.IsLinkonceOdr &= GV->hasLinkOnceLinkage();
Res.Visibility = getMinVisibility(Res.Visibility,
GV->getVisibility());
switch (GV->getVisibility()) {
- case GlobalValue::DefaultVisibility:
- sym.visibility = LDPV_DEFAULT;
- break;
case GlobalValue::HiddenVisibility:
sym.visibility = LDPV_HIDDEN;
break;
- case GlobalValue::ProtectedVisibility:
- sym.visibility = LDPV_PROTECTED;
- break;
}
}
all the tests still pass. Is it just dead, or untested?
Thanks,
--
Davide
"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
Rafael EspĂndola via llvm-dev
2016-Apr-24 21:51 UTC
[llvm-dev] Dead (or untested?) code in the gold plugin
> ld_plugin_input_file *file, > Res.IsLinkonceOdr &= GV->hasLinkOnceLinkage(); > Res.Visibility = getMinVisibility(Res.Visibility, GV->getVisibility()); > switch (GV->getVisibility()) { > - case GlobalValue::DefaultVisibility: > - sym.visibility = LDPV_DEFAULT; > - break;This part is actually dead since we have initialized sym.visibility to LDPV_DEFAULT just before the switch. I would still keep it just to have a fully covered switch. Maybe delete just the assignment? I have added tests for the other code parts. Thanks, Rafael
Davide Italiano via llvm-dev
2016-Apr-25 17:25 UTC
[llvm-dev] Dead (or untested?) code in the gold plugin
On Sun, Apr 24, 2016 at 2:51 PM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:>> ld_plugin_input_file *file, >> Res.IsLinkonceOdr &= GV->hasLinkOnceLinkage(); >> Res.Visibility = getMinVisibility(Res.Visibility, GV->getVisibility()); >> switch (GV->getVisibility()) { >> - case GlobalValue::DefaultVisibility: >> - sym.visibility = LDPV_DEFAULT; >> - break; > > This part is actually dead since we have initialized sym.visibility to > LDPV_DEFAULT just before the switch. I would still keep it just to > have a fully covered switch. Maybe delete just the assignment? >r267429> I have added tests for the other code parts. >Thank you. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare