[llvm-bugs] [Bug 34696] New: "Deduce function attributes" calculates different attributes if dbg.value is present. -g affects generated code

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 22 01:38:18 PDT 2017


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

            Bug ID: 34696
           Summary: "Deduce function attributes" calculates different
                    attributes if dbg.value is present. -g affects
                    generated code
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19183
  --> https://bugs.llvm.org/attachment.cgi?id=19183&action=edit
reproducer

opt -disable-basicaa -S -globals-aa -functionattrs -o - attrs.ll

gives

; Function Attrs: nounwind
define void @f1() #0 {

and

; Function Attrs: nounwind readnone
define void @f0() #1 {

with

attributes #0 = { nounwind }
attributes #1 = { nounwind readnone }

However, if we remove the call to dbg.value in f0 we instead get

; Function Attrs: norecurse nounwind readnone
define void @f1() #0 {

and

; Function Attrs: norecurse nounwind readnone
define void @f0() #0 {

with

attributes #0 = { norecurse nounwind readnone }

so the call to dbg.value in f0 makes -functionattrs deduce different attributes 
on both f1 and f2.

If we then run e.g. -early-cse on the output, we will get different code
because
the call to f0 in f1 will or will not be removed depending on the function
attributes, so code generation is different depending on if we have compiled
with -g or not which is quite unfortunate.

-- 
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/20170922/b50bd111/attachment.html>


More information about the llvm-bugs mailing list