[PATCH] D23268: [EarlyCSE] Teach about CSE'ing over invariant.start intrinsics

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 11:13:08 PDT 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: test/Transforms/EarlyCSE/invariant.start.ll:50
@@ +49,3 @@
+  store i8 50, i8* %P
+  %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %P)
+  store i8 60, i8* %P
----------------
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.


https://reviews.llvm.org/D23268





More information about the llvm-commits mailing list