[LLVMbugs] [Bug 12542] New: IntrinsicEmitter generate wrong target intrinsics attribute getting code.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 12 20:18:52 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12542

             Bug #: 12542
           Summary: IntrinsicEmitter generate wrong target intrinsics
                    attribute getting code.
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: etherzhhb at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8381
  --> http://llvm.org/bugs/attachment.cgi?id=8381
The patch that fix the bug

The IntrinisicEmitter use an index array to map intrinsic id to identical
attributes by assuming the value of the intrinsic id is start from zero. But
this is incorrect when generating target specific intrinsic, because they are
start from Intrinsic::num_intrinsics, i.e. the value of first target spesific
intrinsic is equal to Intrinsic::num_intrinsics instead of 0. As a result, the
code generated by IntrinisicEmitter is incorrect, e.g.:

static AttrListPtr getAttributes(mblazeIntrinsic::ID id) {
  static const uint8_t IntrinsicsToAttributesMap[] = {
    255, // Invalid intrinsic
    1, // llvm.mblaze.fsl.aget
    1, // llvm.mblaze.fsl.aput
    1, // llvm.mblaze.fsl.caget
    ...
  }

  AttributeWithIndex AWI[1];
  unsigned NumAttrs = 0;

  //  Wrong, should be IntrinsicsToAttributesMap[id -Intrinsic::num_intrinsics
+ 1]!
  switch(IntrinsicsToAttributesMap[id]) {
    ...

In fact, i find this bug in my private backend, so i cannot attach a regression
at the moment.

-- 
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