Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
; Test that update_test_checks.py can run pre-processing commands.
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s --check-prefix=CHECK-AS200
; RUN: sed -e 's/addrspace(200)/addrspace(0)/g' -e 's/-A200-P200-G200//g' %s \
; RUN:   | opt -passes=instsimplify -S | FileCheck %s --check-prefix=CHECK-AS0
; Check that multiple pre-processing commands are handled
; RUN: sed 's/addrspace(200)/addrspace(1)/g' %s | sed 's/-A1-P1-G1//g' \
; RUN:   | opt -passes=instsimplify -S | FileCheck %s --check-prefix=CHECK-AS1
; More than two commands should also be fine
; RUN: cat %s | cat | cat | cat | opt < %s -passes=instsimplify -S \
; RUN:   | FileCheck %s --check-prefix=CHECK-AS200-NOOP-PRE-PROCESS

target datalayout = "e-m:e-p200:128:128:128:64-p:64:64-A200-P200-G200"

define i8 addrspace(200)* @test_zerogep_in_different_as(i8 addrspace(200)* %arg) addrspace(200) nounwind {
; CHECK-AS200-LABEL: define {{[^@]+}}@test_zerogep_in_different_as
; CHECK-AS200-SAME: (i8 addrspace(200)* [[ARG:%.*]]) addrspace(200) #[[ATTR0:[0-9]+]] {
; CHECK-AS200-NEXT:  entry:
; CHECK-AS200-NEXT:    ret i8 addrspace(200)* [[ARG]]
;
; CHECK-AS0-LABEL: define {{[^@]+}}@test_zerogep_in_different_as
; CHECK-AS0-SAME: (i8* [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-AS0-NEXT:  entry:
; CHECK-AS0-NEXT:    ret i8* [[ARG]]
;
; CHECK-AS1-LABEL: define {{[^@]+}}@test_zerogep_in_different_as
; CHECK-AS1-SAME: (i8 addrspace(1)* [[ARG:%.*]]) addrspace(1) #[[ATTR0:[0-9]+]] {
; CHECK-AS1-NEXT:  entry:
; CHECK-AS1-NEXT:    ret i8 addrspace(1)* [[ARG]]
;
; CHECK-AS200-NOOP-PRE-PROCESS-LABEL: define {{[^@]+}}@test_zerogep_in_different_as
; CHECK-AS200-NOOP-PRE-PROCESS-SAME: (i8 addrspace(200)* [[ARG:%.*]]) addrspace(200) #[[ATTR0:[0-9]+]] {
; CHECK-AS200-NOOP-PRE-PROCESS-NEXT:  entry:
; CHECK-AS200-NOOP-PRE-PROCESS-NEXT:    ret i8 addrspace(200)* [[ARG]]
;
entry:
  %ret = getelementptr inbounds i8, i8 addrspace(200)* %arg, i64 0
  ret i8 addrspace(200)* %ret
}