[llvm-bugs] [Bug 30773] New: cmp should be known true (via CVP?)
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 24 11:52:04 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30773
Bug ID: 30773
Summary: cmp should be known true (via CVP?)
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
$ cat cvp.c
void g(int * __attribute((aligned(256))) a, int * __attribute((aligned(256)))
b, int * __attribute((aligned(256))) c, int n) {
for (int i = 0; i < n * 16; ++i)
c[i] = a[i] + b[i];
}
$ ./clang -O2 cvp.c -S -emit-llvm -o -
define void @g(i32* nocapture readonly %a, i32* nocapture readonly %b, i32*
nocapture %c, i32 %n) local_unnamed_addr #0 {
entry:
%cmp10 = icmp sgt i32 %n, 0
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader:
%mul = shl nsw i32 %n, 4 <--- %n is positive; %mul must be positive (nsw)
%0 = sext i32 %mul to i64
%1 = icmp sgt i64 %0, 1 <--- so this must be true
%smax = select i1 %1, i64 %0, i64 1 <--- and this shouldn't be needed
...
Is this a deficiency of correlated value propagation?
--
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/20161024/043561f5/attachment.html>
More information about the llvm-bugs
mailing list