File: rust-avr-bug-112.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (48 lines) | stat: -rw-r--r-- 1,875 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
; RUN: llc < %s -march=avr | FileCheck %s

; The avr-rust bug can be found here:
; https://github.com/avr-rust/rust/issues/112
;
; In this test, the codegen stage generates a FRMIDX
; instruction. Later in the pipeline, the frame index
; gets expanded into a 16-bit MOVWRdRr instruction.
;
; There was a bug in the FRMIDX->MOVWRdRr expansion logic
; that could leave the MOVW instruction with an extraneous
; operand, left over from the original FRMIDX.
;
; This would trigger an assertion:
;
;   Assertion failed: ((isImpReg || Op.isRegMask() || MCID->isVariadic() ||
;                       OpNo < MCID->getNumOperands() || isMetaDataOp) &&
;                       "Trying to add an operand to a machine instr that is already done!"),
;   function addOperand, file llvm/lib/CodeGen/MachineInstr.cpp
;
; The logic has since been fixed.

; CHECK-LABEL: "core::str::slice_error_fail"
define void @"core::str::slice_error_fail"(i16 %arg) personality i32 (...) addrspace(1)* @rust_eh_personality {
start:
  %char_range = alloca { i16, i16 }, align 1
  br i1 undef, label %"<core::option::Option<T>>::unwrap.exit.thread", label %bb11.i.i

"<core::option::Option<T>>::unwrap.exit.thread":
  br label %"core::char::methods::<impl char>::len_utf8.exit"

bb11.i.i:
  %tmp = bitcast { i16, i16 }* %char_range to i8*
  %tmp1 = icmp ult i32 undef, 65536
  %..i = select i1 %tmp1, i16 3, i16 4
  br label %"core::char::methods::<impl char>::len_utf8.exit"

"core::char::methods::<impl char>::len_utf8.exit":
  %tmp2 = phi i8* [ %tmp, %bb11.i.i ], [ undef, %"<core::option::Option<T>>::unwrap.exit.thread" ]
  %_0.0.i12 = phi i16 [ %..i, %bb11.i.i ], [ 1, %"<core::option::Option<T>>::unwrap.exit.thread" ]
  %tmp3 = add i16 %_0.0.i12, %arg
  store i16 %tmp3, i16* undef, align 1
  store i8* %tmp2, i8** undef, align 1
  unreachable
}

declare i32 @rust_eh_personality(...) addrspace(1)