[LLVMbugs] [Bug 16867] New: SROA calls PromoteMemToReg on something it can't handle

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 12 17:14:36 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16867

            Bug ID: 16867
           Summary: SROA calls PromoteMemToReg on something it can't
                    handle
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Testcase module:

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"

%type = type { i8* }

define void @test() {
bb:
  %tmp = alloca i8*, align 4
  unreachable

bb51:
  %tmp52 = bitcast i8** %tmp to %type*
  %tmp53 = bitcast %type* %tmp52 to i8**
  %tmp54 = load i8** %tmp53, align 4
  unreachable
}

Triggers this crash:

$ opt -sroa c.ll
opt: /usr/local/google/home/nlewycky/llvm/include/llvm/Support/Casting.h:239:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
llvm::StoreInst, Y = llvm::Instruction, typename llvm::cast_retty<X,
Y*>::ret_type = llvm::StoreInst*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0  opt             0x000000000199a05f llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  opt             0x000000000199a2e6
2  opt             0x0000000001999d2a
3  libpthread.so.0 0x00007f5afe5e4cb0
4  libc.so.6       0x00007f5afd60f425 gsignal + 53
5  libc.so.6       0x00007f5afd612b8b abort + 379
6  libc.so.6       0x00007f5afd6080ee
7  libc.so.6       0x00007f5afd608192
8  opt             0x00000000012bffd0 llvm::cast_retty<llvm::StoreInst,
llvm::Instruction*>::ret_type llvm::cast<llvm::StoreInst,
llvm::Instruction>(llvm::Instruction*) + 62
9  opt             0x0000000001568994
10 opt             0x0000000001568ea3
11 opt             0x000000000156b3a2
llvm::PromoteMemToReg(llvm::ArrayRef<llvm::AllocaInst*>, llvm::DominatorTree&,
llvm::DataLayout const*, llvm::AliasSetTracker*) + 154
12 opt             0x0000000001432369
13 opt             0x0000000001432c9e
14 opt             0x000000000191f6dc
llvm::FPPassManager::runOnFunction(llvm::Function&) + 390
15 opt             0x000000000191f8d7
llvm::FPPassManager::runOnModule(llvm::Module&) + 89
16 opt             0x000000000191fc4f
llvm::MPPassManager::runOnModule(llvm::Module&) + 573
17 opt             0x0000000001920264 llvm::PassManagerImpl::run(llvm::Module&)
+ 254
18 opt             0x0000000001920477 llvm::PassManager::run(llvm::Module&) +
39
19 opt             0x000000000095bf45 main + 5778
20 libc.so.6       0x00007f5afd5fa76d __libc_start_main + 237
21 opt             0x000000000094dd79
Stack dump:
0.      Program arguments: llvm/Debug+Asserts/bin/opt -sroa c.ll 
1.      Running pass 'Function Pass Manager' on module 'c.ll'.
2.      Running pass 'SROA' on function '@test'
Aborted (core dumped)

>From GDB:

#5  0x0000000001568994 in promoteSingleBlockAlloca (AI=0x29e2068, Info=..., 
    LBI=..., AST=0x0) at PromoteMemoryToRegister.cpp:564
564         StoreInst *SI = cast<StoreInst>(AI->use_back());
(gdb) call AI->use_empty()
$1 = false
(gdb) call AI->use_back() 
$2 = (llvm::Instruction *) 0x29e18b8
(gdb) call AI->use_back()->dump()
  %tmp52 = bitcast i8** %tmp to %type*

-- 
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/20130813/af82a463/attachment.html>


More information about the llvm-bugs mailing list