|Re: [eigen] Eigen code gets optimized away by avr-g++ - what to do?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
On Fri, Jun 29, 2012 at 5:00 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx>
The code looks simple enough that gcc can calculate the result of v1.norm() at compile-time. You should pass an unknown vector to the function, if you want see whether it actually does anything.
On 29.06.2012 22:21, Ryan Pavlik wrote:
However, I am now seeing quite strange behavior. It looks like Eigen code
(and possibly the rest of the function in which it is used?) gets optimized
out of the compiled binary. (It's so efficient, it doesn't have any code!
:D ) When built by the IDE, it uses -Os optimization (which is -O2 without
the ones deemed to potentially enlarge the code) which triggers the issue.
-O1 optimization doesn't seem to trigger it (by looking at the disassembly,
I actually see a call to sqrtf when my test program calls .norm() on a
vector) though I haven't actually run that code on a device.
I didn't realize GCC was to the point of doing floating-point math at compile time.. In any case, this is just a reduced testcase - I have a longer example program that essentially just returns immediately when the first Eigen call should be made.
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University