[LLVMbugs] [Bug 2776] New: possible volatile bug -- too many loads

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Sep 6 13:54:47 PDT 2008


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

           Summary: possible volatile bug -- too many loads
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu


This is for r55873 on Ubuntu Hardy on ia32.  Looks to me like the right answer
is loading g_45 just one time.

regehr at john-home:~/volatile/tmp26$ llvm-gcc -O1 -S --emit-llvm small.c -o foo.s
; llvm-as -f foo.s ; lli --force-interpreter --interpreter-print-volatile
foo.s.bc
Volatile load   %0 = volatile load i32* @g_45, align 4          ; <i32>
[#uses=0]
Volatile load   %5 = volatile load i32* @g_124, align 4         ; <i32>
[#uses=1]
checksum = 0

regehr at john-home:~/volatile/tmp26$ llvm-gcc -O3 -S --emit-llvm small.c -o foo.s
; llvm-as -f foo.s ; lli --force-interpreter --interpreter-print-volatile
foo.s.bc
Volatile load   %0 = volatile load i32* @g_45, align 4          ; <i32>
[#uses=0]
Volatile load   %1 = volatile load i32* @g_45, align 4          ; <i32>
[#uses=0]
Volatile load   %2 = volatile load i32* @g_124, align 4         ; <i32>
[#uses=0]
Volatile load   %1 = volatile load i32* @g_45, align 4          ; <i32>
[#uses=0]
checksum = 0

regehr at john-home:~/volatile/tmp26$ cat small.c

#include <stdio.h>

typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

uint32_t g_20;
volatile uint32_t g_45 ;
int32_t g_83;
volatile uint32_t g_124;
volatile uint32_t g_208;

int32_t func_100 (uint32_t p_103);
int32_t func_100 (uint32_t p_103)
{
  return 1;
}

int32_t func_119 (uint32_t p_120);
int32_t func_119 (uint32_t p_120)
{
  return 1;
}

int32_t func_96 (int32_t p_97);
int32_t func_96 (int32_t p_97)
{
  if ((g_45 > 1) > 1 > g_83)
    {
      func_100 (g_208);
      return 1;
    }
  func_119 (g_124);
  return 1;
}

void func_90 (int16_t p_92);
void func_90 (int16_t p_92)
{
  for (g_83 = 0; g_83 <= 0; g_83++)
    func_96 (1);
}

int main (void)
{
  func_90 (1);
  printf ("checksum = 0\n");
  return 0;
}


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