[PATCH] D158530: [InferAlignment] Create tests for InferAlignment pass

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 07:51:16 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM with two nits.



================
Comment at: llvm/test/Transforms/InferAlignment/alloca.ll:48
+  %gep.0 = getelementptr %struct.pair, ptr %alloca.struct, i64 0, i32 1
+  %gep.1 = getelementptr { i32, i32 }, ptr %gep.0, i32 1
+
----------------
This one is still going to index out of bounds (as we advance by two pairs total). I would change the index here to `i64 0, i32 1` as well (and the expected alignment would then be `align 4`).


================
Comment at: llvm/test/Transforms/InferAlignment/vscale.ll:13
+  %alloca = alloca <vscale x 4 x i32>, align 1
+  %gep = getelementptr <vscale x 4 x i32>, ptr %alloca, i32 3
+
----------------
These accesses are going to go out of bounds again. Maybe replace the allocas in this test with a `ptr align N` parameter just to make things kosher?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158530



More information about the llvm-commits mailing list