[llvm] 33feb48 - [Hexagon] Fix PostRA QFP pass crash on pre-v79 targets (#206529)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 12:02:55 PDT 2026
Author: Fateme Hosseini
Date: 2026-06-29T14:02:51-05:00
New Revision: 33feb48f59052e4a93766555d3944a036ef9a15f
URL: https://github.com/llvm/llvm-project/commit/33feb48f59052e4a93766555d3944a036ef9a15f
DIFF: https://github.com/llvm/llvm-project/commit/33feb48f59052e4a93766555d3944a036ef9a15f.diff
LOG: [Hexagon] Fix PostRA QFP pass crash on pre-v79 targets (#206529)
Gate the HexagonPostRAHandleQFP pass to only
run for v79+.
Fixes: https://github.com/llvm/llvm-project/issues/206301
Added:
llvm/test/CodeGen/Hexagon/autohvx/postRA-qfp-v69-no-crash.ll
Modified:
llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index 174d796034992..6171a60f33366 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -495,7 +495,10 @@ void HexagonPassConfig::addPreRegAlloc() {
}
void HexagonPassConfig::addPostRegAlloc() {
- if (EnablePostRAHandleQFP)
+ HexagonTargetMachine &HTM = getHexagonTargetMachine();
+ const HexagonSubtarget *HST = HTM.getHexagonSubtarget();
+ // Run PostRAQFP on v79 and above.
+ if (EnablePostRAHandleQFP && HST->useHVXV79Ops())
addPass(createHexagonPostRAHandleQFP());
if (getOptLevel() != CodeGenOptLevel::None) {
diff --git a/llvm/test/CodeGen/Hexagon/autohvx/postRA-qfp-v69-no-crash.ll b/llvm/test/CodeGen/Hexagon/autohvx/postRA-qfp-v69-no-crash.ll
new file mode 100644
index 0000000000000..1f975b7f6adc8
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/autohvx/postRA-qfp-v69-no-crash.ll
@@ -0,0 +1,21 @@
+; Test that the PostRA QFP handle pass does not crash
+; on <v79 with qfloat intrinsics.
+;
+; REQUIRES: asserts
+; RUN: llc -mtriple=hexagon-unknown-linux-musl -mcpu=hexagonv69 \
+; RUN: -mattr=+hvx-length128b,+hvxv69 -O2 -filetype=obj \
+; RUN: < %s -o /dev/null
+
+define <32 x i32> @main() {
+entry:
+ %0 = tail call <32 x i32> @llvm.hexagon.V6.vadd.qf32.mix.128B(<32 x i32> zeroinitializer, <32 x i32> zeroinitializer)
+ %puts = call i32 @puts()
+ %1 = tail call <32 x i32> @llvm.hexagon.V6.vconv.sf.qf32.128B(<32 x i32> %0)
+ ret <32 x i32> %1
+}
+
+declare <32 x i32> @llvm.hexagon.V6.vadd.qf32.mix.128B(<32 x i32>, <32 x i32>) #0
+declare <32 x i32> @llvm.hexagon.V6.vconv.sf.qf32.128B(<32 x i32>) #0
+declare i32 @puts()
+
+attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
More information about the llvm-commits
mailing list