[PATCH] D152437: PowerPC/SPE: Add phony registers for high halves of SPE SuperRegs

Ivan Kosarev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 05:51:14 PDT 2023


kosarev added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCFrameLowering.cpp:2348-2349
+          // Replace Reg if only lower-32 bits modified
+          CSI.erase(CSI.begin() + Idx);
+          CSI.insert(CSI.begin() + Idx, CalleeSavedInfo(Lower));
+        }
----------------
Doesn't this invalidate the (implicit) iterators the `for ()` loop above uses? Can we just do `CSI[Idx] = CalleeSavedInfo(Lower);` instead?

This seems to fail on `CodeGen/PowerPC/spe.ll` on builds with libc++'s consistency checks enabled, <https://github.com/llvm/llvm-project/issues/68594>.

```
******************** TEST 'LLVM :: CodeGen/PowerPC/spe.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/llc -verify-machineinstrs < /home/kosarev/labs/llvm-project/llvm/test/CodeGen/PowerPC/spe.ll -mtriple=powerpc-unknown-linux-gnu           -mattr=+spe | /home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/FileCheck /home/kosarev/labs/llvm-project/llvm/test/CodeGen/PowerPC/spe.ll -check-prefixes=CHECK,SPE
+ /home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu -mattr=+spe
+ /home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/FileCheck /home/kosarev/labs/llvm-project/llvm/test/CodeGen/PowerPC/spe.ll -check-prefixes=CHECK,SPE
/usr/include/c++/11/debug/safe_iterator.h:330:
In function:
    gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>& 
    gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>::operator++() 
    [with _Iterator = gnu_cxx::normal_iterator<llvm::CalleeSavedInfo*, std::
    vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo> > >; 
    _Sequence = std::debug::vector<llvm::CalleeSavedInfo>; _Category = 
    std::forward_iterator_tag]

Error: attempt to increment a singular iterator.

Objects involved in the operation:
    iterator "this" @ 0x7ffec8d10870 {
      state = singular;
      references sequence @ 0x7ffec8d10b80
    }
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu -mattr=+spe
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@test_fma'
 #0 0x00007f4576a916c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/kosarev/labs/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:22
 #1 0x00007f4576a91ae4 PrintStackTraceSignalHandler(void*) /home/kosarev/labs/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00007f4576a8ef29 llvm::sys::RunSignalHandlers() /home/kosarev/labs/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #3 0x00007f4576a90f60 SignalHandler(int) /home/kosarev/labs/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f4576316520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f457636a9fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f457636a9fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007f457636a9fc pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007f4576316476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007f45762fc7f3 abort ./stdlib/abort.c:81:7
#10 0x00007f45765a11fb std::__throw_bad_exception() (/lib/x86_64-linux-gnu/libstdc++.so.6+0xa51fb)
#11 0x00007f4580e2d6c3 __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<llvm::CalleeSavedInfo*, std::__cxx1998::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>>, std::__debug::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>, std::forward_iterator_tag>::operator++() /usr/include/c++/11/debug/safe_iterator.h:333:49
#12 0x00007f4580e2b8da __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<llvm::CalleeSavedInfo*, std::__cxx1998::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>>, std::__debug::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>, std::bidirectional_iterator_tag>::operator++() /usr/include/c++/11/debug/safe_iterator.h:588:10
#13 0x00007f4580e29b7e __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<llvm::CalleeSavedInfo*, std::__cxx1998::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>>, std::__debug::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>, std::random_access_iterator_tag>::operator++() /usr/include/c++/11/debug/safe_iterator.h:743:10
#14 0x00007f4580e240d9 llvm::PPCFrameLowering::assignCalleeSavedSpillSlots(llvm::MachineFunction&, llvm::TargetRegisterInfo const*, std::__debug::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>&) const /home/kosarev/labs/llvm-project/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp:2338:32
#15 0x00007f4580e2751c llvm::TargetFrameLowering::assignCalleeSavedSpillSlots(llvm::MachineFunction&, llvm::TargetRegisterInfo const*, std::__debug::vector<llvm::CalleeSavedInfo, std::allocator<llvm::CalleeSavedInfo>>&, unsigned int&, unsigned int&) const /home/kosarev/labs/llvm-project/llvm/include/llvm/CodeGen/TargetFrameLowering.h:164:3
#16 0x00007f457ae1d03a assignCalleeSavedSpillSlots(llvm::MachineFunction&, llvm::BitVector const&, unsigned int&, unsigned int&) /home/kosarev/labs/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:474:7
#17 0x00007f457ae1e434 (anonymous namespace)::PEI::spillCalleeSavedRegs(llvm::MachineFunction&) /home/kosarev/labs/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:686:24
#18 0x00007f457ae1bc5c (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) /home/kosarev/labs/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:251:43
#19 0x00007f457ab2553c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/kosarev/labs/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:93:33
#20 0x00007f45771dd0e6 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/kosarev/labs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1435:20
#21 0x00007f45771dd496 llvm::FPPassManager::runOnModule(llvm::Module&) /home/kosarev/labs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1481:13
#22 0x00007f45771dd917 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/kosarev/labs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1550:20
#23 0x00007f45771d836e llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/kosarev/labs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:13
#24 0x00007f45771de261 llvm::legacy::PassManager::run(llvm::Module&) /home/kosarev/labs/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1678:1
#25 0x0000555a168b68c8 compileModule(char**, llvm::LLVMContext&) /home/kosarev/labs/llvm-project/llvm/tools/llc/llc.cpp:757:66
#26 0x0000555a168b4117 main /home/kosarev/labs/llvm-project/llvm/tools/llc/llc.cpp:416:35
#27 0x00007f45762fdd90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#28 0x00007f45762fde40 call_init ./csu/../csu/libc-start.c:128:20
#29 0x00007f45762fde40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#30 0x0000555a168b2d65 _start (/home/kosarev/labs/llvm-project/build/debug+expensive_checks/bin/llc+0xfd65)
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152437/new/

https://reviews.llvm.org/D152437



More information about the llvm-commits mailing list