-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingmissed-optimization
Description
Minimal working example:
@x = global i32 0, align 4
define void @bar(ptr %0) noinline {
%2 = load i32, ptr @x, align 4
store i32 %2, ptr %0, align 4
ret void
}
define void @foo() {
%1 = alloca i32, align 4
call void @bar(ptr %1)
ret void
}
@bar stores the value of global @x in its argument. It is marked noinline.
@foo calls @bar with an alloca variable, and does nothing else. At -O3, opt (trunk) is not able to kill the call to @bar.
In practice, I noticed this with an indirect call instead of a call to "@bar", and could not make DSE work as soon as the called function read memory (understand: the call gets DSE'ed with memory(argmem: readwrite), but not with memory(read, argmem: readwrite).
If I remvoe noinline , the call gets inline, then DSE'd correctly.
Metadata
Metadata
Assignees
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingmissed-optimization