[llvm-bugs] [Bug 48258] New: Mishandling of uselistorder when there is a user of type blockaddress

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 22 03:19:42 PST 2020


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

            Bug ID: 48258
           Summary: Mishandling of uselistorder when there is a user of
                    type blockaddress
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM assembly language parser
          Assignee: unassignedbugs at nondot.org
          Reporter: itay.bookstein at nextsilicon.com
                CC: llvm-bugs at lists.llvm.org

The issue appears to be caused by trying to sort a uselistorder immediately
after parsing it. This mis-interacts with the blockaddress forward-decl
machinery, because the function is a declaration at this point (i.e. the V that
is passed to LLParser::sortUseListOrder), but the directive contains more
indices than uses which have already been materialized due to the forward-decl
machinery.

Reproduction below:

// repro.ll
@__irsym_main = hidden constant i32 (i32, i8**)* @main
@__irbb_main_LBB1 = hidden constant i8* blockaddress(@main, %main_LBB1)

declare i32 @rand()
declare i32 @putchar(i32)

define internal i32 @main(i32, i8** nocapture readnone) {
  %3 = call i32 @rand()
  %4 = icmp eq i32 %3, 5
  br i1 %4, label %main_LBB1, label %main_LBB2

main_LBB1:
  %5 = call i32 @putchar(i32 104)
  br label %main_LBB2

main_LBB2:
  ret i32 0
}

// repro.sh
bin/verify-uselistorder /local/users/itay/tmp/uselist/my.ll

// OUTPUT:
*** verify-uselistorder ***
verify bitcode
verify assembly
reverse
verify bitcode
verify assembly
verify-uselistorder: /tmp/uselistorder-4df326.ll:8:1: error: value only has one
use
uselistorder i32 (i32, i8**)* @main, { 1, 0 }
^
LLVM ERROR: parsing failed
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: bin/verify-uselistorder
/local/users/itay/tmp/uselist/my.ll
 #0 0x000000000101cf8a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/local/users/itay/Projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:11
 #1 0x000000000101d15b PrintStackTraceSignalHandler(void*)
/local/users/itay/Projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
 #2 0x000000000101b74b llvm::sys::RunSignalHandlers()
/local/users/itay/Projects/llvm-project/llvm/lib/Support/Signals.cpp:70:5
 #3 0x000000000101d8ad SignalHandler(int)
/local/users/itay/Projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
 #4 0x00007f1184672730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #5 0x00007f1183f587bb raise
/build/glibc-vjB4T1/glibc-2.28/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007f1183f43535 abort /build/glibc-vjB4T1/glibc-2.28/stdlib/abort.c:81:7
 #7 0x0000000000f54eb5 (bin/verify-uselistorder+0xf54eb5)
 #8 0x0000000000f54d22
/local/users/itay/Projects/llvm-project/llvm/lib/Support/ErrorHandling.cpp:83:3
 #9 0x00000000009c6104 verifyAfterRoundTrip(llvm::Module const&,
std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >)
/local/users/itay/Projects/llvm-project/llvm/tools/verify-uselistorder/verify-uselistorder.cpp:0:5
#10 0x00000000009c5c1b verifyAssemblyUseListOrder(llvm::Module const&)
/local/users/itay/Projects/llvm-project/llvm/tools/verify-uselistorder/verify-uselistorder.cpp:379:3
#11 0x00000000009c588e verifyUseListOrder(llvm::Module const&)
/local/users/itay/Projects/llvm-project/llvm/tools/verify-uselistorder/verify-uselistorder.cpp:387:1
#12 0x00000000009c568e main
/local/users/itay/Projects/llvm-project/llvm/tools/verify-uselistorder/verify-uselistorder.cpp:568:3
#13 0x00007f1183f4509b __libc_start_main
/build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:342:3
#14 0x00000000009c530a _start (bin/verify-uselistorder+0x9c530a)
fish: “bin/verify-uselistorder /local/…” terminated by signal SIGABRT (Abort)

-- 
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/20201122/b6501d0c/attachment-0001.html>


More information about the llvm-bugs mailing list