[PATCH] D22295: Introduce !splitpoint metadata and GlobalSplit pass.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 21:52:58 PDT 2016


eli.friedman added a subscriber: eli.friedman.
eli.friedman added a comment.

The semantics you've implemented seem extremely dangerous.  You're making some very strong assumptions about how exactly the optimizer manipulates GEPs. I'm not sure whether the optimizer actually breaks this particular construct, but it easily could. The optimizer can and will dig through a ConstantExpr and transform the use into something different.

You could even run into issues with the optimizer manipulating non-ConstantExpr GEPs: for example, the optimizer could transform a series of virtual calls into a loop, then index that loop by the vtable pointer; at that point, splitting the global using the obvious algorithm makes the end pointer point at the wrong global.  (I don't think we do this particular kind of loop re-rolling at the moment, and LSR probably runs after the global splitting pass, but the point is that there are side-effects which have nothing to do with globals.)

------

If you want GEPs with special rules, you should attach metadata to the GEPs or something like that.  A stronger version of inbounds seem more generally useful, anyway; you could use it for other things like alias analysis.


http://reviews.llvm.org/D22295





More information about the llvm-commits mailing list