[indvars] Fix lftr crash when preheader is terminated by switch
authorPhilip Reames <listmail@philipreames.com>
Tue, 23 Nov 2021 17:57:30 +0000 (09:57 -0800)
committerPhilip Reames <listmail@philipreames.com>
Tue, 23 Nov 2021 17:58:46 +0000 (09:58 -0800)
commit03d8bc184a3129f0e519bf08ef45f0349cfa1f90
tree885bf5a7a14fd1dd3ba354404ecdb1369ab73d7e
parentc933c2eb334660c131f4afc9d194fafb0cec0423
[indvars] Fix lftr crash when preheader is terminated by switch

This was found by oss-fuzz.  The switch will get canonicalized to a branch, but if it hasn't been when we run LFTR, we crashed on an unneeded assert.
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Transforms/IndVarSimplify/lftr.ll