This patch adds new tests and improves existing ones by: - adding comments and "FIXME"'s, - regular expressions for hard coded names, - remove some existing UB, Related bugs: PR42852, PR887, PR42683
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 35938 Build 35937: arc lint + arc unit
Event Timeline
This looks reasonable to me. I wonder whether the verifier could be extended to ensure that pointer arguments to tail-calling sites don't point within an alloca? It could be useful to enforce even in control-dependent cases ('%Data2 = select %cond, <global>, <alloca>; tail call foo(%Data2)').
The control dependent case you mentioned is not statically verifiable. @reames is building a dynamic poison checker which could include a test for this. Though, I'm unsure if we have the cycles to do this in the near future.
I will now propose a set of "rewrite" patches for the argument promotion pass to improve functionality and fix all the problems, including PR42852, PR42850, PR42683, and PR42039. At the moment, we promote only very few arguments due to lack of functionality (e.g., bitcasts), placement in the pipeline (very late), lack of attribute support (no dereferenceable is derive by default), and conservative limits (unpack structs with <= 3 members only).
So why not land them then? :)
As long as existing tests aren't rewritten but new tests
are added there isn't much point in delaying inevitable.