diff options
author | James Molloy <james.molloy@arm.com> | 2016-05-10 12:27:23 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-05-10 12:27:23 +0000 |
commit | aa1d638800b28e1de11daf6a340f8810ba2e07ac (patch) | |
tree | 411462822ac189eca3d6c1cab78eac8e9dffcb0e /llvm/lib/Analysis/VectorUtils.cpp | |
parent | 1e1e286a6b376d23114923c53cc462601d198c6f (diff) | |
download | bcm5719-llvm-aa1d638800b28e1de11daf6a340f8810ba2e07ac.tar.gz bcm5719-llvm-aa1d638800b28e1de11daf6a340f8810ba2e07ac.zip |
Revert "[VectorUtils] Query number of sign bits to allow more truncations"
This was a fairly simple patch but on closer inspection was seriously flawed and caused PR27690.
This reverts commit r268921.
llvm-svn: 269051
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r-- | llvm/lib/Analysis/VectorUtils.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index 2c03f1a05ce..23a0de856bc 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -320,9 +320,6 @@ llvm::computeMinimumValueSizes(ArrayRef<BasicBlock *> Blocks, DemandedBits &DB, SmallPtrSet<Instruction *, 4> InstructionSet; MapVector<Instruction *, uint64_t> MinBWs; - assert(Blocks.size() > 0 && "Must have at least one block!"); - const DataLayout &DL = Blocks[0]->getModule()->getDataLayout(); - // Determine the roots. We work bottom-up, from truncs or icmps. bool SeenExtFromIllegalType = false; for (auto *BB : Blocks) @@ -366,19 +363,12 @@ llvm::computeMinimumValueSizes(ArrayRef<BasicBlock *> Blocks, DemandedBits &DB, // If we encounter a type that is larger than 64 bits, we can't represent // it so bail out. - APInt NeededBits = DB.getDemandedBits(I); - unsigned BW = NeededBits.getBitWidth(); - if (BW > 64) + if (DB.getDemandedBits(I).getBitWidth() > 64) return MapVector<Instruction *, uint64_t>(); - auto NSB = ComputeNumSignBits(I, DL); - - // Query demanded bits for the bits required by the instruction. Remove - // any bits that are equal to the sign bit, because we can truncate the - // instruction without changing their value. - NeededBits &= APInt::getLowBitsSet(BW, BW - NSB); - DBits[Leader] |= NeededBits.getZExtValue(); - DBits[I] |= NeededBits.getZExtValue(); + uint64_t V = DB.getDemandedBits(I).getZExtValue(); + DBits[Leader] |= V; + DBits[I] = V; // Casts, loads and instructions outside of our range terminate a chain // successfully. |