diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2016-04-08 00:03:51 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2016-04-08 00:03:51 +0000 |
| commit | e0a7ffa6cb4ccb95a22918ea395e7591fe26daf2 (patch) | |
| tree | 169bf5b36f5aa7a81a4ff887923254a5eb8f9edb /llvm/lib/CodeGen | |
| parent | dcf5cf6a29c921757c3b3686299048b82c41a5ea (diff) | |
| download | bcm5719-llvm-e0a7ffa6cb4ccb95a22918ea395e7591fe26daf2.tar.gz bcm5719-llvm-e0a7ffa6cb4ccb95a22918ea395e7591fe26daf2.zip | |
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.
llvm-svn: 265755
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/TargetRegisterInfo.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/TargetRegisterInfo.cpp b/llvm/lib/CodeGen/TargetRegisterInfo.cpp index e1d90cb913e..fc88629b5c8 100644 --- a/llvm/lib/CodeGen/TargetRegisterInfo.cpp +++ b/llvm/lib/CodeGen/TargetRegisterInfo.cpp @@ -112,11 +112,18 @@ TargetRegisterInfo::getAllocatableClass(const TargetRegisterClass *RC) const { 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; } |

