On 8/20/24 1:14 PM, Andrew Pinski wrote:
The code was assuming that maybe_push_res_to_seq would not fail if the 
gimple_extract_op returned true.
But for some cases when the function is pure rather than const, then it can 
fail.
This change moves around the code to check the result of maybe_push_res_to_seq 
instead of assuming it will
always work.

Changes since v1:
* v2: Instead of directly testing non-pure builtin functions change to test if 
maybe_push_res_to_seq fails.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

        PR  tree-optimization/116409

gcc/ChangeLog:

        * tree-ssa-phiopt.cc (factor_out_conditional_operation): Move
        maybe_push_res_to_seq before creating the phi node and the debug dump.
        Return false if maybe_push_res_to_seq fails.

gcc/testsuite/ChangeLog:

        * gcc.dg/torture/pr116409-1.c: New test.
        * gcc.dg/torture/pr116409-2.c: New test.
OK
jeff

Reply via email to