xref: /llvm-project/llvm/test/CodeGen/X86/pr57673.mir (revision cf07277fb47276ba1c3cd661f096098572a6cfb3)
1# RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -run-pass=x86-optimize-LEAs -o - %s | FileCheck %s
2
3# This test case used to trigger the assertion in the LEA optimization pass:
4#
5#   assert(MRI->use_empty(LastVReg) &&
6#          "The LEA's def register must have no uses");
7
8# CHECK:     LEA64r
9# CHECK-NOT: LEA64r
10# CHECK:     DBG_VALUE_LIST
11
12--- |
13  define void @foo() {
14    ret void
15  }
16
17  !0 = !DIFile(filename: "a", directory: "/proc/self/cwd")
18  !1 = distinct !DISubprogram(name: "c", scope: null, file: !0, line: 3)
19  !2 = !DILocalVariable(name: "r", scope: !1, file: !0, line: 4)
20  !3 = !DILocation(line: 5, scope: !1)
21...
22---
23name: foo
24alignment: 16
25tracksRegLiveness: true
26stack:
27  - { id: 0, size: 40, alignment: 8 }
28body: |
29  bb.0:
30    %0:gr64 = LEA64r %stack.0, 1, $noreg, 0, $noreg
31    %1:gr64 = LEA64r %stack.0, 1, $noreg, 40, $noreg
32    DBG_VALUE_LIST !2, !DIExpression(DW_OP_LLVM_arg, 0), %1:gr64, %1:gr64, debug-location !3
33    %2:vr128 = MOVUPSrm %1:gr64, 1, $noreg, 0, $noreg
34    RET64
35...
36