[llvm-bugs] [Bug 31897] New: Wrong code bug in ipsccp

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 8 01:04:28 PST 2017


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

            Bug ID: 31897
           Summary: Wrong code bug in ipsccp
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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

If doing

opt -S -o - foo.ll -ipsccp

on

%rec = type { i32 }

@g1 = global %rec zeroinitializer
@g2 = global %rec* null

define internal %rec* @foo(%rec %par)  {
  br i1 undef, label %bar, label %bar
bar:
  ret %rec* @g1
}

define void @gaz() {
  %1 = call %rec* @foo(%rec undef)
  store %rec* %1, %rec** @g2

  ret void
}

we get

%rec = type { i32 }

@g1 = global %rec zeroinitializer
@g2 = global %rec* null

define internal %rec* @foo(%rec %par) {
  br i1 false, label %bar, label %bar

bar:                                              ; preds = %0, %0
  ret %rec* undef
}

define void @gaz() {
  %1 = call %rec* @foo(%rec zeroinitializer)
  store %rec* %1, %rec** @g2
  ret void
}

So the return value of foo has been changed to "undef", but
the callsite in gaz has not been changed so %1 will get the
value undef instead of @g1.

If changing foo so it doesn't take a struct argument, or if
changing the br i1 undef into e.g. br i1 false then the
callsite is updated.

(The br i1 undef was originally introduced by instcombine,
supposedly since it saw that the true and false branches were
the same, and thus it changed the condition into undef and removed the
computation leading to the original condition.)

-- 
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/20170208/3b21106c/attachment.html>


More information about the llvm-bugs mailing list