[PATCH] D99121: [IR][InstCombine] IntToPtr Produces Typeless Pointer To Byte
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 22 15:22:27 PDT 2021
lebedev.ri added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/indexed-gep-compares.ll:35-51
define i32 *@test2(i32 %A, i32 %Offset) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = inttoptr i32 [[A:%.*]] to i8*
+; CHECK-NEXT: [[A_PTR:%.*]] = bitcast i8* [[TMP0]] to i32*
+; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds i32, i32* [[A_PTR]], i32 [[OFFSET:%.*]]
; CHECK-NEXT: br label [[BB:%.*]]
----------------
Regression. Not looking through `bitcast`?
================
Comment at: llvm/test/Transforms/InstCombine/indexed-gep-compares.ll:105-122
define i32 *@test4(i16 %A, i32 %Offset) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[A:%.*]] to i32
+; CHECK-NEXT: [[TMP1:%.*]] = inttoptr i32 [[TMP0]] to i8*
+; CHECK-NEXT: [[A_PTR:%.*]] = bitcast i8* [[TMP1]] to i32*
+; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds i32, i32* [[A_PTR]], i32 [[OFFSET:%.*]]
----------------
Regression. Not looking through `bitcast`?
================
Comment at: llvm/test/Transforms/InstCombine/indexed-gep-compares.ll:189-213
define i32 *@test6(i32 %Offset) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = invoke i32 @fun_i32()
; CHECK-NEXT: to label [[CONT:%.*]] unwind label [[LPAD:%.*]]
; CHECK: cont:
+; CHECK-NEXT: [[TMP0:%.*]] = inttoptr i32 [[A]] to i8*
----------------
Regression. Not looking through `bitcast`?
================
Comment at: llvm/test/Transforms/InstCombine/intptr3.ll:14-15
; CHECK-NEXT: [[A_ADDR_03:%.*]] = phi float* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[A]], [[FOR_BODY_PREHEADER]] ]
-; CHECK-NEXT: [[B_ADDR_FLOAT:%.*]] = phi float* [ [[B_ADDR_FLOAT_INC:%.*]], [[FOR_BODY]] ], [ [[B_FLOAT]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_I64_PTR:%.*]] = phi i8* [ [[B_ADDR_FLOAT_INC:%.*]], [[FOR_BODY]] ], [ [[TMP0]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_FLOAT:%.*]] = bitcast i8* [[B_ADDR_I64_PTR]] to float*
; CHECK-NEXT: [[L:%.*]] = load float, float* [[B_ADDR_FLOAT]], align 4
----------------
Regression.
================
Comment at: llvm/test/Transforms/InstCombine/intptr7.ll:4-27
define void @matching_phi(i64 %a, float* %b, i1 %cond) {
; CHECK-LABEL: @matching_phi(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADD_INT:%.*]] = add i64 [[A:%.*]], 1
-; CHECK-NEXT: [[ADD:%.*]] = inttoptr i64 [[ADD_INT]] to float*
+; CHECK-NEXT: [[TMP0:%.*]] = inttoptr i64 [[ADD_INT]] to i8*
+; CHECK-NEXT: [[ADD:%.*]] = bitcast i8* [[TMP0]] to float*
+; CHECK-NEXT: [[ADDB:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 2
----------------
Regression. Not looking through `bitcast`?
================
Comment at: llvm/test/Transforms/InstCombine/intptr7.ll:52-75
define void @no_matching_phi(i64 %a, float* %b, i1 %cond) {
; CHECK-LABEL: @no_matching_phi(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADD_INT:%.*]] = add i64 [[A:%.*]], 1
-; CHECK-NEXT: [[ADD:%.*]] = inttoptr i64 [[ADD_INT]] to float*
+; CHECK-NEXT: [[TMP0:%.*]] = inttoptr i64 [[ADD_INT]] to i8*
+; CHECK-NEXT: [[ADD:%.*]] = bitcast i8* [[TMP0]] to float*
; CHECK-NEXT: [[ADDB:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 2
----------------
Regression. Not looking through `bitcast`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99121/new/
https://reviews.llvm.org/D99121
More information about the llvm-commits
mailing list