[PATCH] D99481: [InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 3 11:08:45 PDT 2021
aqjune added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:289
+ IdxBeforeSext->getType()->getPrimitiveSizeInBits().getFixedSize() >=
+ PtrSize;
+ else
----------------
This is to avoid creating redundant expressions, right?
Could you elaborate a bit more with an example?
================
Comment at: llvm/test/Transforms/InstCombine/load-cmp.ll:60
; CHECK-LABEL: @test1_noinbounds_as1(
-; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i16
-; CHECK-NEXT: [[R:%.*]] = icmp eq i16 [[TMP1]], 9
+; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 32767
+; CHECK-NEXT: [[R:%.*]] = icmp eq i32 [[TMP1]], 9
----------------
Could you leave a comment explaining why this is 32767?
Same for test10_struct_arr_noinbounds case below
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99481/new/
https://reviews.llvm.org/D99481
More information about the llvm-commits
mailing list