x86 cogen quality

Chris Lattner wrote:

I think that we should switch to C constants in this case. Can you try
#include <math.h> and use HUGE_VAL instead?

It works:

[finna@coplin11 ~/test]$ cat tst.cpp
#include <limits>
#include <iostream>
#include <math.h>
int main() {
  std::cerr << std::numeric_limits<float>::infinity() << "\n";
  std::cerr << HUGE_VAL << "\n";
}
[finna@coplin11 ~/test]$ g++ tst.cpp
[finna@coplin11 ~/test]$ ./a.out
0
inf
[finna@coplin11 ~/test]$

But making the consequential changes in LLVM seems trickier.
Do you plan to correct it in CVS, or is there a path I can follow
to fix it myself on my own installation ?

Best regard
/Finn

The easy way to do it in your area is to replace all occurences of
std::numeric_limits<float>::infinity() with HUGE_VAL. The only two files
that use std::numeric_limits<float>::infinity() are
lib/CodeGen/RegAllocLinearScan.cpp and lib/CodeGen/LiveIntervals.cpp.

As for CVS, I am not sure this should be fixed because there is
really no LLVM bug here :slight_smile:

Alkis Evlogimenos wrote:

As for CVS, I am not sure this should be fixed because there is really no LLVM bug here :slight_smile:

No, you are right. But perhaps it is worth it to mention the problem
somewhere in the documentation, because there appear to be many
installations with this problem (I've found 3: my home installation,
my work and the nearest university), and it is tricky unless you
know where to look.

Thank you all very much for your assistance.
Best regards,
/Finn

Alkis Evlogimenos wrote:

>As for CVS, I am not sure this should be fixed because there is
>really no LLVM bug here :slight_smile:
>
>
>
No, you are right. But perhaps it is worth it to mention the problem
somewhere in the documentation, because there appear to be many
installations with this problem (I've found 3: my home installation,
my work and the nearest university), and it is tricky unless you
know where to look.

That or even better add configure macros to detect (and maybe fix) this
kind of problems. As always, providing a patch will speed up the process
:wink:

Thank you all very much for your assistance.

You are very welcome.

While this is not an LLVM bug, if Finn has run into it, other people
probably will too. I've fixed it in CVS: if you update llvm/lib/CodeGen
and rebuild, hopefully linscan will magically work for Finn now. :slight_smile:

-Chris

Chris Lattner wrote:

While this is not an LLVM bug, if Finn has run into it, other people
probably will too. I've fixed it in CVS: if you update llvm/lib/CodeGen
and rebuild, hopefully linscan will magically work for Finn now. :slight_smile:

-Chris

It works. Even better: it isn't magic :wink:
Thank you for helping me out. Now it's time to play :slight_smile:

Best regards
/Finn

Great! I'm glad we finally got this resolved. Please let us know if you
run into any other strangeness :slight_smile:

-Chris