Added zext flag for the target RISC-V,
in the passes that convert sext to zext because for RISC-V sext is always cheaper than zext.
Please upload with full context. It's impossible to review most of these changes in the web view otherwise.
|413 ↗||(On Diff #544802)|
I don't think this is correct.
was_sext is supposed to indicate that the sign bit of the input to the zext is known to be 0. Making the zext and sext equivalent. In this case the input is only a single bit, making the input only a sign bit. It is not known to be 0.
|383 ↗||(On Diff #544831)|
I don't think this is correct if we want the semantics of was_sext to be that the input to the zext has its sign bit clear.
This transform is based on the consuming instruction rather than anything about the producer.
|1269 ↗||(On Diff #544831)|
This change seems unnecessary. computeKnownBits should already be able to prove that lshr produces a positive number.
If we want to have this flag explicitly set anytime the sign bit of the input is 0, we should call isKnownNonNegative from visitZExt instead.
|124 ↗||(On Diff #544831)|
This is based on the consumer. That doesn't match the semantic we're trying to have of this bit giving information about the input.
I don't think this is correct for all cases that CanUseZExt returns true. Many of the cases are based on the consumer rather than the producer.