https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108341
--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> --- (In reply to Aldy Hernandez from comment #2) > (In reply to Martin Liška from comment #1) > > May be an opportunity for Ranger? > > Hmmm... I don't think so: > > <bb 2> : > value.0_1 = (unsigned int) value_4(D); > _2 = __builtin_ctz (value.0_1); > r = _2; > _3 = value_4(D) != 0; > _7 = (int) _3; > return _7; > > We could add an op1_range operator to class cfn_clz to return nonzero for > op1, but that would only work if we knew _2 to be anything...and have no > info on _2. Seems more like a candidate for gimpe_infer::gimple_infer (gimple *s). THe side effect to register would be to check if 's' is a builtin_ctz and if so, call add_nonzero (operand1) if whatever those other conditions are are matched which make it true. That should register a non-zero inferred range on value.0_1 after the assignment of _2. =========== BB 2 ============ Partial equiv (value.0_1 pe32 value_4(D)) <bb 2> : value.0_1 = (unsigned int) value_4(D); _2 = __builtin_ctz (value.0_1); r = _2; _3 = value_4(D) != 0; _7 = (int) _3; return _7; I see ranger also registers a 32 bit equivalence between value.0_1 and value_4, so in theory we would then be able to determine that value_4 is also non-zero for the comparison.