[llvm-dev] Status of the function merging pass? (original) (raw)
Davide Italiano via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 31 13:43:47 PST 2019
- Previous message: [llvm-dev] Status of the function merging pass?
- Next message: [llvm-dev] Status of the function merging pass?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jan 31, 2019 at 12:24 PM Shoaib Meenai via llvm-dev <llvm-dev at lists.llvm.org> wrote:
(Disclaimer: I don’t know anything about MergeFunctions; I’m just assuming functionality from the name)
How does MergeFunctions compare to performing identical code folding (ICF) in the linker?
The linker has access to a narrower set of informations, so it can only merge byte-by-byte identical functions, while, in theory, you can imagine that mergefunc could discover equivalences (through VN), and understand that, e.g.
func pat(i32 %blah) {
%0 = sub %blah, 1
ret %0
}
and
func tinky(i32 %blah) {
%0 = add %blah, 0
ret %0
}
are equivalent. Some things to keep in mind:
- My example is relatively silly, but some slightly more elaborate patterns might show up in real code
- I think llvm does enough canonicalization that we should be able to catch these anyways
- I don't think the pass as-is in tree does any equivalence finding, but that's a potential advantage of running this analysis as IR pass.
Thanks,
-- Davide
- Previous message: [llvm-dev] Status of the function merging pass?
- Next message: [llvm-dev] Status of the function merging pass?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]