Hi, in order to make it possible to vectorize loops running over arrays in Ada, which generally contain index checks, hence control-flow instructions, we rely on loop unswitching to generate two copies of the loop, one guarded with a global condition (no index check fails in the loop) and vectorizable and one with the original index checks and non-vectorizable. This is achieved by the simple trick of prepending the global_condition to the condition of the index checks and letting the loop unswitching pass do its magic. But there is an enemy, namely if-combining, which can turn a simple boolean conjunction into something else that loop unswitching cannot deal with, and a testcase is attached with 3 slightly different versions of the same issue. Therefore the attached patch attempts to tame if-combining by reasoning on the loop invariant status (really loop depths) of the conditions. Bootstrapped/regtested on x86-64/Linux, OK for the mainline? 2021-10-15 Eric Botcazou * tree-ssa-ifcombine.c: Include cfgloop.h. (operand_loop_depth): New function. (ifcombine_ifandif): When loop unswitching is enabled, do not merge conditions whose loop invariant status is different. 2021-10-15 Eric Botcazou * gnat.dg/vect19.ads, gnat.dg/vect19.adb: New test. -- Eric Botcazou