This commit adds some tests in preparation for D136659, which allows alias
analysis to treat locally-invariant memory pointed to by readonly noalias
pointers the same as globally-invariant memory in some cases. The existing
behavior for these tests is marked as expected and will be changed when that
diff lands.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
50 ms | x64 debian > LLVM.CodeGen/MIR/AArch64::mirnamer.mir |
Event Timeline
llvm/test/Analysis/BasicAA/constant-memory.ll | ||
---|---|---|
45 | While here, I think we may also want to add variations with readnone and writeonly. I initially thought we might be able to return NoModRef/Ref/Mod depending on readnone/readonly/writeonly, but I think this is not actually the case. For noalias readnone, reads of the object through other pointers are still legal. For noalias writeonly, reads of the object through other pointers are also legal, as long as this pointer is not actually written. As such, Ref for readnone/readonly and ModRef for writeonly are the best we can do. | |
llvm/test/Transforms/InstCombine/memcpy-from-global.ll | ||
344 | Drop attributes that are not needed for the transform, e.g. nocapture, noundef are probably not relevant here. We can also give this a more meaningful name, say memcpy_from_readonly_noalias. | |
352 | Attributes on the memcpy are likely not needed here and a bit confusing in this case -- you're using dereferenceable(12), but the actual size is 124. (This is legal, just odd.) | |
353 | You can probably reuse the @bar() function from above here? And likely only need the call readonly attribute, not the parameter attributes. | |
355 | Can complement this with the same test, but without the noalias again. |
While here, I think we may also want to add variations with readnone and writeonly.
I initially thought we might be able to return NoModRef/Ref/Mod depending on readnone/readonly/writeonly, but I think this is not actually the case. For noalias readnone, reads of the object through other pointers are still legal. For noalias writeonly, reads of the object through other pointers are also legal, as long as this pointer is not actually written.
As such, Ref for readnone/readonly and ModRef for writeonly are the best we can do.