[llvm-bugs] [Bug 52107] New: "Using an undefined physical register" error after creating bundle

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 7 09:11:36 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52107

            Bug ID: 52107
           Summary: "Using an undefined physical register" error after
                    creating bundle
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: john.brawn at arm.com
                CC: llvm-bugs at lists.llvm.org

Compiling the following:

  define double @fn(i32* %p, float* %q) {
  entry:
    %0 = load i32, i32* %p, align 4
    %cmp = icmp eq i32 %0, 0
    br i1 %cmp, label %if.then, label %if.end

  if.then:
    %1 = load float, float* %q, align 4
    %conv = fpext float %1 to double
    ret double %conv

  if.end:
    call void @unreachable()
    unreachable
  }

  declare void @unreachable() local_unnamed_addr #0
  attributes #0 = { noreturn }

with llc -mtriple=thumbv7-unknown-linux-gnueabihf -verify-machineinstrs tmp.ll
gives the error

*** Bad machine code: Using an undefined physical register ***
- function:    fn
- basic block: %bb.0 entry (0x856788)
- instruction: frame-destroy BUNDLE implicit-def dead $itstate, implicit-def
dead $s0, implicit-def dead $d0, implicit-def $s1, implicit-def $sp,
implicit-def $r7, implicit-def $pc, implicit killed $r1, implicit killed $cpsr,
implicit killed $d0, implicit $sp
- operand 9:   implicit killed $d0

*** Bad machine code: Using an undefined physical register ***
- function:    fn
- basic block: %bb.0 entry (0x856788)
- instruction: renamable $d0 = VCVTDS internal killed renamable $s0, 0, $cpsr,
implicit killed $d0, implicit internal $itstate
- operand 4:   implicit killed $d0

>From a brief look it seems like llvm::finalizeBundle is doing something wrong
when adding the register operands to the BUNDLE, as it has d0 being implicitly
read and killed but d0 only becomes live and then killed within the BUNDLE.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211007/044bb1b1/attachment.html>


More information about the llvm-bugs mailing list