[llvm-bugs] [Bug 29163] New: SimplifyCFG: FoldTwoEntryPHINode does not remove metadata.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 28 03:38:28 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=29163

            Bug ID: 29163
           Summary: SimplifyCFG: FoldTwoEntryPHINode does not remove
                    metadata.
           Product: libraries
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: edy.burt at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160828/7616d6da/attachment.html>


More information about the llvm-bugs mailing list