[LLVMbugs] [Bug 7081] New: Assertion "Stack not empty at end of basic block?" when using target_cpu=i486

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 6 17:20:33 PDT 2010


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

           Summary: Assertion "Stack not empty at end of basic block?"
                    when using target_cpu=i486
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


While compiling a file from the ntp component of FreeBSD using clang
r103176, I ended up with the following assertion:

Assertion failed: (isStackEmpty() && "Stack not empty at end of basic
block?"), function processBasicBlock, file X86FloatingPoint.cpp, line
300.
Stack dump:
0.      Program arguments: /home/dim/llvm/103176-gcc-dbg-1/bin/clang
  -cc1 -triple i386-undermydesk-freebsd9.0 -S -disable-free
  -main-file-name ntp_proto.i -mrelocation-model static
  -mdisable-fp-elim -mconstructor-aliases -target-cpu i486
  -resource-dir /usr/obj/home/dim/src/clangbsd/tmp/usr/lib/clang/2.0
  -O2 -Wno-pointer-sign -std=gnu99 -ferror-limit 19 -fmessage-length
  254 -fheinous-gnu-extensions -stack-protector 1 -fgnu-runtime
  -fdiagnostics-show-option -fcolor-diagnostics -x cpp-output
  ntp_proto.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'X86 FP Stackifier' on function '@clock_filter'

This is because the clang imported in FreeBSD uses 'i486' as its
default target CPU, not 'pentium4', which is the clang default.

When clang passes -mcpu=pentium4 to llc, it generates SSE
instructions, but when -mcpu=i486 is used instead, it apparently uses
'old-school' FP instructions.

The reduced testcase in C is this:

extern signed char sys_precision;
void clock_filter(void)
{
  double dst[8];
  int ord[8];
  int i, j, k, m;
  double dtemp, etemp;
  for (i = 1; i < 8; i++) {
    for (j = 0; j < i; j++) {
      if (dst[j] > dst[i] + ((sys_precision) < 0 ?
          1. / (1L << -(sys_precision)) :
          1L << (int)(sys_precision))) {
        k = ord[j];
        ord[j] = ord[i];
        ord[i] = k;
        etemp = dst[j];
        dst[j] = dst[i];
        dst[i] = etemp;
      }
    }
  }
}

compiling this with:

clang -cc1 -target-cpu i486 -O2 -emit-llvm ntp_proto.i -o - | \
  llc -mcpu=i486 

will fire the assertion.

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