llvm-project/llvm/test/tools/llvm-reduce/remove-ifunc-constantexpr.ll
Matt Arsenault bc3e492323 llvm-reduce: Reduce ifuncs
Reduce by calling the resolver function at the use site, and inserting
an indirect call. Try to delete if there are no uses left over.

We should also probably try to do something about constantexpr uses;
perhaps treat them like aliases.
2023-01-17 22:33:57 -05:00

28 lines
1009 B
LLVM

; XFAIL: *
; The verifier should xeject this
; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=ifuncs --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s
; CHECK-INTERESTINGNESS: @ifunc_getelementptr
; FIXME: Why is this legal?
@ifunc_getelementptr = ifunc void (), ptr getelementptr (i8, ptr @resolver1, i32 4)
define ptr @resolver1() {
ret ptr inttoptr (i64 123 to ptr)
}
define void @call_ifunc_getelementptr(ptr %ptr) {
; CHECK-FINAL-LABEL: define void @call_ifunc_getelementptr(ptr %ptr) {
; CHECK-FINAL-NEXT: call void @ifunc_getelementptr()
; CHECK-FINAL-NEXT: store ptr @ifunc_getelementptr, ptr %ptr, align 8
; CHECK-FINAL-NEXT: store ptr %ptr, ptr @ifunc_getelementptr, align 8
; CHECK-FINAL-NEXT: ret void
call void @ifunc_getelementptr()
store ptr @ifunc_getelementptr, ptr %ptr
store ptr %ptr, ptr @ifunc_getelementptr
ret void
}