[ValueTracking] Sign bit of shl cannot be both known one and known zero. Fix PR28926
This is to fix PR28296 caused by r278172 (D23296). When inferring the sign bit of a SHL from nsw flag, should update both KnownZero and KnownOne's sign bit. If the result of SHL is known to be non-negative, should set the sign bit of KnownZero to 1 and KnownOne to 0, vice versa. This cannot be implemented in KZF and KOF, because KZF only modifies knownZero and KOF only modifies knownOne.
Also made a little change to computeKnownBitsFromShiftOperator: extract the computeKnownBits(...) for operand 0 to its callsite, so that the "infer sign bit from SHL with nsw" logic can be implemented only at the SHL case.
Shouldn't we just add this logic to the ConstantInt branch above, right before the return?
Then we could teach InstSimplify to xform this into the non-undef arm of the select.