[RISCV] Replace && with ||. Spotted by coverity.
authorCraig Topper <craig.topper@sifive.com>
Sun, 6 Jun 2021 19:48:25 +0000 (12:48 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sun, 6 Jun 2021 20:09:51 +0000 (13:09 -0700)
commit8bde5f06a11d2ed30cc14b4960548d8da7a167b8
treeb274a387390ff3865d49e2193a97107c819fb4f2
parent8ab8b3fad7a6e08452e30aaa3a75d6ec89ca5bf2
[RISCV] Replace && with ||. Spotted by coverity.

We should be exiting when the shift amount is greater than
the bit width regardless of whether it is a power of 2.

Reported by Simon Pilgrim here https://reviews.llvm.org/D96661

This requires getting a shift amount that is out of bounds that
wasn't already optimized by SelectionDAG. This would be pretty
trick to construct a test for.

Or it would require a non-power of 2 shift amount and a mask
that has runs of ones and zeros of the next lowest power of 2 from
that shift amount. I tried a little to produce a test for this,
but didn't get it to work.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp