[PATCH] D37848: [ELF] - Dedupliсate FDEs correctly when two sections are ICFed

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 14:15:30 PDT 2017


ruiu added a comment.

> That is what we already do and it works. I can make synthetic testcase which will break it (can corrupt one of FDEs for example),
>  but synthetic case is probably not the good reason to change current behavior. Especially when we know that gold also just uses one of FDEs,
>  so behavior is probably acceptable.

It may not work, and that's what we are talking about. What gold or other linkers do don't really matter when we are talking about what is the correct behavior.

First of all, no optimization should change any program's defined behavior. Non-safe ICF does not really satisfy as it could break pointer equality, but it is described. It's akin to -ffast-math flag that allows compilers to do unsafe optimizations. But still, it shouldn't break any assumption that is not described. Naturally, it shouldn't change exception handler's behavior, for example.

I wonder if you really understood my point. What I was saying that, if two functions have different FDEs, we probably shouldn't merge these functions because merging them could change their behavior when exception is thrown. We are not talking about the current lld's or gold's behavior but what it should be. Are we on the same page?


https://reviews.llvm.org/D37848





More information about the llvm-commits mailing list