<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 --- - Reassociate reports change made incorrectly"
   href="https://llvm.org/bugs/show_bug.cgi?id=28208">28208</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Reassociate reports change made incorrectly
          </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>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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>apilipenko@azulsystems.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>Reassociate pass returns true with no change made on the following function:
define i64 @test(i64 %a, i64 %b) {
  %1 = and i64 %b, %a
  ret i64 %1
}

opt -S reassociate.ll -reassociate -debug-pass=Executions

[2016-06-20 08:55:35.332437000] 0x1906670   Executing Pass 'Function Pass
Manager' on Module 'simple.ll'...
[2016-06-20 08:55:35.332704000] 0x1908770     Executing Pass 'Reassociate
expressions' on Function 'test'...
[2016-06-20 08:55:35.333682000] 0x1908770     *Made Modification* 'Reassociate
expressions' on Function 'test'...
[2016-06-20 08:55:35.333792000] 0x1908770      Freeing Pass 'Reassociate
expressions' on Function 'test'...
[2016-06-20 08:55:35.333837000] 0x1908770     Executing Pass 'Module Verifier'
on Function 'test'...
[2016-06-20 08:55:35.334012000] 0x1908770      Freeing Pass 'Module Verifier'
on Function 'test'...
[2016-06-20 08:55:35.334048000] 0x1906670   Made Modification 'Function Pass
Manager' on Module 'simple.ll'...
[2016-06-20 08:55:35.334077000] 0x1906670   Executing Pass 'Print module to
stderr' on Module 'simple.ll'...

It happens because it performs two distinct transformations which nullify each
other (canonicalizeOperands swaps arguments of an and and then
ReassociateExpression swaps them back).</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>