diff options
| author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2016-10-06 09:56:21 +0000 |
|---|---|---|
| committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2016-10-06 09:56:21 +0000 |
| commit | 396160392133b09ba29493a158a97436d5f27a45 (patch) | |
| tree | 212c29f5545cc97a7e1e01a206c946a1a9016272 /llvm/lib/Analysis | |
| parent | f9292220dc8f156c0ec042b104e65f45d357b7de (diff) | |
| download | bcm5719-llvm-396160392133b09ba29493a158a97436d5f27a45.tar.gz bcm5719-llvm-396160392133b09ba29493a158a97436d5f27a45.zip | |
[ValueTracking] Teach computeKnownBits and ComputeNumSignBits to look through ExtractElement.
Summary:
The computeKnownBits and ComputeNumSignBits functions in ValueTracking can now do a simple look-through of ExtractElement.
Reviewers: majnemer, spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D24955
llvm-svn: 283434
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index e409edb28fd..64a900d2960 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1389,6 +1389,13 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero, } } break; + case Instruction::ExtractElement: + // Look through extract element. At the moment we keep this simple and skip + // tracking the specific element. But at least we might find information + // valid for all elements of the vector (for example if vector is sign + // extended, shifted, etc). + computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); + break; case Instruction::ExtractValue: if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I->getOperand(0))) { const ExtractValueInst *EVI = cast<ExtractValueInst>(I); @@ -2220,6 +2227,13 @@ unsigned ComputeNumSignBits(const Value *V, unsigned Depth, const Query &Q) { // FIXME: it's tricky to do anything useful for this, but it is an important // case for targets like X86. break; + + case Instruction::ExtractElement: + // Look through extract element. At the moment we keep this simple and skip + // tracking the specific element. But at least we might find information + // valid for all elements of the vector (for example if vector is sign + // extended, shifted, etc). + return ComputeNumSignBits(U->getOperand(0), Depth + 1, Q); } // Finally, if we can prove that the top bits of the result are 0's or 1's, |

