[DAG] computeKnownBits - Move (most) ISD::SHL handling into KnownBits::shl
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 Nov 2020 13:49:00 +0000 (13:49 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 Nov 2020 14:22:28 +0000 (14:22 +0000)
commitcab21d4fa8c335e002df91ee4736fc05593ed23c
treedfa43c448b1f1bb671a3181331678f4430dad819
parenta5bbefe303140bcbda757f439ebd7664cfbeccb9
[DAG] computeKnownBits - Move (most) ISD::SHL handling into KnownBits::shl

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/PowerPC/pr44183.ll
llvm/test/CodeGen/X86/pr32282.ll