There is a transform that may replace lshr (x+1), 1 with lshr x, 1 in case
if it can prove that the result will be the same. However the initial instruction
might have an exact flag set, and it now should be dropped unless we prove
that it may hold. Incorrectly set exact attribute may then produce poison.
Details
Diff Detail
Event Timeline
test/Transforms/IndVarSimplify/drop-exact.ll | ||
---|---|---|
8 | I tried playing with that, and I noticed that cases like %tmp21 = add nsw i32 %tmp17, 0 (for which that would have been legal to keep it) get optimized away earlier by other parts of IndVars, so this instruction doesn't live long enough. I will study whether or not it is possible to come here with something like this at all, and if not, I will just remove the check and drop exact unconditionally. |
I'd give this a less generic name, like IsTransformedUDivExact or something like that.