[KnownBits] Add fast-path for shl with unknown shift amount (NFC)
authorNikita Popov <npopov@redhat.com>
Fri, 26 May 2023 10:09:44 +0000 (12:09 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 26 May 2023 11:57:33 +0000 (13:57 +0200)
commit6f75c6681d47164072daea54dde2727c51b0e739
treef6c0ddf775806c8c2dd08a4753d7639dee755559
parent198a887fcf06a96e717bcaa3e4e0695a093ef270
[KnownBits] Add fast-path for shl with unknown shift amount (NFC)

We currently don't call into KnownBits::shl() from ValueTracking
if the shift amount is unknown. If we do try to do so, we get
significant compile-time regressions, because evaluating all 64
shift amounts if quite expensive, and mostly pointless in this case.
Add a fast-path for the case where the shift amount is the full
[0, BitWidth-1] range. This primarily requires a more accurate
estimate of the max shift amount, to avoid taking the fast-path in
too many cases.

Differential Revision: https://reviews.llvm.org/D151540
llvm/lib/Support/KnownBits.cpp