Add a new delta pass to llvm-reduce that removes dso_local when possible
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
We are indeed missing reductions of a number of such things, but isn't this a bit too specialized?
I don't know what the solution is (and that is why i didn't touch it), but i'd be hoping for something more generic..
We should probably also try to reduce the linkage & visibility. Although it is not completely clear what 'reduced'/'simpler' means here. But I guess it might make sense to try to set them to the default values? Is this the direction you meant with 'more generic' or reducing other bits of globals as well?
When I'm reducing codegen problems, I tend to make the linkage and visibility stricter since it ends up with fewer machine instructions
The only way to remove dso_local is via GlobalValue::setDSOLocal(), I don't think there is some more generic way to do it.
When reducing, we should decide if we want to reduce to dso_local or the default (dso_preemptable), but we shouldn't just leave it be. Either way is fine to me, although I slightly prefer removing it since it makes the printed IR cleaner, even if that's technically less strict.
We also miss nuw/nsw/inbounds/exact and likely others.
We should also do these, but in a future patch.
Maybe we could have two llvm-reduce modes, one for adding as many restrictive qualifiers as possible, and one for making clean IR that uses defaults as much as possible. IMO more people would rather see defaults than restrictive qualifiers.
Anyway, I think this looks good, we can always easily change the way we reduce in the future.
separately, we should fix up all the headers in llvm-reduce, they're almost all missing include guards
nit: fix formatting?