<html>
    <head>
      <base href="https://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 --- - ArgumentPromotion crashing with "An asserting value handle still pointed to this value!""
   href="https://llvm.org/bugs/show_bug.cgi?id=27050">27050</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ArgumentPromotion crashing with "An asserting value handle still pointed to this value!"
          </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>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

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

Running opt with
build-all/bin/opt -S -globals-aa -lcssa -argpromotion argpromo.ll

We get

While deleting: void (%rec*)* %
An asserting value handle still pointed to this value!
UNREACHABLE executed at ../lib/IR/Value.cpp:744!
0  opt             0x00000000016c01b8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  opt             0x00000000016be986 llvm::sys::RunSignalHandlers() + 54
2  opt             0x00000000016c0cea
3  libpthread.so.0 0x00007f6979aff340
4  libc.so.6       0x00007f6978d27cc9 gsignal + 57
5  libc.so.6       0x00007f6978d2b0d8 abort + 328
6  opt             0x000000000167a6cd llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 461
7  opt             0x000000000131ae8e
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 1070
8  opt             0x000000000131a75b llvm::Value::~Value() + 43
9  opt             0x00000000012b443d llvm::Function::~Function() + 525
10 opt             0x00000000012b4689 llvm::Function::~Function() + 9
11 opt             0x000000000134bfcf
12 opt             0x0000000001346cdf
13 opt             0x0000000000eb0c29
14 opt             0x00000000012ebfe5
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 869
15 opt             0x00000000006303ae main + 8670
16 libc.so.6       0x00007f6978d12ec5 __libc_start_main + 245
17 opt             0x000000000061c61c
Stack dump:
0.      Program arguments: build-all/bin/opt -S -globals-aa -lcssa
-argpromotion argpromo.ll 
1.      Running pass 'CallGraph Pass Manager' on module 'argpromo.ll'.
Abort

And if turning on more printouts with "-debug-pass=Executions -debug":

Args: build-all/bin/opt -S -globals-aa -lcssa -argpromotion RM9887.ll
-debug-pass=Executions -debug 
Pass Arguments:  -targetlibinfo -tti -assumption-cache-tracker -basiccg
-globals-aa -domtree -loops -lcssa -basiccg -argpromotion -verify -print-module
Target Library Information
Target Transform Information
Assumption Cache Tracker
  ModulePass Manager
    CallGraph Construction
    Globals Alias Analysis
    FunctionPass Manager
      Dominator Tree Construction
      Natural Loop Information
      Loop-Closed SSA Form Pass
    CallGraph Construction
    Call Graph SCC Pass Manager
      Promote 'by reference' arguments to scalars
      FunctionPass Manager
        Module Verifier
    Print module to stderr
[2016-03-24 10:58:22.427373000] 0x42eced0   Executing Pass 'CallGraph
Construction' on Module 'RM9887.ll'...
[2016-03-24 10:58:22.427617000] 0x42eced0   Executing Pass 'Globals Alias
Analysis' on Module 'RM9887.ll'...
[2016-03-24 10:58:22.427758000] 0x42eced0   Executing Pass 'Function Pass
Manager' on Module 'RM9887.ll'...
[2016-03-24 10:58:22.427828000] 0x42efab0     Executing Pass 'Dominator Tree
Construction' on Function 'bar'...
[2016-03-24 10:58:22.427906000] 0x42efab0     Executing Pass 'Natural Loop
Information' on Function 'bar'...
[2016-03-24 10:58:22.428004000] 0x42efab0     Executing Pass 'Loop-Closed SSA
Form Pass' on Function 'bar'...
[2016-03-24 10:58:22.428082000] 0x42efab0      Freeing Pass 'Dominator Tree
Construction' on Function 'bar'...
[2016-03-24 10:58:22.428148000] 0x42efab0      Freeing Pass 'Loop-Closed SSA
Form Pass' on Function 'bar'...
[2016-03-24 10:58:22.428212000] 0x42efab0      Freeing Pass 'Natural Loop
Information' on Function 'bar'...
[2016-03-24 10:58:22.428276000] 0x42efab0     Executing Pass 'Dominator Tree
Construction' on Function 'foo'...
[2016-03-24 10:58:22.428343000] 0x42efab0     Executing Pass 'Natural Loop
Information' on Function 'foo'...
[2016-03-24 10:58:22.428441000] 0x42efab0     Executing Pass 'Loop-Closed SSA
Form Pass' on Function 'foo'...
[2016-03-24 10:58:22.428530000] 0x42efab0      Freeing Pass 'Dominator Tree
Construction' on Function 'foo'...
[2016-03-24 10:58:22.428597000] 0x42efab0      Freeing Pass 'Loop-Closed SSA
Form Pass' on Function 'foo'...
[2016-03-24 10:58:22.428659000] 0x42efab0      Freeing Pass 'Natural Loop
Information' on Function 'foo'...
[2016-03-24 10:58:22.428724000] 0x42eced0   Executing Pass 'CallGraph
Construction' on Module 'RM9887.ll'...
[2016-03-24 10:58:22.428793000] 0x42eced0   Executing Pass 'CallGraph Pass
Manager' on Module 'RM9887.ll'...
[2016-03-24 10:58:22.428895000] 0x42f0150     Executing Pass 'Promote 'by
reference' arguments to scalars' on Call Graph Nodes 'Call graph node for
function: 'foo'<<0x42f54f0>>  #uses=1

'...
ARG PROMOTION:  Promoting to:
declare internal void @foo()

From: 
define internal void @foo(%rec* %par0) {
  ret void
}
While deleting: void (%rec*)* %
An asserting value handle still pointed to this value!
UNREACHABLE executed at ../lib/IR/Value.cpp:744!

So ArgumentPromotion has tried to rewrite

define internal void @foo(%rec* %par0) {
  ret void
}

to

define internal void @foo() {
  ret void
}

but then when it removes the old version of foo something still has
a handle to it?</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>