This is an archive of the discontinued LLVM Phabricator instance.

[InstCombiner] Simplify lib calls to `round{,f}`
ClosedPublic

Authored by bryant on Dec 25 2016, 2:30 PM.

Details

Summary

From IRC:

12:30:04 -!- Noxbru [~Noxbru@170.red-2-139-2.dynamicip.rima-tde.net] has joined #llvm
12:32:20 < Noxbru> hi, I have a quick question about llvm: is there a way to make the optimizer optimize away the calls to 'round' when the arguments are known constants?
12:33:09 < Noxbru> for example, I have 'round(0.9)' and GCC -O2 simply puts a '1' while clang makes the full call to round
12:33:24 < Noxbru> at least when checking the assembly output
12:36:36 < Noxbru> BTW, this is with clang 3.9.0
12:38:10 < gronsaken> gamester: See the answer from Duncan in this thread https://groups.google.com/forum/#!topic/llvm-dev/uk4uiK93jeM
12:46:48 < davide> Noxbru: missing optimization in SimplifyLibCalls.cpp
12:46:58 < davide> Noxbru: open a bug
12:48:16 < Noxbru> davide: ah, okay, against which component should I file it?
12:48:33 < davide> scalar optimizations
12:48:39 < davide> libraries
12:48:49 < davide> it should be easy to fix, FWIW

Diff Detail

Repository
rL LLVM

Event Timeline

bryant updated this revision to Diff 82480.Dec 25 2016, 2:30 PM
bryant retitled this revision from to [InstCombiner] Simplify lib calls to `round{,f}`.
bryant updated this object.
bryant added reviewers: spatel, RKSimon, majnemer.
bryant set the repository for this revision to rL LLVM.
bryant added a subscriber: llvm-commits.
majnemer accepted this revision.Dec 25 2016, 4:20 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 25 2016, 4:20 PM
This revision was automatically updated to reflect the committed changes.