[LLVMbugs] [Bug 17564] New: Cannot canonicalize (x & 1) || (x & 2) well

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Oct 13 13:18:23 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17564

            Bug ID: 17564
           Summary: Cannot canonicalize (x & 1) || (x & 2) well
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

On clang-3.3, consider:

define i32 @foo(int)(i32 %x) #0 {
  %1 = and i32 %x, 1
  %2 = icmp eq i32 %1, 0
  br i1 %2, label %3, label %6

; <label>:3                                       ; preds = %0
  %4 = and i32 %x, 2
  %5 = icmp ne i32 %4, 0
  br label %6

; <label>:6                                       ; preds = %0, %3
  %7 = phi i1 [ true, %0 ], [ %5, %3 ]
  %8 = zext i1 %7 to i32
  ret i32 %8
}

this should be canonicalized into:

define i32 @foo(int)(i32 %x) #0 {
  %1 = and i32 %x, 3
  ret i32 %1
}

-- 
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/20131013/0d3e7833/attachment.html>


More information about the llvm-bugs mailing list