Skip to content
Snippets Groups Projects
Commit 215355d3 authored by Aldy Hernandez's avatar Aldy Hernandez
Browse files

CCP: handle division by a power of 2 as a right shift.

We have some code in range-ops that sets better maybe nonzero bits for
TRUNC_DIV_EXPR by a power of 2 than CCP does, by just shifting the
mask.  I'd like to offload this functionality into the CCP mask
tracking code, which already does the right thing for right shifts.

The testcase for this change is gcc.dg/tree-ssa/vrp123.c and
gcc.dg/tree-ssa/pr107541.c.

gcc/ChangeLog:

	* range-op.cc (operator_div::fold_range): Call
	update_known_bitmask.
	* tree-ssa-ccp.cc (bit_value_binop): Handle divisions by powers of
	2 as a right shift.
parent cb0a2b1f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment