https://llvm.org/bugs/show_bug.cgi?id=27899
Bug ID: 27899
Summary: failure to convert FP addition loop into a constant
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
If we continue on the path from the realistic (bug 27881, bug 27894) to the
absurd, I think we end here. :)
float OneMeelion() {
float sum = 0.0f;
for (int i = 0; i < 1000; i++)
sum += 1000.0f;
return sum;
}
We don't need fast-math to know this answer.
$ ./clang -O2 OneMeelion.c -S -o -
...
xorps %xmm0, %xmm0
movl $1000, %eax ## imm = 0x3E8
movss LCPI0_0(%rip), %xmm1 ## xmm1 = mem[0],zero,zero,zero
.p2align 4, 0x90
LBB0_1: ## %for.body
## =>This Inner Loop Header: Depth=1
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addss %xmm1, %xmm0
addl $-10, %eax
jne LBB0_1
Surprisingly, this didn't vectorize!
That's because "-Rpass-analysis=loop-vectorize":
remark: loop not vectorized: cannot prove it is safe to reorder floating-point
operations
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs