[LLVMdev] bug in TableGen when generating RegisterInfo?

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Sep 6 07:53:53 PDT 2011


On Sep 6, 2011, at 6:34 AM, Alexandru Dura wrote:

> Hi everyone,
> 
> I found some peculiar behavior of TableGen when generating [TARGET]GenRegisterInfo.inc. Some register overlaps are generated twice in this file, leading to a compilation error. I think this is because in RegisterInfoEmitter.cpp, RegisterAliases are declared as "std::map<Record*, std::set<Record*>, LessRecord>"
> 
> and a requirement for std::map is that the comparison function ("LessRecord") should correspond to a strict weak ordering; in this case this points to :  
> 
>    "StringRef1.compare_numeric(StringRef2) < 0"
> 
> which does not behave like strict weak ordering predicate on the set of strings. I have attached an example built upon snippets from StringRef.cpp, compiled with gcc version 4.4.5 (Debian 4.4.5-8) (I also saw that there is a workaround for gcc 4.x ...). 
> 
> Please tell me if I am doing something wrong or this is a real bug. 

Compare_numeric is supposed to be transitive. It is probably a bug in that function.

In particular, "V16" < "V1_q0" should not be true.

Can you fix it?

/jakob





More information about the llvm-dev mailing list