[llvm] r265755 - Revert "[TargetRegisterInfo] Refactor the code to use BitMaskClassIterator."
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 17:03:51 PDT 2016
Author: qcolombet
Date: Thu Apr 7 19:03:51 2016
New Revision: 265755
URL: http://llvm.org/viewvc/llvm-project?rev=265755&view=rev
Log:
Revert "[TargetRegisterInfo] Refactor the code to use BitMaskClassIterator."
This reverts commit r265734.
Looks like ASan is not happy about it.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/11741
Looking.
Modified:
llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp
Modified: llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp?rev=265755&r1=265754&r2=265755&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp Thu Apr 7 19:03:51 2016
@@ -112,11 +112,18 @@ TargetRegisterInfo::getAllocatableClass(
if (!RC || RC->isAllocatable())
return RC;
- for (BitMaskClassIterator It(RC->getSubClassMask(), *this); It.isValid();
- ++It) {
- const TargetRegisterClass *SubRC = getRegClass(It.getID());
- if (SubRC->isAllocatable())
- return SubRC;
+ const unsigned *SubClass = RC->getSubClassMask();
+ for (unsigned Base = 0, BaseE = getNumRegClasses();
+ Base < BaseE; Base += 32) {
+ unsigned Idx = Base;
+ for (unsigned Mask = *SubClass++; Mask; Mask >>= 1) {
+ unsigned Offset = countTrailingZeros(Mask);
+ const TargetRegisterClass *SubRC = getRegClass(Idx + Offset);
+ if (SubRC->isAllocatable())
+ return SubRC;
+ Mask >>= Offset;
+ Idx += Offset + 1;
+ }
}
return nullptr;
}
More information about the llvm-commits
mailing list