Teach EarlyCSE about invariant.start intrinsic. Specifically, we can perform
store-load, load-load forwarding over this call. Also, keep in mind that we
cannot perform DSE over the call since it reads memory.
Details
Diff Detail
Event Timeline
test/Transforms/EarlyCSE/invariant.start.ll | ||
---|---|---|
50 | Why do you need to prevent DSE here? As written, the program is undefined (since we're changing an invariant location). The only problematic optimization around invariant_(start|end) that I can come up with is stores floating into the invariant region. DSE seems fine, even in case like: *ptr = 100 k = invariant_start(ptr) ;; BODY invariant_end(k, ptr) *ptr = 500 If BODY contains a read from ptr then we won't DSE the first store, but if not, it looks like it is fine to DSE it. |
test/Transforms/EarlyCSE/invariant.start.ll | ||
---|---|---|
50 | So, DSE can take place since anyway the program would be undefined with stores following invariant.start. Also, with invariant_start/end in place, DSE will not take place since invariant_end is still read-write. I think with the CSE optimization, stores cannot float *into* the invariant region. So, I'll remove the lastStore to nullptr and keep the DSE tests. |
test/Transforms/EarlyCSE/invariant.start.ll | ||
---|---|---|
9 | Btw, I think you need a space after the :. |
Btw, I think you need a space after the :.