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: unassignedb...@nondot.org
Reporter: mikael.hol...@ericsson.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs