[IVUsers] Check for preheader instead of loop simplify form
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 9 Oct 2021 14:51:52 +0000 (16:51 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 11 Oct 2021 21:13:13 +0000 (23:13 +0200)
commit2a2a37d97207ea7017f1ad9d1312e462c0de9e79
tree3ce7e599c66b332b3bd2c636aebaf331904a801b
parent860b4479dccad323ae22361294e69765c3fdd25f
[IVUsers] Check for preheader instead of loop simplify form

IVUsers currently makes sure that all loops dominating a user are
in loop simplify form, because SCEVExpander needs a preheader to
insert into. However, loop simplify form requires much more than
that. In particular, it requires dedicated exits, which means that
exits need to be found and walked. For large functions with many
nested loops, this can result in pathological compile-time explosion.

Fix this by only checking the property we're actually interested in,
which is incidentally cheap to check.

Differential Revision: https://reviews.llvm.org/D111493
llvm/lib/Analysis/IVUsers.cpp