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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 27 10:02:59 PDT 2023


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InferAlignment/alloca.ll:21
+  %load.i8 = load i8, ptr %alloca
+  %load.i32 = load i32, ptr %alloca
+
----------------
Might make sense to add explicit `, align 1` on the allocas, loads and stores here, to show that the i32s would also get increased.


================
Comment at: llvm/test/Transforms/InferAlignment/alloca.ll:35
+
+define void @alloca_struct(i64 %x) nounwind {
+; CHECK-LABEL: define void @alloca_struct
----------------
Drop nounwind.


================
Comment at: llvm/test/Transforms/InferAlignment/alloca.ll:52
+  %gep.0 = getelementptr %struct.pair, ptr %alloca.struct, i32 0, i32 0
+  %gep.1 = getelementptr { i32, i32 }, ptr %gep.0, i32 0, i32 0
+
----------------
These are no-op GEPs. You probably want to produce a non-zero offset?


================
Comment at: llvm/test/Transforms/InferAlignment/irregular-size.ll:4
+
+define i177 @ossfuzz_9880(i177 %X) {
+; CHECK-LABEL: define i177 @ossfuzz_9880
----------------
Argument unused.

I'd also call this `@non_pow2_size` or so, though I'm not really clear on what this is support to test wrt alignment.


================
Comment at: llvm/test/Transforms/InferAlignment/irregular-size.ll:26
+;
+  %ptr0 = getelementptr i8, ptr @vector_i4, i64 0
+  %res0 = load i4, ptr %ptr0, align 1
----------------
Should use non-zero GEP here.


================
Comment at: llvm/test/Transforms/InferAlignment/param-attr.ll:3
+; RUN: opt < %s -passes=no-op-function -S | FileCheck %s
+target triple = "x86_64-unknown-linux-gnu"
+
----------------
Drop triple (from all tests that have one).


================
Comment at: llvm/test/Transforms/InferAlignment/param-attr.ll:25
+  ret i32 %1
+}
+
----------------
You can also add a test where `align 32` is on the return value.


================
Comment at: llvm/test/Transforms/InferAlignment/param-attr.ll:27
+
+declare ptr @func1(ptr returned) nounwind
----------------
Drop nounwind.


================
Comment at: llvm/test/Transforms/InferAlignment/propagate-assume.ll:47
+  ret i32 %load.a
+}
+
----------------
Can also add a test using an assume operand bundle (`call void @llvm.assume(i1 true) ["aligned"(...)]`).


================
Comment at: llvm/test/Transforms/InferAlignment/vector.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt < %s -passes=no-op-function -S | FileCheck %s
+
----------------
I think gep-vector.ll and vector.ll should be combined into one file.


================
Comment at: llvm/test/Transforms/InferAlignment/volatile.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt < %s -passes=no-op-function -S | FileCheck %s -check-prefixes=ALL
+
----------------
Use default CHECK prefix.


================
Comment at: llvm/test/Transforms/InferAlignment/vscale.ll:13
+  %alloca = alloca <vscale x 4 x i32>
+  %gep = getelementptr <vscale x 4 x i32>, ptr %alloca, i32 0
+
----------------
Use non-zero GEP.


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