We have code later on that verifies the code is a comparison. So let's try to catch it earlier. So it is easier to debug where the incorrect code gets set.
Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * gimple.h (gimple_cond_set_code): Add assert of the code being a comparison. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com> --- gcc/gimple.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/gimple.h b/gcc/gimple.h index 977ff1c923c..94d5a13fcb2 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3716,6 +3716,7 @@ gimple_cond_code (const gimple *gs) inline void gimple_cond_set_code (gcond *gs, enum tree_code code) { + gcc_gimple_checking_assert (TREE_CODE_CLASS (code) == tcc_comparison); gs->subcode = code; } -- 2.43.0