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

George Burgess IV via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 17:28:34 PST 2020


george.burgess.iv added a comment.

Thanks for this!

It's been a while since I've worked with memory-ish things in LLVM. Please forgive my questions if they're silly :)

This approach looks good to me, with the caveat that I'm not an expert in all of the creative, "supported" tricks that exist for lying to the compiler about object sizes.

Please also add a test for a zero-sized and nonzero-sized global (`llvm.objectsize` might be a good hammer for that?). Otherwise, I'm happy when Hal is



================
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() {
----------------
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.)


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