[PATCH] D103834: [SCEV] Properly guard reasoning about infinite loops being UB on mustprogress

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 11:05:06 PDT 2021


bjope added a comment.

In D103834#2811372 <https://reviews.llvm.org/D103834#2811372>, @reames wrote:

> The regression for C programs should be addressed in aaaeb4b16 <https://reviews.llvm.org/rGaaaeb4b160fe94e0ad3bcd6073eea4807f84a33a>.  Note that this requires code motion done in b6ee5f2b <https://reviews.llvm.org/rGb6ee5f2b1df66987e65e1b636ba9ae1554b0334b>.

Thanks a lot for all the follow up on the problem I had noticed!

Seems like clang won't add the mustprogress attribute to loops when using C99, so I think we would need to use `-ffinite-loops` to get any help from aaaeb4b16 <https://reviews.llvm.org/rGaaaeb4b160fe94e0ad3bcd6073eea4807f84a33a>.

After examining a bunch of application code I found two cases for which vectorization disappeared when adding this patch, and another case when hwloop analysis failed to derive the trip count by using SCEV.
I will however try D104066 <https://reviews.llvm.org/D104066> , which looks a bit more promising to avoid the regressions I've seen with C99.

(I'll make sure to write some PR:s if something remains also when having applied D104066 <https://reviews.llvm.org/D104066>.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103834/new/

https://reviews.llvm.org/D103834



More information about the llvm-commits mailing list