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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to