[llvm-bugs] [Bug 48137] New: llvm-diff produces non-empty diff in the same code for static variables referencing

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 10 09:01:28 PST 2020


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

            Bug ID: 48137
           Summary: llvm-diff produces non-empty diff in the same code for
                    static variables referencing
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: khitrin at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 24143
  --> https://bugs.llvm.org/attachment.cgi?id=24143&action=edit
full clang-produced IR file

Looks like a follow-up for bug 33623.

$ cat a.cpp 
struct S {
};

// removing static eliminates the bug
static S s;

void* func() {
    return &s;
}

$ clang a.cpp -S -emit-llvm
$ llvm-diff a.ll a.ll 
in function _Z4funcv:
  in block %0 / %0:
    >   ret i8* getelementptr inbounds (%struct.S.0, %struct.S.0* @_ZL1s, i32
0, i32 0)
    <   ret i8* getelementptr inbounds (%struct.S, %struct.S* @_ZL1s, i32 0,
i32 0)

$ llvm-diff -version
LLVM (http://llvm.org/):
  LLVM version 11.0.0
  Optimized build.
  Default target: x86_64-apple-darwin18.7.0
  Host CPU: haswell


Reduced testcase with the same llvm-diff output:

$ cat a_reduced.ll 
%struct.S = type { i8 }

@_ZL1s = internal global %struct.S zeroinitializer, align 1

define i8* @_Z4funcv() {
  ret i8* getelementptr inbounds (%struct.S, %struct.S* @_ZL1s, i32 0, i32 0)
}


Also reproducible on llvm-12 development build for Debian

-- 
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/20201110/c18dc4c5/attachment.html>


More information about the llvm-bugs mailing list