[PATCH] TableGen InstrMapping Bug fix

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 15:40:01 PST 2016


Your fix looks correct but should really have a test.

We don't have any existing tests which run -gen-instr-info, but it should be
possible. We'd just need to hit the emitEnums path with an entry that sets
FieldValues to {a, a, a}.

Side note: emitEnums() really needs to be cleaned up. It looks like it has
cubic runtime in the worst case, and it does what looks like a totally
unnecessary copy to initialize FieldValues.

best,
vedant

> On Nov 2, 2016, at 7:55 AM, Tyler Kenney via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
>  
>  
> I believe I've found a bug in CodeGenMapTable.cpp.emitEnums(). I'm developing an out-of-tree backend and I was getting an error on a tablegen header for a duplicate enum value. emitEnums() was not properly deleting duplicate entries, but does with the attached the patch. Apparently none of the in-tree targets have enough InstrMapping's to trigger this bug, but my backend defines many.
>  
> I don't think there is a way to provide a test case for this without providing a whole new backend, so hopefully we can agree that it's not necessary. I've confirmed that all default targets still build with this patch applied.
>  
> Tyler
>  
>  
> 
> <CodeGenMapTable.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list