[LLVMdev] Plea for help
Chris Lattner
sabre at nondot.org
Tue May 4 10:17:01 PDT 2004
On Tue, 4 May 2004, Finn S Andersen wrote:
> Chris wrote in a followup:
>
> > Can you send the output of 'llc -o - foo.bc -debug -print-machineinstrs'?
>
>
> Attached as "linscan". (But added the "-regalloc=linearscan" to provoke
> the error).
Yes, that's exactly what I meant... thanks for reading my mind! :)
It looks like this is where things start to go downhill
(LiveIntervals.cpp:559):
LiveIntervals::Interval::Interval(unsigned r)
: reg(r),
weight((MRegisterInfo::isPhysicalRegister(r) ?
std::numeric_limits<float>::infinity() : 0.0F))
{
For a physical register (EDX in this case) it appears that the interval is
being created, but gets a 0 weight instead of an infinity weight. This
implies that the MRegisterInfo::isPhysicalRegister might have an issue, or
std::numeric_limits has an issue.
Could you try compiling and running this program:
---
#include <limits>
#include <iostream>
int main() {
std::cerr << std::numeric_limits<float>::infinity() << "\n";
}
---
If that prints 'inf', then check include/llvm/Target/MRegisterInfo.h, and
make sure you see something like this in it:
/// isPhysicalRegister - Return true if the specified register number is in
/// the physical register namespace.
static bool isPhysicalRegister(unsigned Reg) {
assert(Reg && "this is not a register!");
return Reg < FirstVirtualRegister;
}
If that looks fine, try changing LiveIntervals::Interval::Interval in
lib/CodeGen/LiveIntervals.cpp to this:
LiveIntervals::Interval::Interval(unsigned r)
: reg(r),
weight((MRegisterInfo::isPhysicalRegister(r) ?
std::numeric_limits<float>::infinity() : 0.0F))
{
std::cerr << "Created interval for reg " << reg << " weight = " << weight
<< "\n";
assert(r < 1024 || weight > 1 && "physreg or weight incorrectly computed!");
}
And send me the output of -debug -print-machineinstrs -regalloc-linearscan
again. :)
Thanks, I hope we can get this resolved once and for all!
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list