[llvm-bugs] [Bug 38956] New: Missed folding for comparisions between allocated pointer and global variables/functions

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 15 02:52:26 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38956

            Bug ID: 38956
           Summary: Missed folding for comparisions between allocated
                    pointer and global variables/functions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

extern int foo(void);
char a[32] = "hello";
char b[32];

int fa (void)
{
  void *p = malloc (32);
  return p == foo; // should be folded 0
  // return p == f; // should be folded 0
}

int  fb (void)
{
  void *p = malloc (32);

  return p == a; // should be folded 0
}

int fc (void)
{
  void *p = malloc (32);
  return p == b; // should be folded 0
}


Not sure what is broken here, values from malloc/calloc/etc are tagged as
noalias, so these comparisons should be handled/folded..

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180915/0392fa1a/attachment.html>


More information about the llvm-bugs mailing list