Issue 144300
Summary Missed DSE of non-inlineable call
Labels new issue
Assignees
Reporter qchateau
    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.


https://godbolt.org/z/9MEGrYdsa
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to