44std::pair<Constant *, unsigned>
45BinOpSameOpcodeHelper::isBinOpWithConstant(
const Instruction *
I) {
46 [[maybe_unused]]
unsigned Opcode =
I->getOpcode();
55 if (
Constant *
C = GetConstant(BinOp->getOperand(1)))
59 if (Constant *
C = GetConstant(BinOp->getOperand(0)))
64bool BinOpSameOpcodeHelper::InterchangeableInfo::trySet(
65 MaskType OpcodeInMaskForm, MaskType InterchangeableMask) {
66 if (Mask & InterchangeableMask) {
67 SeenBefore |= OpcodeInMaskForm;
68 Mask &= InterchangeableMask;
74unsigned BinOpSameOpcodeHelper::InterchangeableInfo::getOpcode()
const {
75 MaskType Candidate =
Mask & SeenBefore;
76 if (Candidate & MainOpBIT)
77 return I->getOpcode();
78 if (Candidate & ShlBIT)
79 return Instruction::Shl;
80 if (Candidate & AShrBIT)
81 return Instruction::AShr;
82 if (Candidate & MulBIT)
83 return Instruction::Mul;
84 if (Candidate & AddBIT)
85 return Instruction::Add;
86 if (Candidate & SubBIT)
87 return Instruction::Sub;
88 if (Candidate & FAddBIT)
89 return Instruction::FAdd;
90 if (Candidate & FSubBIT)
91 return Instruction::FSub;
92 if (Candidate & AndBIT)
93 return Instruction::And;
94 if (Candidate & OrBIT)
95 return Instruction::Or;
96 if (Candidate & XorBIT)
97 return Instruction::Xor;
101bool BinOpSameOpcodeHelper::InterchangeableInfo::hasCandidateOpcode(
102 unsigned Opcode)
const {
103 MaskType Candidate =
Mask & SeenBefore;
105 case Instruction::Shl:
106 return Candidate & ShlBIT;
107 case Instruction::AShr:
108 return Candidate & AShrBIT;
109 case Instruction::Mul:
110 return Candidate & MulBIT;
111 case Instruction::Add:
112 return Candidate & AddBIT;
113 case Instruction::Sub:
114 return Candidate & SubBIT;
115 case Instruction::And:
116 return Candidate & AndBIT;
117 case Instruction::Or:
118 return Candidate & OrBIT;
119 case Instruction::Xor:
120 return Candidate & XorBIT;
121 case Instruction::FAdd:
122 return Candidate & FAddBIT;
123 case Instruction::FSub:
124 return Candidate & FSubBIT;
125 case Instruction::LShr:
126 case Instruction::FMul:
127 case Instruction::SDiv:
128 case Instruction::UDiv:
129 case Instruction::FDiv:
130 case Instruction::SRem:
131 case Instruction::URem:
132 case Instruction::FRem:
141 const Instruction *To)
const {
143 unsigned FromOpcode =
I->getOpcode();
144 if (FromOpcode == ToOpcode)
147 auto [
C, Pos] = isBinOpWithConstant(
I);
148 Type *RHSType =
I->getOperand(Pos)->getType();
154 "Cannot convert the instruction.");
155 RHS = ConstantFP::get(RHSType, -CFP->getValueAPF());
158 const APInt &FromCIValue = CI->getValue();
159 unsigned FromCIValueBitWidth = FromCIValue.
getBitWidth();
160 switch (FromOpcode) {
161 case Instruction::Shl:
162 if (ToOpcode == Instruction::Add && FromCIValue.
isOne())
163 return {
I->getOperand(0),
I->getOperand(0)};
164 if (ToOpcode == Instruction::Mul) {
165 RHS = ConstantInt::get(RHSType,
169 assert(FromCIValue.
isZero() &&
"Cannot convert the instruction.");
174 case Instruction::Mul:
176 if (ToOpcode == Instruction::Shl) {
177 RHS = ConstantInt::get(
178 RHSType, APInt(FromCIValueBitWidth, FromCIValue.
logBase2()));
180 assert(FromCIValue.
isOne() &&
"Cannot convert the instruction.");
185 case Instruction::Add:
186 case Instruction::Sub:
187 if (FromCIValue.
isZero()) {
192 "Cannot convert the instruction.");
193 APInt NegatedVal = APInt(FromCIValue);
195 RHS = ConstantInt::get(RHSType, NegatedVal);
198 case Instruction::And:
204 assert(FromCIValue.
isZero() &&
"Cannot convert the instruction.");
219bool BinOpSameOpcodeHelper::isValidForAlternation(
const Instruction *
I)
const {
224bool BinOpSameOpcodeHelper::initializeAltOp(
const Instruction *
I) {
227 if (!isValidForAlternation(
I))
235 "BinOpSameOpcodeHelper only accepts BinaryOperator.");
236 unsigned Opcode =
I->getOpcode();
237 MaskType OpcodeInMaskForm;
241 case Instruction::Shl:
242 OpcodeInMaskForm = ShlBIT;
244 case Instruction::AShr:
245 OpcodeInMaskForm = AShrBIT;
247 case Instruction::Mul:
248 OpcodeInMaskForm = MulBIT;
250 case Instruction::Add:
251 OpcodeInMaskForm = AddBIT;
253 case Instruction::Sub:
254 OpcodeInMaskForm = SubBIT;
256 case Instruction::And:
257 OpcodeInMaskForm = AndBIT;
259 case Instruction::Or:
260 OpcodeInMaskForm = OrBIT;
262 case Instruction::Xor:
263 OpcodeInMaskForm = XorBIT;
265 case Instruction::FAdd:
266 OpcodeInMaskForm = FAddBIT;
268 case Instruction::FSub:
269 OpcodeInMaskForm = FSubBIT;
272 return MainOp.equal(Opcode) || (initializeAltOp(
I) && AltOp.equal(Opcode));
274 MaskType InterchangeableMask = OpcodeInMaskForm;
275 auto [
C, Pos] = isBinOpWithConstant(
I);
277 constexpr MaskType CanBeAll =
278 XorBIT | OrBIT | AndBIT | SubBIT | AddBIT | MulBIT | AShrBIT | ShlBIT;
279 const APInt &CIValue = CI->getValue();
281 case Instruction::Shl:
283 InterchangeableMask = CIValue.
isZero() ? CanBeAll : MulBIT | ShlBIT;
285 InterchangeableMask |= AddBIT;
287 case Instruction::Mul:
288 if (CIValue.
isOne()) {
289 InterchangeableMask = CanBeAll;
293 InterchangeableMask = MulBIT | ShlBIT;
295 case Instruction::Add:
296 case Instruction::Sub:
297 InterchangeableMask = CIValue.
isZero() ? CanBeAll : SubBIT | AddBIT;
299 case Instruction::And:
301 InterchangeableMask = CanBeAll;
303 case Instruction::Xor:
305 InterchangeableMask = XorBIT | OrBIT | SubBIT | AddBIT;
309 InterchangeableMask = CanBeAll;
312 }
else if (
C && Pos == 1) {
320 InterchangeableMask = FSubBIT | FAddBIT;
322 return MainOp.trySet(OpcodeInMaskForm, InterchangeableMask) ||
323 (initializeAltOp(
I) &&
324 AltOp.trySet(OpcodeInMaskForm, InterchangeableMask));
329 if (
I->getOpcode() !=
Op->getOpcode())
336 IOp->getIntrinsicID()) !=
342 assert(MainOp &&
"MainOp cannot be nullptr.");
345 if (MainOp->getOpcode() == Instruction::Select &&
349 assert(AltOp &&
"AltOp cannot be nullptr.");
353 if (!
I->isBinaryOp() || !MainOp->isBinaryOp())
360 if (AltConverter.
add(
I) && AltConverter.
add(AltOp) &&
366 return Converter.hasAltOp() ? AltOp : MainOp;
370 constexpr std::array<unsigned, 8> MulDiv = {
371 Instruction::Mul, Instruction::FMul, Instruction::SDiv,
372 Instruction::UDiv, Instruction::FDiv, Instruction::SRem,
373 Instruction::URem, Instruction::FRem};
379 constexpr std::array<unsigned, 4> AddSub = {
380 Instruction::Add, Instruction::Sub, Instruction::FAdd, Instruction::FSub};
386 assert(
valid() &&
"InstructionsState is invalid.");
394 if (
I->getParent() != MainOp->getParent() &&
401 if (!
I->isBinaryOp() || !MainOp->isBinaryOp())
411 (
I->getOpcode() == Instruction::FMul ||
412 I->getOpcode() == Instruction::FAdd) &&
414 return is_contained(VL, Op);
421 (
I->getOpcode() == Instruction::FMul ||
422 I->getOpcode() == Instruction::FAdd) &&
427 bool HasFMulOrFAdd =
false;
428 for (
Value *V : VL) {
436 HasFMulOrFAdd =
true;
438 return HasFMulOrFAdd;
442 assert(
valid() &&
"InstructionsState is invalid.");
448 auto CheckForTransformedOpcode = [](
const Instruction *RefOp,
451 case Instruction::Add:
452 switch (ExpandingOp->getOpcode()) {
453 case Instruction::Shl:
470 return CheckForTransformedOpcode(MainOp, ExpandingOp);
475 switch (
I->getOpcode()) {
476 case Instruction::Shl:
485 assert(
valid() &&
"InstructionsState is invalid.");
495 auto IsNonSchedulableCopyableElement = [
this](
Value *V) {
497 return !
I ||
isa<PHINode>(
I) ||
I->getParent() != MainOp->getParent() ||
502 !MainOp->comesBefore(
I));
505 return IsNonSchedulableCopyableElement(V);
520 for (
Value *V : VL) {
525 if (Inst->getOpcode() == Opcode)
539 BaseOp0 == Op0 || BaseOp1 == Op1 ||
550 "Assessing comparisons of different types?");
560 return (BasePred == Pred &&
562 (BasePred == SwappedPred &&
579 (VL.
size() == 2 && InstCnt < 2))
589 unsigned AltOpcode = Opcode;
592 bool SwappedPredsCompatible = IsCmpOp && [&]() {
594 UniquePreds.
insert(BasePred);
595 UniqueNonSwappedPreds.
insert(BasePred);
596 for (
Value *V : VL) {
603 UniqueNonSwappedPreds.
insert(CurrentPred);
604 if (!UniquePreds.
contains(CurrentPred) &&
605 !UniquePreds.
contains(SwappedCurrentPred))
606 UniquePreds.
insert(CurrentPred);
611 return UniqueNonSwappedPreds.
size() > 2 && UniquePreds.
size() == 2;
623 bool AnyPoison = InstCnt != VL.
size();
636 unsigned InstOpcode =
I->getOpcode();
638 if (BinOpHelper.
add(
I))
643 Value *Op1 =
I->getOperand(0);
646 if (InstOpcode == Opcode || InstOpcode == AltOpcode)
648 if (Opcode == AltOpcode) {
651 "Cast isn't safe for alternation, logic needs to be updated!");
652 AltOpcode = InstOpcode;
659 Type *Ty0 = BaseInst->getOperand(0)->getType();
660 Type *Ty1 = Inst->getOperand(0)->getType();
662 assert(InstOpcode == Opcode &&
"Expected same CmpInst opcode.");
663 assert(InstOpcode == AltOpcode &&
664 "Alternate instructions are only supported by BinaryOperator "
672 if ((VL.
size() == 2 || SwappedPredsCompatible) &&
673 (BasePred == CurrentPred || BasePred == SwappedCurrentPred))
679 if (MainOp != AltOp) {
682 }
else if (BasePred != CurrentPred) {
685 "CmpInst isn't safe for alternation, logic needs to be updated!");
690 if (BasePred == CurrentPred || BasePred == SwappedCurrentPred ||
691 AltPred == CurrentPred || AltPred == SwappedCurrentPred)
694 }
else if (InstOpcode == Opcode) {
695 assert(InstOpcode == AltOpcode &&
696 "Alternate instructions are only supported by BinaryOperator and "
699 if (Gep->getNumOperands() != 2 ||
707 if (!LI->isSimple() || !BaseLI->isSimple())
717 if (
Call->hasOperandBundles() &&
719 !std::equal(
Call->op_begin() +
Call->getBundleOperandsStartIndex(),
720 Call->op_begin() +
Call->getBundleOperandsEndIndex(),
729 if (Mappings.
size() != BaseMappings.
size() ||
730 Mappings.
front().ISA != BaseMappings.
front().ISA ||
731 Mappings.
front().ScalarName != BaseMappings.
front().ScalarName ||
732 Mappings.
front().VectorName != BaseMappings.
front().VectorName ||
733 Mappings.
front().Shape.VF != BaseMappings.
front().Shape.VF ||
734 Mappings.
front().Shape.Parameters !=
735 BaseMappings.
front().Shape.Parameters)
749 assert(MainOp &&
"Cannot find MainOp with Opcode from BinOpHelper.");
751 assert(AltOp &&
"Cannot find AltOp with Opcode from BinOpHelper.");
765 "Incorrect implementation of allSameOpcode.");
772 "Invalid InstructionsState.");
776std::pair<Instruction *, SmallVector<Value *>>
779 assert(SelectedOp &&
"Cannot convert the instruction.");
780 if (
I->isBinaryOp()) {
782 return std::make_pair(SelectedOp,
Converter.getOperand(SelectedOp));
796 assert(MainP != AltP &&
"Expected different main/alternate predicates.");
805 assert((MainP ==
P || AltP ==
P || MainP == SwappedP || AltP == SwappedP) &&
806 "CmpInst expected to match either main or alternate predicate or "
808 return MainP !=
P && MainP != SwappedP;
818 const unsigned NumLanes = VL.
size();
830 if (!
I || !
I->hasOneUse() ||
I->getOpcode() != LaneOpcodes[Lane] ||
841 if (GetChainLink(Lane, Columns[0][Lane]))
843 Instruction *Link = GetChainLink(Lane, Columns[1][Lane]);
846 std::swap(Columns[0][Lane], Columns[1][Lane]);
850 return GetChainLink(Lane, Columns[0][Lane]) !=
nullptr;
854 Instruction *Link = GetChainLink(Lane, Columns[0][Lane]);
863 NewColumn[Lane] = Link->
getOperand(1 - RunningOp);
864 Columns[0][Lane] = Link->
getOperand(RunningOp);
866 Columns.
insert(std::next(Columns.
begin()), std::move(NewColumn));
869 "Normalization guarantees at least one peeled level.");
870 SubLanes.
resize(NumLanes);
872 if (LaneOpcodes[Lane] == Instruction::Sub ||
873 LaneOpcodes[Lane] == Instruction::FSub)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
uint64_t IntrinsicInst * II
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
bool isAllOnes() const
Determine if all bits are set. This is true for zero-width values.
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
unsigned logBase2() const
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
bool isOne() const
Determine if this is a value of 1.
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
This class is the base class for the comparison instructions.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Predicate getPredicate() const
Return the predicate for this instruction.
static LLVM_ABI Constant * getBinOpIdentity(unsigned Opcode, Type *Ty, bool AllowRHSConstant=false, bool NSZ=false)
Return the identity constant for a binary opcode.
This is an important base class in LLVM.
LLVM_ABI bool isCommutative() const LLVM_READONLY
Return true if the instruction is commutative:
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
static bool isFMulAddIntrinsic(Instruction *I)
Returns true if the instruction is a call to the llvm.fmuladd intrinsic.
A vector that has set insertion semantics.
size_type size() const
Determine the number of elements in the SetVector.
bool contains(const_arg_type key) const
Check if the SetVector contains the given key.
bool insert(const value_type &X)
Insert a new element into the SetVector.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
Value * getOperand(unsigned i) const
The Vector Function Database.
static SmallVector< VFInfo, 8 > getMappings(const CallInst &CI)
Retrieve all the VFInfo instances associated to the CallInst CI.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
Helper class that determines VL can use the same opcode.
bool hasDefinedMainOpcode() const
unsigned getAltOpcode() const
bool hasDefinedAltOpcode() const
bool add(const Instruction *I)
bool hasCandidateOpcode(unsigned Opcode) const
Checks if the list of potential opcodes includes Opcode.
unsigned getMainOpcode() const
Main data required for vectorization of instructions.
Instruction * getMainOp() const
Instruction * getMatchingMainOpOrAltOp(Instruction *I) const
Checks if the instruction matches either the main or alternate opcode.
unsigned getAltOpcode() const
static InstructionsState invalid()
static bool isSameOperation(const Instruction *I, const Instruction *Op)
Checks if I is the same operation as Op, distinguishing calls by intrinsic ID (all calls share the Ca...
bool valid() const
Checks if the current state is valid, i.e. has non-null MainOp.
bool isExpandedBinOp(Value *V) const
Checks if the value V is a transformed instruction, compatible either with main or alternate ops.
bool isAddSubLikeOp() const
Checks if main/alt instructions are add/sub/fadd/fsub operations.
bool isExpandedOperand(Instruction *I, unsigned Idx) const
Checks if the operand at index Idx of instruction I is an expanded operand.
bool isCopyableElement(Value *V) const
Checks if the value is a copyable element.
bool isAltShuffle() const
Some of the instructions in the list have alternate opcodes.
Instruction * getAltOp() const
bool isNonSchedulable(Value *V) const
Checks if the value is non-schedulable.
bool isMulDivLikeOp() const
Checks if main/alt instructions are mul/div/rem/fmul/fdiv/frem operations.
unsigned getOpcode() const
The main/alternate opcodes for the list of instructions.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
bool match(Val *V, const Pattern &P)
cst_pred_ty< is_one > m_One()
Match an integer 1 or a vector with all elements equal to 1.
auto m_Value()
Match an arbitrary value and ignore it.
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
A private "module" namespace for types and utilities used by this pass.
SmallVector< SmallVector< Value * > > scanAltAssociativeOperands(const InstructionsState &S, const TargetLibraryInfo &TLI, ArrayRef< Value * > VL, ArrayRef< Value * > Op0, ArrayRef< Value * > Op1, SmallVectorImpl< Value * > &ReassocScalars, SmallBitVector &SubLanes)
Peel the per-lane associative chains of an alternate node into operand columns.
std::pair< Instruction *, SmallVector< Value * > > convertTo(Instruction *I, const InstructionsState &S)
bool isAlternateInstruction(Instruction *I, Instruction *MainOp, Instruction *AltOp, const TargetLibraryInfo &TLI)
Checks if the specified instruction I is an alternate operation for the given MainOp and AltOp instru...
bool allSameOpcode(ArrayRef< Value * > VL)
bool isValidForAlternation(unsigned Opcode)
static bool areCompatibleCmpOps(Value *BaseOp0, Value *BaseOp1, Value *Op0, Value *Op1, const TargetLibraryInfo &TLI)
Checks if the provided operands of 2 cmp instructions are compatible, i.e.
static Instruction * findInstructionWithOpcode(ArrayRef< Value * > VL, unsigned Opcode)
Find an instruction with a specific opcode in VL.
bool hasOnlyAbsorbableCopyableFMulOrFAdds(ArrayRef< Value * > VL)
Checks if every copyable in VL is an absorbable fmul/fadd: the binops die instead of being computed a...
bool isCommutative(const Instruction *I, const Value *ValWithUses, bool IsCopyable)
bool isReassocChainLink(const Instruction *I)
Intrinsic::ID isEquivalentIntrinsicID(Intrinsic::ID LHS, Intrinsic::ID RHS)
Checks if LHS and RHS are the same intrinsic, or one is llvm.fma and the other is llvm....
InstructionsState getSameOpcode(ArrayRef< Value * > VL, const TargetLibraryInfo &TLI)
bool isAbsorbableCopyableFMulOrFAdd(const InstructionsState &S, Value *V)
Checks if V is a copyable single-use fmul/fadd, absorbable as fmuladd(a, b, -0.0) or fmuladd(1....
bool isVectorLikeInstWithConstOps(Value *V)
Checks if V is one of vector-like instructions, i.e.
bool doesNotNeedToBeScheduled(Value *V)
Checks if the specified value does not require scheduling.
bool isConstant(Value *V)
bool isAbsorbableFMulOrFAdd(ArrayRef< Value * > VL, Value *V)
Checks if V is a single-use fmul/fadd with operands outside VL.
static bool isCmpSameOrSwapped(const CmpInst *BaseCI, const CmpInst *CI, const TargetLibraryInfo &TLI)
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI Intrinsic::ID getVectorIntrinsicIDForCall(const CallInst *CI, const TargetLibraryInfo *TLI)
Returns intrinsic ID for call.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto map_to_vector(ContainerTy &&C, FuncTy &&F)
Map a range to a SmallVector with element types deduced from the mapping.
auto binary_search(R &&Range, T &&Value)
Provide wrappers to std::binary_search which take ranges instead of having to pass begin/end explicit...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
auto dyn_cast_or_null(const Y &Val)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID)
Identify if the intrinsic is trivially vectorizable.
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.