diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2019-09-04 18:59:43 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2019-09-04 18:59:43 +0000 |
commit | b276a9a51e42bc260ff6616112a074d135c5426e (patch) | |
tree | e6917aef05f8051638cebca0fa6fff19e430e9c7 /llvm/lib/CodeGen | |
parent | 6eef8e01c7654acf417d3ad81fb6cb5cfc6edc2f (diff) | |
download | bcm5719-llvm-b276a9a51e42bc260ff6616112a074d135c5426e.tar.gz bcm5719-llvm-b276a9a51e42bc260ff6616112a074d135c5426e.zip |
[globalisel] Support trivial COPY in GISelKnownBits
Summary: Allow GISelKnownBits to look through the trivial case of TargetOpcode::COPY
Reviewers: aditya_nandakumar
Subscribers: rovka, hiraditya, volkan, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67131
llvm-svn: 370955
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 057a32fd1d5..72ffd441233 100644 --- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp @@ -112,6 +112,19 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known, default: TL.computeKnownBitsForTargetInstr(R, Known, DemandedElts, MRI, Depth); break; + case TargetOpcode::COPY: { + MachineOperand Dst = MI.getOperand(0); + MachineOperand Src = MI.getOperand(1); + // Look through trivial copies. + // We can't use NoSubRegister by name as it's defined by each target but + // it's always defined to be 0 by tablegen. + if (Dst.getSubReg() == 0 /*NoSubRegister*/ && Src.getReg().isVirtual() && + Src.getSubReg() == 0 /*NoSubRegister*/) { + // Don't increment Depth for this one since we didn't do any work. + computeKnownBitsImpl(Src.getReg(), Known, DemandedElts, Depth); + } + break; + } case TargetOpcode::G_CONSTANT: { auto CstVal = getConstantVRegVal(R, MRI); Known.One = *CstVal; |