<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 --- - Assertion failed: (AlreadyScheduled.insert(&GV).second && "Should not reschedule")"
   href="https://llvm.org/bugs/show_bug.cgi?id=27850">27850</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (AlreadyScheduled.insert(&GV).second && "Should not reschedule")
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mehdi.amini@apple.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>Linking the following module into an empty module (llvm-link empty.ll bug.ll)
leads to an assertion:

Assertion failed: (AlreadyScheduled.insert(&GV).second && "Should not
reschedule"), function scheduleMapGlobalInitializer, file
lib/Transforms/Utils/ValueMapper.cpp, line 1009.


target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9"
@A = internal constant i8 1
@B = alias i8, i8* @A
@C = global [2 x i8*] [i8* @A, i8* @B]



It seems that the two maps (ValueMap and AliasValueMap) are not playing well
with each other. We first visit @C, then materialize its initializer, which
lead us to @A, which we schedule to be materialized later, and then move to B
which also scheduled. 
At this point we moved with the worklist and process B first. Since it is an
alias it will be materialized using the AliasValueMap, and we pull the aliasee
@A and schedules it: this is where we hit the assertions because A was already
scheduled.</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>