[LLVMbugs] [Bug 5276] New: instcombine: missed boolean simplification opportunity
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Oct 22 09:32:53 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=5276
Summary: instcombine: missed boolean simplification opportunity
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: edwintorok at gmail.com
CC: llvmbugs at cs.uiuc.edu
The code below is not simplified by instcombine:
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @foo(i32 %a, i32 %b, i32 %c) nounwind {
entry:
%tobool = icmp eq i32 %a, 0 ; <i1> [#uses=1]
%mul.mask = and i32 %b, 2147483647 ; <i32> [#uses=1]
%tobool2 = icmp eq i32 %mul.mask, 0 ; <i1> [#uses=1]
%tobool5 = icmp eq i32 %c, 0 ; <i1> [#uses=1]
%or.cond = or i1 %tobool2, %tobool5 ; <i1> [#uses=1]
%0 = xor i1 %or.cond, true ; <i1> [#uses=1]
%1 = and i1 %tobool, %0 ; <i1> [#uses=1]
br i1 %1, label %UnifiedReturnBlock, label %if.then
if.then: ; preds = %entry
%call = tail call i32 (...)* @bar() nounwind ; <i32> [#uses=0]
ret i32 5
UnifiedReturnBlock: ; preds = %entry
ret i32 4
}
However and (A, xor (or (B, C), 1)) can be transformed to
and(A, and (!B, !C)), and calculating !B and !C is easy, one just needs to flip
the predicate in the icmp.
So instcombine could see if xor(or (A,B), 1) can be transformed into and(!A,
!B)
by flipping predicates in ICMP.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list