Hi, This is a prototype patch for propagating known/unknown bits inter-procedurally. for integral types which propagates info obtained from get_nonzero_bits (). Patch required making following changes: a) To make info from get_nonzero_bits() available to ipa, I had to remove guard !nonzero_p in ccp_finalize. However that triggered the following ICE in get_ptr_info() for default_none.f95 (and several other fortran tests) with options: -fopenacc -O2 ICE: http://pastebin.com/KjD7HMQi I confirmed with Richard that this was a latent issue. b) I chose widest_int for representing value, mask in ipcp_bits_lattice and correspondingly changed declarations for bit_value_unop_1/bit_value_binop_1 to take precision and sign instead of type (those are the only two fields that were used). Both these functions are exported by tree-ssa-ccp.h I hope that's ok ? c) Changed streamer_read_wi/streamer_write_wi to non-static. Ah I see Kugan has submitted a patch for this, so I will drop this hunk. d) We have following in tree-ssa-ccp.c:get_default_value (): if (flag_tree_bit_ccp) { wide_int nonzero_bits = get_nonzero_bits (var); if (nonzero_bits != -1) { val.lattice_val = CONSTANT; val.value = build_zero_cst (TREE_TYPE (var)); val.mask = extend_mask (nonzero_bits); } extend_mask() sets all upper bits to 1 in nonzero_bits, ie, varying in terms of bit-ccp. I suppose in tree-ccp we need to extend mask if var is parameter since we don't know in advance what values it will receive from different callers and mark all upper bits as 1 to be safe. However I suppose with ipa, we can determine exactly which bits of parameter are constant and setting all upper bits to 1 will become unnecessary ? For example, consider following artificial test-case: int f(int x) { if (x > 300) return 1; else return 2; } int main(int argc, char **argv) { return f(argc & 0xc) + f (argc & 0x3); } For x, the mask would be meet of: <0, 0xc> meet <0, 0x3> == (0x3 | 0xc) | (0 ^ 0) == 0xf and ipcp_update_bits() sets nonzero_bits for x to 0xf. However get_default_value then calls extend_mask (0xf), resulting in all upper bits being set to 1 and consequently the condition if (x > 300) doesn't get folded. To resolve this, I added a new flag "set_by_ipa" to decl_common, which is set to true if the mask of parameter is determined by ipa-cp, and the condition changes to: if (SSA_NAME_VAR (var) && TREE_CODE (SSA_NAME_VAR (var)) == PARM_DECL && DECL_SET_BY_IPA (SSA_NAME_VAR (var)) val.mask = widest_int::from (nonzero_bits, TYPE_SIGN (TREE_TYPE (SSA_NAME_VAR (var))); else val.mask = extend_mask (nonzero_bits); I am not sure if adding a new flag to decl_common is a good idea. How do other ipa passes deal with this/similar issue ? I suppose we would want to gate this on some flag, say -fipa-bit-cp ? I haven't yet gated it on the flag, will do in next version of patch. I have added some very simple test-cases, I will try to add more meaningful ones. Patch passes bootstrap+test on x86_64-unknown-linux-gnu and cross-tested on arm*-*-* and aarch64*-*-* with the exception of some fortran tests failing due to above ICE. As next steps, I am planning to extend it to handle alignment propagation, and do further testing (lto-bootstrap, chromium). I would be grateful for feedback on the current patch. Thanks, Prathamesh