[llvm-bugs] [Bug 25115] New: An odd number can never be zero
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 8 14:58:34 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=25115
Bug ID: 25115
Summary: An odd number can never be zero
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: listmail at philipreames.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
In the example below, we have a loop with an induction variable which
repeatedly wraps around in the <0,17> iteration space. On each iteration, we
have two clamped decrements which reset the value to if 16 if need. Given we
know the loop starts at an even number, we could prove away the second clamp
since a decrement of an even number can not be zero.
declare i1 @unknown(i32)
define void @test() {
bci_21.preheader:
br label %bci_21.us
bci_21.us:
%v33 = phi i32 [ %storemerge.3.us, %bci_21.us ], [ 16, %bci_21.preheader ]
%v46 = icmp eq i32 %v33, 0
%v47 = add nsw i32 %v33, -1
%storemerge.1.us = select i1 %v46, i32 16, i32 %v47
%v62 = icmp eq i32 %storemerge.1.us, 0 ;; <-- Always false
%v63 = add nsw i32 %storemerge.1.us, -1
%storemerge.3.us = select i1 %v62, i32 16, i32 %v63 ;; <-- Always %v63
%cnd = call i1 @unknown(i32 %v33)
br i1 %cnd, label %bci_21.us, label %loopexit
loopexit:
ret void
}
--
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/20151008/4613adaa/attachment.html>
More information about the llvm-bugs
mailing list