Skip to content

Commit

Permalink
[GlobalISel] Bail out early for big-endian
Browse files Browse the repository at this point in the history
If we continue through the function we can currently hit crashes. We can bail
out early and fall back to SDAG.
  • Loading branch information
davemgreen committed Aug 13, 2024
1 parent 277ca48 commit d541ac2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3889,6 +3889,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
F.getSubprogram(), &F.getEntryBlock());
R << "unable to translate in big endian mode";
reportTranslationError(*MF, *TPC, *ORE, R);
return false;
}

// Release the per-function state when we return, whether we succeeded or not.
Expand Down
18 changes: 18 additions & 0 deletions llvm/test/CodeGen/AArch64/GlobalISel/endian_fallback.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple aarch64-unknown-linux-musl -O0 < %s | FileCheck %s --check-prefix=CHECK-LE
; RUN: llc -mtriple aarch64_be-unknown-linux-musl -O0 < %s | FileCheck %s --check-prefix=CHECK-BE

; Make sure we fall-back to SDAG for BE targets.

define <4 x i6> @foo(float %0, <4 x i6> %1) {
; CHECK-LE-LABEL: foo:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: fmov d0, d1
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: foo:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: fmov d0, d1
; CHECK-BE-NEXT: ret
ret <4 x i6> %1
}

0 comments on commit d541ac2

Please sign in to comment.