[PATCH] D73679: [MemoryBuiltins] Determine the size of a global w/o initializer

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 21:24:06 PST 2020


jdoerfert marked an inline comment as done.
jdoerfert added a comment.

In D73679#1850893 <https://reviews.llvm.org/D73679#1850893>, @george.burgess.iv wrote:

> Please also add a test for a zero-sized and nonzero-sized global (`llvm.objectsize` might be a good hammer for that?).


So there are existing test with 0 sized objects that would fail if we do not have the `Size != 0` check but I'll add a few more to nail down what we expect as soon as I find the time. It might take a week or two though.



================
Comment at: llvm/test/Analysis/BasicAA/bug.23540.ll:11
 ; CHECK-LABEL: f
-; CHECK: MayAlias: i32* %arrayidx, i32* %arrayidx6
+; CHECK: PartialAlias: i32* %arrayidx, i32* %arrayidx6
 define void @f() {
----------------
george.burgess.iv wrote:
> Can you expand a bit on why PartialAlias is the correct answer here, please?
> 
> I'd naively expect this to be either MustAlias (both pointers are to a 32 bit object, and there're only 32 bits in this allocation; derefing anything else is UB), or MayAlias (there're only 32 bits here, but maaaaybe you're pointing to `((int*)&c + 1)`, and that's OK.)
My reasoning is that `arrayidx6` points right after `c` and `arrayidx` points somewhere based on `c`. There are no accesses so the alias query is done with an unspecified size on the access part which should mean the two accesses can very well overlap. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73679/new/

https://reviews.llvm.org/D73679





More information about the llvm-commits mailing list