vectorizer: Guard dump_printf_loc with dump_enabled_p
Fixes a potential crash in the vectorizer by ensuring dump functions are only called when dumping is enabled.
The vectorizer’s dump_printf_loc function was called without checking if dumping was actually enabled, potentially leading to assertions or crashes. This commit adds a guard using dump_enabled_p to ensure dump_printf_loc is only invoked when the debugging output is active, preventing unexpected behavior.
In Details
The vectorizer pass has been corrected to prevent potential crashes originating from dump_printf_loc. This function, used for emitting location information during vectorization, must be guarded by VERIFY_DUMP_ENABLED_P or a similar check (dump_enabled_p). The change in tree-vect-stmts.cc ensures that dump_printf_loc is only called when the global dump flag is set, resolving an assertion failure that could occur otherwise.
- vectorizer
- A compiler optimization pass that transforms scalar code into vector code, allowing operations to be performed on multiple data elements simultaneously using SIMD (Single Instruction, Multiple Data) instructions.
- dump_printf_loc
- A function likely used within GCC's compiler passes to print debugging information related to code locations, potentially including source file, line number, and column.
- dump_enabled_p
- A predicate function or macro that checks if debugging output is currently enabled for the compiler pass or subsystem.