[llvm] [DSE] Enable initializes improvement (PR #119116)

Axel Y. Rivera via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 13:11:04 PST 2024


ayrivera-intel wrote:

Hi @haopliu ,

Sorry for the noise or spamming your mailbox. I found another problem with this patch. If the length of the MemTransferInst or MemSetInst has a negative value then constant range will produce an issue. The problem happens verifying the IR, but seems that the function GetConstantIntRange may need to check if the value of the length is negative. This is a simple reproducer:

```
; Function Attrs: nounwind uwtable
define dso_local i32 @foo(ptr nocapture noundef writeonly %a, ptr nocapture noundef readonly %b) {
entry:
  call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 -1, i1 false)
  ret i32 undef
}

declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
```

You can run it with this command: `opt -passes=function-attrs  simple.ll -S`

And this is the assertion:

```
Attribute 'initializes' does not support unordered ranges
```

If you need any more information, please let me know.

https://github.com/llvm/llvm-project/pull/119116


More information about the llvm-commits mailing list