https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91579
Bug ID: 91579 Summary: tailr1 pass creates redundant phi nodes Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jamborm at gcc dot gnu.org Target Milestone: --- Host: x86_64-linux Target: x86_64-linux When compiling the following testcase (at least at -O2 and higher), the early tail-call pass creates redundant PHI nodes. The problem with them is that ipa-prop then cannot see through them and does not discover that an unchanged scalar argument is passed to another call. As a consequence we lose information in jump functions and may not clone the function when we should. typedef long unsigned int size_t; typedef int (*compare_t)(const void *, const void *); int partition (void *base, size_t nmemb, size_t size, compare_t cmp); void my_qsort (void *base, size_t nmemb, size_t size, compare_t cmp) { int pt; if (nmemb > 1) { pt = partition (base, nmemb, size, cmp); my_qsort (base, pt + 1, size, cmp); my_qsort ((void*)((char*) base + (pt + 1) * size), nmemb - pt - 1, size, cmp); } } Results into: <bb 2> : # base_13 = PHI <base_6(D)(0), _9(3)> # nmemb_11 = PHI <nmemb_7(D)(0), _5(3)> # size_14 = PHI <size_20(D)(0), size_14(3)> # cmp_15 = PHI <cmp_21(D)(0), cmp_15(3)> where the last two PHI nodes are superfluous. (I think I have a patch to address it, let me test it.)