[llvm] r357999 - [TargetLowering] SimplifyDemandedBits - Remove GetDemandedSrcMask lambda. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 05:29:27 PDT 2019
Author: rksimon
Date: Tue Apr 9 05:29:26 2019
New Revision: 357999
URL: http://llvm.org/viewvc/llvm-project?rev=357999&view=rev
Log:
[TargetLowering] SimplifyDemandedBits - Remove GetDemandedSrcMask lambda. NFCI.
An older version of this could return false but now that this always succeeds we can just inline and simplify it.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=357999&r1=357998&r2=357999&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Tue Apr 9 05:29:26 2019
@@ -1402,37 +1402,30 @@ bool TargetLowering::SimplifyDemandedBit
if (SrcVT.isVector() && NumSrcEltBits > 1 &&
(BitWidth % NumSrcEltBits) == 0 &&
TLO.DAG.getDataLayout().isLittleEndian()) {
- auto GetDemandedSrcMask = [&](APInt &DemandedSrcBits,
- APInt &DemandedSrcElts) -> bool {
- unsigned Scale = BitWidth / NumSrcEltBits;
- unsigned NumSrcElts = SrcVT.getVectorNumElements();
- DemandedSrcBits = APInt::getNullValue(NumSrcEltBits);
- DemandedSrcElts = APInt::getNullValue(NumSrcElts);
- for (unsigned i = 0; i != Scale; ++i) {
- unsigned Offset = i * NumSrcEltBits;
- APInt Sub = DemandedBits.extractBits(NumSrcEltBits, Offset);
- if (!Sub.isNullValue()) {
- DemandedSrcBits |= Sub;
- for (unsigned j = 0; j != NumElts; ++j)
- if (DemandedElts[j])
- DemandedSrcElts.setBit((j * Scale) + i);
- }
+ unsigned Scale = BitWidth / NumSrcEltBits;
+ unsigned NumSrcElts = SrcVT.getVectorNumElements();
+ APInt DemandedSrcBits = APInt::getNullValue(NumSrcEltBits);
+ APInt DemandedSrcElts = APInt::getNullValue(NumSrcElts);
+ for (unsigned i = 0; i != Scale; ++i) {
+ unsigned Offset = i * NumSrcEltBits;
+ APInt Sub = DemandedBits.extractBits(NumSrcEltBits, Offset);
+ if (!Sub.isNullValue()) {
+ DemandedSrcBits |= Sub;
+ for (unsigned j = 0; j != NumElts; ++j)
+ if (DemandedElts[j])
+ DemandedSrcElts.setBit((j * Scale) + i);
}
- return true;
- };
+ }
- APInt DemandedSrcBits, DemandedSrcElts;
- if (GetDemandedSrcMask(DemandedSrcBits, DemandedSrcElts)) {
- APInt KnownSrcUndef, KnownSrcZero;
- if (SimplifyDemandedVectorElts(Src, DemandedSrcElts, KnownSrcUndef,
- KnownSrcZero, TLO, Depth + 1))
- return true;
+ APInt KnownSrcUndef, KnownSrcZero;
+ if (SimplifyDemandedVectorElts(Src, DemandedSrcElts, KnownSrcUndef,
+ KnownSrcZero, TLO, Depth + 1))
+ return true;
- KnownBits KnownSrcBits;
- if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedSrcElts,
- KnownSrcBits, TLO, Depth + 1))
- return true;
- }
+ KnownBits KnownSrcBits;
+ if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedSrcElts,
+ KnownSrcBits, TLO, Depth + 1))
+ return true;
}
// If this is a bitcast, let computeKnownBits handle it. Only do this on a
More information about the llvm-commits
mailing list