LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 48888 - [X86] MCInst assertion failure "This is not a register operand!"
Summary: [X86] MCInst assertion failure "This is not a register operand!"
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Craig Topper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-26 09:23 PST by Nikita Popov
Modified: 2021-01-27 09:49 PST (History)
6 users (show)

See Also:
Fixed By Commit(s): 74784a5aa47bb8967e5868831e359fa631abe465


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Popov 2021-01-26 09:23:45 PST
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
  
define void @test(i64* %p) nounwind {
bb: 
  %i = load i64, i64* %p, align 8, !range !0
  %i1 = and i64 %i, 6
  %i2 = icmp eq i64 %i1, 2
  br i1 %i2, label %bb3, label %bb5
  
bb3:                                              ; preds = %bb
  %i4 = icmp ne {}* undef, null
  br label %bb5
                  
bb5:                                              ; preds = %bb3, %bb
  br label %bb6
       
bb6:                                              ; preds = %bb5
  br i1 %i2, label %bb7, label %bb9

bb7:                                              ; preds = %bb6
  %i8 = getelementptr inbounds i64, i64* undef, i64 5
  br label %bb9
    
bb9:                                              ; preds = %bb7, %bb6
  ret void
} 
  
!0 = !{i64 0, i64 5}

llc %s:

llc: /home/nikic/llvm-project/llvm/include/llvm/MC/MCInst.h:65: unsigned int llvm::MCOperand::getReg() const: Assertion `isReg() && "This is not a register operand!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: build/bin/llc -debug test135.ll
1.	Running pass 'Function Pass Manager' on module 'test135.ll'.
2.	Running pass 'X86 Assembly Printer' on function '@test'
 #0 0x000055cc218af481 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build/bin/llc+0x2e80481)
 #1 0x000055cc218ad054 llvm::sys::RunSignalHandlers() (build/bin/llc+0x2e7e054)
 #2 0x000055cc218ad1cb SignalHandler(int) (build/bin/llc+0x2e7e1cb)
 #3 0x00007f4b42be53c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x00007f4b4268518b raise /build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f4b42664859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f4b42664729 get_sysdep_segment_value /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f4b42664729 _nl_load_domain /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f4b42675f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #9 0x000055cc20715a88 (anonymous namespace)::X86MCCodeEmitter::emitPrefixImpl(unsigned int&, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) const (build/bin/llc+0x1ce6a88)
#10 0x000055cc2071708f (anonymous namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst const&, llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&, llvm::MCSubtargetInfo const&) const (build/bin/llc+0x1ce808f)
#11 0x000055cc202229ad llvm::X86AsmPrinter::StackMapShadowTracker::count(llvm::MCInst&, llvm::MCSubtargetInfo const&, llvm::MCCodeEmitter*) (.part.0) (build/bin/llc+0x17f39ad)
#12 0x000055cc2022b4f1 llvm::X86AsmPrinter::emitInstruction(llvm::MachineInstr const*) (build/bin/llc+0x17fc4f1)
#13 0x000055cc209bd174 llvm::AsmPrinter::emitFunctionBody() (build/bin/llc+0x1f8e174)
#14 0x000055cc2021c7e3 llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (build/bin/llc+0x17ed7e3)
#15 0x000055cc20bee20c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (build/bin/llc+0x21bf20c)
#16 0x000055cc21082d78 llvm::FPPassManager::runOnFunction(llvm::Function&) (build/bin/llc+0x2653d78)
Comment 1 Craig Topper 2021-01-27 09:48:28 PST
Fixed by 74784a5aa47bb8967e5868831e359fa631abe465
Comment 2 Craig Topper 2021-01-27 09:49:14 PST
And to be clear, I committed it yesterday before the 12.0 branch, I just forgot to close the bug.