<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 --- - SimplifyCFG: FoldTwoEntryPHINode does not remove metadata."
   href="https://llvm.org/bugs/show_bug.cgi?id=29163">29163</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SimplifyCFG: FoldTwoEntryPHINode does not remove metadata.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </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>Transformation Utilities
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>edy.burt@gmail.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>In this example, SimplifyCFG::FoldTwoEntryPHINode will make the load
unconditional, without removing the !range annotation (which would then kill a
null check, in the original testcase):

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@GV = external constant i64

define i64 @test(i1 %cond) {
entry:
  br i1 %cond, label %if, label %then

then:
  %pti = ptrtoint i64* @GV to i64
  br label %join

if:
  %load = load i64, i64* @GV, align 8, !range !0
  br label %join

join:
  %phi = phi i64 [ %pti, %then ], [ %load, %if ]
  ret i64 %phi
}

!0 = !{i64 1, i64 0}

; -----------------------
; After opt -simplifycfg:
define i64 @test(i1 %cond) {
entry:
  %pti = ptrtoint i64* @GV to i64
  %load = load i64, i64* @GV, align 8, !range !0
  %phi = select i1 %cond, i64 %load, i64 %pti
  ret i64 %phi
}</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>