[KnownBits] Move AND, OR and XOR logic into KnownBits
authorJay Foad <jay.foad@amd.com>
Wed, 5 Feb 2020 16:15:53 +0000 (16:15 +0000)
committerJay Foad <jay.foad@amd.com>
Thu, 9 Apr 2020 09:10:37 +0000 (10:10 +0100)
commitc63aed890ecaf686486d6067dc190db7f275afc3
tree891545a2785c2b51ade3e26a5987d79604326fbe
parent340d1119eddaa30446853832c3ad1e95c6ff96dc
[KnownBits] Move AND, OR and XOR logic into KnownBits

Summary:
There are at least three clients for KnownBits calculations:
ValueTracking, SelectionDAG and GlobalISel. To reduce duplication the
common logic should be moved out of these clients and into KnownBits
itself.

This patch does this for AND, OR and XOR calculations by implementing
and using appropriate operator overloads KnownBits::operator& etc.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74060
llvm/include/llvm/Support/KnownBits.h
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Support/KnownBits.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/unittests/Support/KnownBitsTest.cpp