Issue 183850
Summary [hexagon] Machine Copy Propagation assertion failure with HVX debug info
Labels bug, backend:Hexagon
Assignees
Reporter androm3da
    The Hexagon backend crashes with an assertion failure in `MachineRegisterInfo::updateDbgUsersToReg` in 21.1.8 when compiling Eigen's `test/packetmath.cpp` at `-O2 -g` targeting HVX v68 128B.

Assertion:

```
llvm/include/llvm/CodeGen/MachineRegisterInfo.h:883:
void llvm::MachineRegisterInfo::updateDbgUsersToReg(
    llvm::MCRegister, llvm::MCRegister, ArrayRef<llvm::MachineInstr *>) const:
Assertion `MI->hasDebugOperandForReg(NewReg) &&
          "Expected debug value to have some overlap with OldReg"' failed.
...
#11 llvm::MachineRegisterInfo::updateDbgUsersToReg  MachineCopyPropagation.cpp:0:0
#12 (anonymous namespace)::MachineCopyPropagation::run  MachineCopyPropagation.cpp:0:0
#13 (anonymous namespace)::MachineCopyPropagationLegacy::runOnMachineFunction  MachineCopyPropagation.cpp:0:0
```

The crash occurs in the `Machine Copy Propagation Pass` on a function performing a 32×32 HVX vector transpose using `V6_vshuffvdd` intrinsics.

The original preprocessed source `compiler_crash_packetmath.cpp` was from Eigen's `packetmath.cpp`.  Reduced with `llvm-extract` / `llvm-reduce` - [eig_packetmath_reduced.ll.txt](https://github.com/user-attachments/files/25615997/eig_packetmath_reduced.ll.txt)

### Reproducer command

```bash
llc -mtriple=hexagon-unknown-linux-musl -mcpu=hexagonv68 \
    -mattr=+hvxv68,+hvx-length128b -O2 -relocation-model=pic \
    -frame-pointer=all -hexagon-small-data-threshold=0 \
    -machine-sink-split=0 eig_packetmath_reduced.ll -o /dev/null
```

- `-strip-debug-info` eliminates the crash.

Originally found in `test/packetmath.cpp` w `-DEIGEN_TEST_PART_1=1` and
`-target hexagon-unknown-linux-musl -mv68 -mhvx -mhvx-length=128B -O2 -g -DNDEBUG -DEIGEN_FAST_MATH=1 -fstrict-aliasing -std=c++14`

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to