[llvm-bugs] [Bug 28108] New: Scalarizer is crashing

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 13 05:03:35 PDT 2016


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

            Bug ID: 28108
           Summary: Scalarizer is crashing
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16525
  --> https://llvm.org/bugs/attachment.cgi?id=16525&action=edit
Reproducer ll file

opt -S -scalarizer red.ll

gives

opt: ../include/llvm/Support/Casting.h:95: static bool
llvm::isa_impl_cl<llvm::Instruction, const llvm::Value *>::doit(const From *)
[To = llvm::Instruction, From = const llvm::Value *]: Assertion `Val && "isa<>
used on a null pointer"' failed.
#0 0x000000000175e648 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(build-all/bin/opt+0x175e648)
#1 0x000000000175c8c6 llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x175c8c6)
#2 0x000000000175f1ca SignalHandler(int) (build-all/bin/opt+0x175f1ca)
#3 0x00007fdd91ba1330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fdd90dc9c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fdd90dcd028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fdd90dc2bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fdd90dc2ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x00000000016aea11 (anonymous
namespace)::Scalarizer::gather(llvm::Instruction*,
llvm::SmallVector<llvm::Value*, 8u> const&) (build-all/bin/opt+0x16aea11)
#9 0x00000000016ad942 llvm::InstVisitor<(anonymous namespace)::Scalarizer,
bool>::visit(llvm::Instruction&) (build-all/bin/opt+0x16ad942)
#10 0x00000000016aaef3 (anonymous
namespace)::Scalarizer::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x16aaef3)
#11 0x00000000013650f8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x13650f8)
#12 0x000000000136533b llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all/bin/opt+0x136533b)
#13 0x00000000013657f5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x13657f5)
#14 0x0000000000643f40 main (build-all/bin/opt+0x643f40)
#15 0x00007fdd90db4f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#16 0x00000000006346c5 _start (build-all/bin/opt+0x6346c5)
Stack dump:
0.      Program arguments: build-all/bin/opt -S -scalarizer red.ll 
1.      Running pass 'Function Pass Manager' on module 'red.ll'.
2.      Running pass 'Scalarize vector operations' on function '@f4'
Abort

It's a cast in the Scalarizer::gather that crashes:

  // If we already have a scattered form of Op (created from ExtractElements
  // of Op itself), replace them with the new form.
  ValueVector &SV = Scattered[Op];
  if (!SV.empty()) {
    for (unsigned I = 0, E = SV.size(); I != E; ++I) {
      Instruction *Old = cast<Instruction>(SV[I]);
      CV[I]->takeName(Old);
      Old->replaceAllUsesWith(CV[I]);
      Old->eraseFromParent();
    }
  }

SV[I] is null so

      Instruction *Old = cast<Instruction>(SV[I]);

doesn't succeed.

The Scalarizer doesn't say anything with -debug turned on.

Changing the cast to

      Value *V = SV[I];
      if (V == nullptr)
        continue;

      Instruction *Old = cast<Instruction>(V);

makes the program compile but I have no idea if the output is ok then.

-- 
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/20160613/88fd22c5/attachment.html>


More information about the llvm-bugs mailing list