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

            Bug ID: 28556
           Summary: [InstCombine] SimplifyDemandedBits makes suboptimal
                    transform
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: spatel+l...@rotateright.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

define i5 @or_3_or_1(i3 %a) {
  %or1 = or i3 %a, 3
  %z = zext i3 %or1 to i5
  %or2 = or i5 %z, 1
  ret i5 %or2
}

The 2nd 'or' is covered by the 1st, but SimplifyDemandedBits calls
ShrinkDemandedConstant and causes this:

$ ./opt -instcombine -S sandwiches.ll 

define i5 @or_3_or_1(i3 %a) {
  %or1 = or i3 %a, 2      <--- shrink constant causing later 'or' to be needed
  %z = zext i3 %or1 to i5
  %or2 = or i5 %z, 1
  ret i5 %or2
}

I don't know if this is working as intended or if this is a bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to