The const attribute is ignored when simdclone's are used inbranch. This is due to the fact that when analyzing a MASK_CALL we were not looking at the targeted function for flags, but instead only at the internal function call itself. This patch adds code to make sure we look at the target function to check for the const attribute and enables the autovectorization of inbranch const simdclones without needing the loop to be adorned the 'openmp simd' pragma. Not sure about how to add new includes to the ChangeLog. Which brings me to another point, I contemplated changing gimple_call_flags to do the checking of flags of the first argument of IFN_MASK_CALL itself rather than only calling internal_fn_flags on gimple_call_internal_fn (stmt), but that might be a bit too intrusive, opinions welcome :) Bootstrapped and regression tested on aarch64-unknown-linux-gnu and x86_64-pc-linux-gnu. Is this OK for trunk? gcc/ChangeLog: * tree-vect-data-ref.cc (include calls.h): Add new include. (get_references_in_stmt): Correctly handle IFN_MASK_CALL. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-simd-clone-19.c: New test.