[PATCH] D128364: [InstCombine] Look through more casts when folding memchr and memcmp
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 28 12:30:44 PDT 2022
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
Implementation LG, some notes on the tests.
================
Comment at: llvm/test/Transforms/InstCombine/memchr-10.ll:21
+; CHECK-LABEL: @call_memchr_ap5_c_1_eq_a(
+; CHECK-NEXT: ret i1
+;
----------------
Incomplete check line?
================
Comment at: llvm/test/Transforms/InstCombine/memchr-9.ll:317
+; CHECK-NEXT-BE: ret i8* getelementptr (i8, i8* bitcast (%union.U* @u to i8*), i64 5)
+; CHECK-NEXT-LE: ret i8* bitcast (i32* getelementptr inbounds (%union.U, %union.U* @u, i64 0, i32 0, i64 1) to i8*)
+;
----------------
These check lines aren't correct and are probably just getting ignored. You need to pass something like `--check-prefixes=CHECK,BE` and `--check-prefixes=CHECK,LE` and regenerate check lines.
================
Comment at: llvm/test/Transforms/InstCombine/strcall-no-nul.ll:142
+;
+; XFAIL-CHECK-NEXT: ret i8*, null
+ %p5 = getelementptr [5 x i8], [5 x i8]* @a5, i32 0, i32 5
----------------
This check line doesn't make a lot of sense ... the syntax is incorrect (and the incorrect syntax is repeated in the cases below) and the ret wouldn't make sense here anyway (because strlen returns an integer not a pointer). The TODO also seems outdated, as this already folds to 0.
================
Comment at: llvm/test/Transforms/InstCombine/strnlen-1.ll:166
+
+; TODO: Do not fold the invalid strnlen(s5_3 + 6, 4) call.
+; This folded because llvm::GetStringLength() doesn't differentiate
----------------
This TODO is probably not relevant anymore given the updated patch?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128364/new/
https://reviews.llvm.org/D128364
More information about the llvm-commits
mailing list