https://bugs.llvm.org/show_bug.cgi?id=35131
Bug ID: 35131
Summary: [LoopIdiomRecognize] Incorrectly recognizes CTLZ
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: i...@azulsystems.com
CC: llvm-bugs@lists.llvm.org
On the following test case loop is recognized as CTLZ, but in fact it is not:
define i32 @ctlz(i32 %n) {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%n.addr.0 = phi i32 [ %n, %entry ], [ %shr, %while.cond ]
%i.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%shr = ashr i32 %n.addr.0, %i.0
%tobool = icmp eq i32 %shr, 0
%inc = add nsw i32 %i.0, 1
br i1 %tobool, label %while.end, label %while.cond
while.end: ; preds = %while.cond
ret i32 %i.0
}
Problem here happens because "ashr i32 %n.addr.0, %i.0" is treated as if it was
"ashr i32 %n.addr.0, which is not true.
--
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