Place the ssa.copy instructions for assumes after the assume, instead of before it. Both options are valid, but placing them afterwards prevents assumes from being replaced with assume(true). This fixes https://bugs.llvm.org/show_bug.cgi?id=37541 in NewGVN and will avoid a similar issue in SCCP when we handle more predicate infos.
Details
Diff Detail
Event Timeline
LGTM, thanks!
llvm/test/Transforms/NewGVN/assumes.ll | ||
---|---|---|
32 | The tests in this file do not seem very useful as is. Could you add uses of the condition in the assume before and after the call to assume, to that we actually make use of the info from the assume properly? It would also be good to add uses for an equivalent icmp (i.e. something like cmp.1 = icmp eq i32 %a, %arg) | |
llvm/test/Transforms/Util/PredicateInfo/testandor.ll | ||
2 | -disable-output instead of referencing /dev/null? |
llvm/test/Transforms/NewGVN/assumes.ll | ||
---|---|---|
32 | Right, these are negative test cases that just happen to show this change. The positive ones are in assume-equal.ll and XFAILed. Probably, NewGVN xfail tests should be split into the parts that actually xfail and the parts that do work. |
The tests in this file do not seem very useful as is.
Could you add uses of the condition in the assume before and after the call to assume, to that we actually make use of the info from the assume properly? It would also be good to add uses for an equivalent icmp (i.e. something like cmp.1 = icmp eq i32 %a, %arg)