[PATCH] D39835: [GVN PRE] Clear nsw/nuw for original values in LoadPRE
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 14:30:24 PST 2017
efriedma added a comment.
Sorry, I didn't really look at the jump-threading testcase in the other patch. (In general, it's bad practice to write testcases which involve multiple passes because it confuses the issue you're actually trying to fix.) We don't need to strip the nsw in pre-jt-add.ll from the other patch, and we don't need to strip nsw for this testcase.
The PRE transform in the testcase in this patch can be split into two parts: one, we clone the load and move it into the predecessors, and two, we eliminate the fully redundant loads. Cloning the load is obviously safe: it's the same operation. Eliminating the fully redundant load is also safe: storing the value to memory and loading it does not change it. Stores do not erase poison; you just get poisoned memory.
The only case which causes a problem is if you take the result of an nsw add, and use it instead of the result of a non-nsw add.
https://reviews.llvm.org/D39835
More information about the llvm-commits
mailing list