[PATCH] D150515: [ConstantFold] use StoreSize for VectorType byte checking

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 01:53:50 PDT 2023


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

LGTM



================
Comment at: llvm/test/Transforms/InstCombine/load-non-byte-sized-vector.ll:4
+
+ at foo = constant <4 x i4> <i4 u0x1, i4 u0x2, i4 u0x3, i4 u0x4>, align 8
+declare void @report(i64 %index, i4 %val)
----------------
Nit: Seems like using decimal is simpler here :)


================
Comment at: llvm/test/Transforms/InstCombine/load-non-byte-sized-vector.ll:19
+  %res0 = load i4, ptr %ptr0, align 1
+  call void @report(i64 0, i4 %res0)
+
----------------
The first argument of the `@report` function doesn't really look necessary. Actually, it would be best to split this into two tests of the form
```
  %ptr0 = getelementptr i8, ptr @foo, i64 0
  %res0 = load i4, ptr %ptr0, align 1
  ret i4 %res0
```
because this makes it easier for alive2 to verify than using function calls.


================
Comment at: llvm/test/Transforms/InstCombine/load-non-byte-sized-vector.ll:26
+  ret void
+}
----------------
I'd suggest to add this test to the load.ll file. It doesn't seem worthwhile to have a separate test file for just this case.


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

https://reviews.llvm.org/D150515



More information about the llvm-commits mailing list