Skip to content

Commit

Permalink
[X86] Convert tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 5, 2023
1 parent 79c1cf1 commit 0d022e7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
41 changes: 18 additions & 23 deletions llvm/test/CodeGen/X86/fold-call-3.ll
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -opaque-pointers=0 < %s -mtriple=x86_64-apple-darwin | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
; rdar://6522427
; This command line used to crash due to dangling nodes left after PreprocessISelDAG
; RUN: llc -opaque-pointers=0 < %s -mtriple=x86_64-apple-darwin -pre-RA-sched=linearize | FileCheck %s --check-prefix=pre-RA
; RUN: llc < %s -mtriple=x86_64-apple-darwin -pre-RA-sched=linearize | FileCheck %s --check-prefix=pre-RA

%"struct.clang::Action" = type { %"struct.clang::ActionBase" }
%"struct.clang::ActionBase" = type { i32 (...)** }
%"struct.clang::ActionBase::ActionResult<0u>" = type { i8*, i8 }
@NumTrials = internal global i32 10000000 ; <i32*> [#uses=2]
@llvm.used = appending global [1 x i8*] [ i8* bitcast (void (i8*, %"struct.clang::Action"*)* @_Z25RawPointerPerformanceTestPvRN5clang6ActionE to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
%"struct.clang::ActionBase" = type { ptr }
%"struct.clang::ActionBase::ActionResult<0u>" = type { ptr, i8 }
@NumTrials = internal global i32 10000000 ; <ptr> [#uses=2]
@llvm.used = appending global [1 x ptr] [ ptr @_Z25RawPointerPerformanceTestPvRN5clang6ActionE ], section "llvm.metadata" ; <ptr> [#uses=0]

define void @_Z25RawPointerPerformanceTestPvRN5clang6ActionE(i8* %Val, %"struct.clang::Action"* %Actions) nounwind {
define void @_Z25RawPointerPerformanceTestPvRN5clang6ActionE(ptr %Val, ptr %Actions) nounwind {
; CHECK-LABEL: _Z25RawPointerPerformanceTestPvRN5clang6ActionE:
; CHECK: ## %bb.0: ## %entry
; CHECK-NEXT: pushq %rbp
Expand Down Expand Up @@ -70,33 +70,28 @@ define void @_Z25RawPointerPerformanceTestPvRN5clang6ActionE(i8* %Val, %"struct.
; pre-RA-NEXT: retq
entry:
%i = alloca %"struct.clang::ActionBase::ActionResult<0u>", align 8
%i1 = load i32, i32* @NumTrials, align 4
%i1 = load i32, ptr @NumTrials, align 4
%i2 = icmp eq i32 %i1, 0
br i1 %i2, label %return, label %bb.nph

bb.nph: ; preds = %entry
%i3 = getelementptr %"struct.clang::Action", %"struct.clang::Action"* %Actions, i64 0, i32 0, i32 0
%mrv_gep = bitcast %"struct.clang::ActionBase::ActionResult<0u>"* %i to i64*
%mrv_gep1 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", %"struct.clang::ActionBase::ActionResult<0u>"* %i, i64 0, i32 1
%i4 = bitcast i8* %mrv_gep1 to i64*
%i5 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", %"struct.clang::ActionBase::ActionResult<0u>"* %i, i64 0, i32 0
%mrv_gep1 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", ptr %i, i64 0, i32 1
br label %bb

bb: ; preds = %bb, %bb.nph
%Trial.01 = phi i32 [ 0, %bb.nph ], [ %i12, %bb ]
%Val_addr.02 = phi i8* [ %Val, %bb.nph ], [ %i11, %bb ]
%i6 = load i32 (...)**, i32 (...)*** %i3, align 8
%i7 = getelementptr i32 (...)*, i32 (...)** %i6, i64 70
%i8 = load i32 (...)*, i32 (...)** %i7, align 8
%i9 = bitcast i32 (...)* %i8 to { i64, i64 } (%"struct.clang::Action"*, i8*)*
%i10 = call { i64, i64 } %i9(%"struct.clang::Action"* %Actions, i8* %Val_addr.02) #0
%Val_addr.02 = phi ptr [ %Val, %bb.nph ], [ %i11, %bb ]
%i6 = load ptr, ptr %Actions, align 8
%i7 = getelementptr ptr, ptr %i6, i64 70
%i8 = load ptr, ptr %i7, align 8
%i10 = call { i64, i64 } %i8(ptr %Actions, ptr %Val_addr.02) #0
%mrv_gr = extractvalue { i64, i64 } %i10, 0
store i64 %mrv_gr, i64* %mrv_gep, align 4
store i64 %mrv_gr, ptr %i, align 4
%mrv_gr2 = extractvalue { i64, i64 } %i10, 1
store i64 %mrv_gr2, i64* %i4, align 4
%i11 = load i8*, i8** %i5, align 8
store i64 %mrv_gr2, ptr %mrv_gep1, align 4
%i11 = load ptr, ptr %i, align 8
%i12 = add i32 %Trial.01, 1
%i13 = load i32, i32* @NumTrials, align 4
%i13 = load i32, ptr @NumTrials, align 4
%i14 = icmp ult i32 %i12, %i13
br i1 %i14, label %bb, label %return

Expand Down
26 changes: 11 additions & 15 deletions llvm/test/CodeGen/X86/pr38217.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -opaque-pointers=0 < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s

@_ZL11DIGIT_TABLE = dso_local constant [201 x i8] c"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899\00", align 16

define dso_local void @_Z12d2s_bufferedmPc(i64 %arg, i8* nocapture %arg1) {
define dso_local void @_Z12d2s_bufferedmPc(i64 %arg, ptr nocapture %arg1) {
; CHECK-LABEL: _Z12d2s_bufferedmPc:
; CHECK: # %bb.0: # %bb
; CHECK-NEXT: cmpq $10000, %rdi # imm = 0x2710
Expand Down Expand Up @@ -53,21 +53,17 @@ bb2: ; preds = %bb2, %bb
%i11 = shl nuw nsw i32 %i10, 1
%i12 = zext i32 %i4 to i64
%i13 = sub nsw i64 0, %i12
%i14 = getelementptr inbounds i8, i8* %arg1, i64 %i13
%i15 = getelementptr inbounds i8, i8* %i14, i64 -1
%i14 = getelementptr inbounds i8, ptr %arg1, i64 %i13
%i15 = getelementptr inbounds i8, ptr %i14, i64 -1
%i16 = zext i32 %i9 to i64
%i17 = getelementptr inbounds [201 x i8], [201 x i8]* @_ZL11DIGIT_TABLE, i64 0, i64 %i16
%i18 = bitcast i8* %i17 to i16*
%i19 = bitcast i8* %i15 to i16*
%i20 = load i16, i16* %i18, align 2
store i16 %i20, i16* %i19, align 1
%i21 = getelementptr inbounds i8, i8* %i14, i64 -3
%i17 = getelementptr inbounds [201 x i8], ptr @_ZL11DIGIT_TABLE, i64 0, i64 %i16
%i20 = load i16, ptr %i17, align 2
store i16 %i20, ptr %i15, align 1
%i21 = getelementptr inbounds i8, ptr %i14, i64 -3
%i22 = zext i32 %i11 to i64
%i23 = getelementptr inbounds [201 x i8], [201 x i8]* @_ZL11DIGIT_TABLE, i64 0, i64 %i22
%i24 = bitcast i8* %i23 to i16*
%i25 = bitcast i8* %i21 to i16*
%i26 = load i16, i16* %i24, align 2
store i16 %i26, i16* %i25, align 1
%i23 = getelementptr inbounds [201 x i8], ptr @_ZL11DIGIT_TABLE, i64 0, i64 %i22
%i26 = load i16, ptr %i23, align 2
store i16 %i26, ptr %i21, align 1
%i27 = add i32 %i4, 4
%i28 = icmp ugt i64 %i3, 99999999
br i1 %i28, label %bb2, label %bb29
Expand Down

0 comments on commit 0d022e7

Please sign in to comment.