Memcpy created out a loop by LoopIdiom is not marked tailcall
There seems to be possible a small enhancement for lowering memcpy that is created out of a loop by LoopIdiom. It should be identical to the one that was written manually in the original code. However, it differs when either -Os or -Oz is present.
See an example https://godbolt.org/z/116M9PnK9
It may be a backend problem with -Os because LoopIdiom can recognize it in that case, but it fails to do that for -Oz.
GCC produces the same code for that.
@llvm/issue-subscribers-backend-arm
@llvm/issue-subscribers-backend-aarch64
Nothing is marking the memcpy as tailcallable after the loop idiom recognition pass. It looks like TailCallElim usually marks memcpy. But that is only run before the LoopIdiomRecognizer.
If https://reviews.llvm.org/D60031 lands, it should be cheap tu run TailCallMarkPass after loopidiom as well.
@jdoerfert
If https://reviews.llvm.org/D60031 lands, it should be cheap tu run TailCallMarkPass after loopidiom as well.
@jdoerfert
Can someone rebase, test, land the patch? Hideto is not that active anymore and I will at least not have time to do so rn.
I was looking at the similar #47852 and proposed a patch that would just add another round of TailCallElim as-is: https://reviews.llvm.org/D130374
Should be fixed with: bfb9b8e075ee32197157ccaf0c301122ca9b81af
@llvm/issue-subscribers-clang-codegen