[LLVMbugs] [Bug 14519] New: Tablegen-generated Intrinsic string compares mis-sorted
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Dec 5 10:26:33 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14519
Bug #: 14519
Summary: Tablegen-generated Intrinsic string compares
mis-sorted
Product: new-bugs
Version: 3.1
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: richard.relph at amd.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
In the tablegen-generated file AMDILGenIntrinsics.inc, we have a bunch of if
statements comparing strings, many of which are dead, preventing correct
recognition of some intrinsics in the their text form. I'm not quite sure what
GET_FUNCTION_RECOGNIZER is used for, but if it's used, it's broken… ;-)
Here's a small segment:
// Function name -> enum value recognizer code.
#ifdef GET_FUNCTION_RECOGNIZER
StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'
switch (Name[5]) { // Dispatch on first letter.
default: break;
case 'A':
…
if (NameR.startswith("MDIL.barrier.")) return AMDILIntrinsic::AMDIL_barrier;
if (NameR.startswith("MDIL.barrier.global.")) return
AMDILIntrinsic::AMDIL_barrier_global;
if (NameR.startswith("MDIL.barrier.local.")) return
AMDILIntrinsic::AMDIL_barrier_local;
if (NameR.startswith("MDIL.barrier.region.")) return
AMDILIntrinsic::AMDIL_barrier_region;
…
if (NameR.startswith("MDIL.fma.")) return AMDILIntrinsic::AMDIL_fma;
if (NameR.startswith("MDIL.fma.rte.")) return AMDILIntrinsic::AMDIL_fma_rte;
if (NameR.startswith("MDIL.fma.rtn.")) return AMDILIntrinsic::AMDIL_fma_rtn;
if (NameR.startswith("MDIL.fma.rtp.")) return AMDILIntrinsic::AMDIL_fma_rtp;
if (NameR.startswith("MDIL.fma.rtz.")) return AMDILIntrinsic::AMDIL_fma_rtz;
…
and several other similar instances.
The problem is that AMDIL.barrier.global will match the earlier startswith()
AMDIL.barrier test and return the wrong intrinsic enum. Similarly
AMDIL.fma.rte/n/p/z.
The string compares are obviously sorted by tablegen, but should be emitted in
reverse sort order.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list