[LLVMbugs] [Bug 13542] New: Problem with LICM optimization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 6 23:30:34 PDT 2012


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

             Bug #: 13542
           Summary: Problem with LICM optimization
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rahul.s1 at samsung.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


For the below code after doing " O2 "  lever optimization , the code aborts as
per the test case.


extern "C" void * malloc(__SIZE_TYPE__);
extern "C" void abort(void);

void *p;
void __attribute__((noinline)) init(void)
{
  p = malloc(4);
}

inline void *operator new(__SIZE_TYPE__)
{
  return p;
}

inline void operator delete (void*) {}

int * __attribute__((noinline)) doit(int n)
{
  float *q;
  int *r;

  for (int i=0; i<n; ++i)
  {
    q = new float;
    *q = 1.0;
    delete q;
    r = new int;
    *r = 1;
  }

  return r;
}

int main()
{
  init();
  if (*doit(1) != 1)
    abort();
  return 0;
}


For the doit function,
In the code flow , it seems that while doing LICM optimization , the store
instruction for float while getting promoted actually gets promoted below the
store for int . So in further alias analysis , the int operation is removed
which is setting the value to float store operation.

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