Skip to content
Commit 3b53c602 authored by Kazu Hirata's avatar Kazu Hirata
Browse files

[Mips] Simplify isShiftedUIntAtAnyPosition (NFC)

isShiftedUIntAtAnyPosition never gets zero as the argument because the
caller processes ImmValue satisfying isInt<16>(ImmValue), which
includes zero, long before it calls isShiftedUIntAtAnyPosition.

Given that the argument is always nonzero, findFirstSet is identical
to llvm::countr_zero.  Also, x == x >> BitNum << BitNum is always
true, so we are left with:

  isUInt<N>(x >> llvm::countr_zero(x))

Just in case the caller changes its behavior and starts passing zero
to us, we can protect the shift from undefined behavior "x << 64" by
adding "x &&".
parent bce91024
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment