[llvm] r265734 - [TargetRegisterInfo] Refactor the code to use BitMaskClassIterator.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 17:57:52 PDT 2016
The original problem should be fixed by r265763 and I recommitted this change in r265764.
> On Apr 7, 2016, at 5:47 PM, Quentin Colombet via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Hi Mike,
>
> I’ve already reverted it in r265755.
>
> I should push a fixed version shortly. (Although we were reading past the buffer we actually do not use the value).
>
> Cheers,
> -Quentin
>
>> On Apr 7, 2016, at 5:29 PM, Mike Aizatsky <aizatsky at google.com <mailto:aizatsky at google.com>> wrote:
>>
>> Quentin,
>>
>> It seems that this change breaks a bot by triggering buffer overflow error:
>>
>> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/11741/steps/check-llvm%20asan/logs/stdio <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/11741/steps/check-llvm%20asan/logs/stdio>
>>
>> Can you confirm?
>>
>> READ of size 4 at 0x000004bc8c90 thread T0
>> #0 0x31925b1 in moveToNextID /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Target/TargetRegisterInfo.h:992:22
>> #1 0x31925b1 in operator++ /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Target/TargetRegisterInfo.h:1049
>> #2 0x31925b1 in llvm::TargetRegisterInfo::getAllocatableClass(llvm::TargetRegisterClass const*) const /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/TargetRegisterInfo.cpp:116
>> #3 0x3f1ba4b in llvm::InstrEmitter::CreateVirtualRegisters(llvm::SDNode*, llvm::MachineInstrBuilder&, llvm::MCInstrDesc const&, bool, bool, llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>, llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:221:7
>> #4 0x3f2745c in llvm::InstrEmitter::EmitMachineNode(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>, llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:789:5
>> #5 0x3c4e6cc in EmitNode /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h:121:7
>> #6 0x3c4e6cc in llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:845
>> #7 0x3e559eb in llvm::SelectionDAGISel::CodeGenAndEmitDAG() /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:877:31
>> #8 0x3e50482 in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1490:7
>> #9 0x3e46770 in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:498:3
>> #10 0xfd9b4d in (anonymous namespace)::ARMDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:75:5
>> #11 0x2e10ecf in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/CodeGen/MachineFunctionPass.cpp:60:13
>> #12 0x353c84c in llvm::FPPassManager::runOnFunction(llvm::Function&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/LegacyPassManager.cpp:1550:23
>> #13 0x353cde5 in llvm::FPPassManager::runOnModule(llvm::Module&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/LegacyPassManager.cpp:1571:16
>> #14 0x353dd12 in runOnModule /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/LegacyPassManager.cpp:1627:23
>> #15 0x353dd12 in llvm::legacy::PassManagerImpl::run(llvm::Module&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/LegacyPassManager.cpp:1730
>> #16 0x742cda in compileModule /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llc/llc.cpp:412:5
>> #17 0x742cda in main /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llc/llc.cpp:218
>> #18 0x7f7ddd0d2ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
>> #19 0x654c5e in _start (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/llc+0x654c5e)
>>
>>
>> On Thu, Apr 7, 2016 at 3:22 PM Quentin Colombet via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> Author: qcolombet
>> Date: Thu Apr 7 17:16:56 2016
>> New Revision: 265734
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=265734&view=rev <http://llvm.org/viewvc/llvm-project?rev=265734&view=rev>
>> Log:
>> [TargetRegisterInfo] Refactor the code to use BitMaskClassIterator.
>>
>> 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=265734&r1=265733&r2=265734&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp?rev=265734&r1=265733&r2=265734&view=diff>
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp Thu Apr 7 17:16:56 2016
>> @@ -112,18 +112,11 @@ TargetRegisterInfo::getAllocatableClass(
>> if (!RC || RC->isAllocatable())
>> return RC;
>>
>> - 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;
>> - }
>> + for (BitMaskClassIterator It(RC->getSubClassMask(), *this); It.isValid();
>> + ++It) {
>> + const TargetRegisterClass *SubRC = getRegClass(It.getID());
>> + if (SubRC->isAllocatable())
>> + return SubRC;
>> }
>> return nullptr;
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>> --
>> Mike
>> Sent from phone
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160407/8c2986db/attachment.html>
More information about the llvm-commits
mailing list