[LLVMbugs] [Bug 24179] New: mem2reg generates incorrect code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 18 15:42:49 PDT 2015


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

            Bug ID: 24179
           Summary: mem2reg generates incorrect code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: sanjoy at playingwithpointers.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Running -mem2reg on

declare i1 @use(i32)

define void @f() {
 entry:
  %t = alloca i32
  br label %loop

 loop:
  %v = load i32, i32* %t
  %c = call i1 @use(i32 %v)
  store i32 46, i32* %t
  store i32 42, i32* %t
  br i1 %c, label %loop, label %exit

 exit:
  ret void
}

gives

declare i1 @use(i32)

define void @f() {
entry:
  br label %loop

loop:                                             ; preds = %loop, %entry
  %c = tail call i1 @use(i32 undef)
  br i1 %c, label %loop, label %exit

exit:                                             ; preds = %loop
  ret void
}

when %c should be undef only on the first iteration and 42 for all subsequent
iterations.

-- 
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/20150718/0dadbcf6/attachment.html>


More information about the llvm-bugs mailing list