[llvm] [ADT] Make use of subsetOf and anyCommon methods of BitVector (NFC) (PR #170876)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 02:10:43 PST 2025


================
@@ -274,11 +274,9 @@ static Error randomizeMCOperand(const LLVMState &State,
     break;
   case MCOI::OperandType::OPERAND_REGISTER: {
     assert(Op.isReg());
-    auto AllowedRegs = Op.getRegisterAliasing().sourceBits();
+    const BitVector &AllowedRegs = Op.getRegisterAliasing().sourceBits();
     assert(AllowedRegs.size() == ForbiddenRegs.size());
-    for (auto I : ForbiddenRegs.set_bits())
-      AllowedRegs.reset(I);
-    if (!AllowedRegs.any())
+    if (AllowedRegs.subsetOf(ForbiddenRegs))
----------------
atrosinenko wrote:

Sorry, just spotted that the change in this line is incorrect due to `AllowedRegs` being later used as
```cpp
  AssignedValue = MCOperand::createReg(randomBit(AllowedRegs));
```

https://github.com/llvm/llvm-project/pull/170876


More information about the llvm-commits mailing list