[DAG] computeKnownBits - Move (most) ISD::SRL handling into KnownBits::lshr
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 Nov 2020 17:30:17 +0000 (17:30 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 Nov 2020 17:30:36 +0000 (17:30 +0000)
commitcb798f040a768dbd1fc918fe581088b2fe7932bf
treeed4b34db951ac3f68569c57755d362b5f0af104b
parentc06c02bd1f162cf154996ea064a5d19054a4e364
[DAG] computeKnownBits - Move (most) ISD::SRL handling into KnownBits::lshr

As discussed on D90527, we should be be trying to move shift handling functionality into KnownBits to avoid code duplication in SelectionDAG/GlobalISel/ValueTracking.

The refactor to use the KnownBits fixed/min/max constant helpers allows us to hit a couple of cases that we were missing before.

We still need the getValidMinimumShiftAmountConstant case as KnownBits doesn't handle per-element vector cases.
llvm/include/llvm/Support/KnownBits.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/Support/KnownBits.cpp
llvm/test/CodeGen/AMDGPU/load-constant-i16.ll
llvm/test/CodeGen/AMDGPU/load-global-i16.ll