<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - SROA, address space mishandling, Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed."
   href="http://llvm.org/bugs/show_bug.cgi?id=22239">22239</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SROA, address space mishandling, Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>patrik.h.hagglund@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13691" name="attach_13691" title="testcase">attachment 13691</a> <a href="attachment.cgi?id=13691&action=edit" title="testcase">[details]</a></span>
testcase

This regression was introduced by r225061, [SROA] Teach SROA how to much more
intelligently handle split loads and stores.

Testcase:

target datalayout = "p:16:16-p21:32:16"

%rec221 = type { i16 addrspace(21)*, i32 }

define void @foo() {
  %entry.80 = alloca %rec221
  %1 = bitcast %rec221* %entry.80 to i64*
  %2 = load i64 addrspace(21)* undef
  store i64 %2, i64* %1
  %entry.80.0._tmp337.sroa_idx = getelementptr inbounds %rec221* %entry.80, i16
0, i32 0
  %entry.80.0._tmp338 = load i16 addrspace(21)** %entry.80.0._tmp337.sroa_idx
  ret void
}


<span class="quote">> opt sroa-addrsp.ll -sroa -S -o /dev/null</span >
opt: ../include/llvm/Support/Casting.h:237: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::Value]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
0  opt             0x00000000013acf98 llvm::sys::PrintStackTrace(_IO_FILE*) +
40
1  opt             0x00000000013ae57b
2  libpthread.so.0 0x00007fde4192c810
3  libc.so.6       0x00007fde41147755 gsignal + 53
4  libc.so.6       0x00007fde41148d31 abort + 385
5  libc.so.6       0x00007fde41140610 __assert_fail + 240
6  opt             0x00000000013083ae
7  opt             0x00000000013010d0
8  opt             0x00000000012fd205
9  opt             0x00000000012fab49
10 opt             0x000000000106e63b
llvm::FPPassManager::runOnFunction(llvm::Function&) + 539
11 opt             0x000000000106e8ab
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
12 opt             0x000000000106ee27
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 967
13 opt             0x00000000005c12f3 main + 6419
14 libc.so.6       0x00007fde41133c16 __libc_start_main + 230
15 opt             0x00000000005aecd5
Stack dump:
0.      Program arguments: build-all/bin/opt sroa-addrsp.ll -sroa -S -o
/dev/null
1.      Running pass 'Function Pass Manager' on module 'sroa-addrsp.ll'.
2.      Running pass 'SROA' on function '@foo'
Abort (core dumped)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>