Unswitching does not catch opportunity with -fexperimental-new-pass-manager
| Bugzilla Link | 34313 |
| Version | trunk |
| OS | Linux |
Extended Description
With the following test code:
int has_utf8 = 1; const char AA[] = { 0, 1, 2, 3, 156, 9, 134, 17 };
int main() { long i, count=0, num=22; for (i=0; i<100000000; i++) { num = i % 7; if (!has_utf8 && AA[num] < 0x4) count+=AA[num+1]; } return count; }
we can move the "if (!has_utf8)" outside of the loop and not run the loop at all when has_utf8 = 1. The opportunity is caught correctly with the old pass manager but not with the new one. Found with these options: -m64 -mcpu=power8 -O3 Not found with these ones: -m64 -mcpu=power8 -O3 -fexperimental-new-pass-manager
I did try the new unswitching pass from this patch: https://reviews.llvm.org/D34200 but the compiler still did not find the opportunity.
assigned to @chandlerc