[llvm-bugs] [Bug 35709] New: Missed optimization in math expression: (x+x)/x == 2
llvm-bugs at lists.llvm.org
Wed Dec 20 13:06:03 PST 2017
Bug ID: 35709
Summary: Missed optimization in math expression: (x+x)/x == 2
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: zamazan4ik at tut.by
CC: llvm-bugs at lists.llvm.org
clang (trunk) with '-O3 -std=c++17 -ffast-math -funsafe-math-optimizations' for
int test(int x)
test(int): # @test(int)
lea eax, [rdi + rdi]
Why? In this case we can return simply 2. Because there are only two corner
cases: when x is 0 and we have division by zero (it's UB), and when x+x is
integer overflow (it's also UB).
So we can simply optimize it. There are a lot of similar cases.
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs