[llvm-bugs] [Bug 31724] New: Clang's call lowering often coerces pointers to ints, which blocks alias analysis

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 23 10:04:20 PST 2017


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

            Bug ID: 31724
           Summary: Clang's call lowering often coerces pointers to ints,
                    which blocks alias analysis
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider this C code:

struct Handle { void *p; };
extern void g(struct Handle);
void f(struct Handle o) { g(o); }

Here are three examples of clang coercing the 'p' field to an int:

$ clang -S -x c --target=ppc64-linux t.cpp  -o - -emit-llvm  | grep define
define void @f(i64 %o.coerce) #0 {

$ clang -S -x c --target=x86_64-windows t.cpp  -o - -emit-llvm  | grep define
define void @f(i64 %o.coerce) #0 {

$ clang -S -x c --target=mips-linux t.cpp  -o - -emit-llvm  | grep define
define void @f(i32 inreg %o.coerce) #0 {

According to dannyb, this is bad, because the ptrtoint calls block alias
analysis.

-- 
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/20170123/38f57ac8/attachment.html>


More information about the llvm-bugs mailing list