[PATCH] Check optab before transforming atomic bit test and operations

Jeff Law jeffreyalaw@gmail.com
Mon Nov 15 18:59:16 GMT 2021



On 11/15/2021 6:39 AM, H.J. Lu via Gcc-patches wrote:
> Check optab before transforming equivalent, but slighly different cases
> of atomic bit test and operations to their canonical forms.
>
> gcc/
>
> 	PR middle-end/103184
> 	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Check optab
> 	before transforming equivalent, but slighly different cases to
> 	their canonical forms.
>
> gcc/testsuite/
>
> 	PR middle-end/103184
> 	* gcc.dg/pr103184-1.c: New test.
> 	* gcc.dg/pr103184-2.c: Likewise.

>   	}
>       }
>   
> -  switch (fn)
> -    {
> -    case IFN_ATOMIC_BIT_TEST_AND_SET:
> -      optab = atomic_bit_test_and_set_optab;
> -      break;
> -    case IFN_ATOMIC_BIT_TEST_AND_COMPLEMENT:
> -      optab = atomic_bit_test_and_complement_optab;
> -      break;
> -    case IFN_ATOMIC_BIT_TEST_AND_RESET:
> -      optab = atomic_bit_test_and_reset_optab;
> -      break;
> -    default:
> -      return;
> -    }
> -
>     if (optab_handler (optab, TYPE_MODE (TREE_TYPE (lhs))) == CODE_FOR_nothing)
>       return;
Shouldn't the test of the return value of optab_handler here just go 
away since we're testing it earlier?  OK with that fix.

Jeff


More information about the Gcc-patches mailing list