Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions llvm/test/Transforms/PartiallyInlineLibCalls/X86/good-prototype.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
; RUN: opt -S -passes=partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s

define float @f(float %val) {
; CHECK-LABEL: @f(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #[[READNONE:.*]]
; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp oge float [[VAL]], 0.000000e+00
; CHECK-NEXT: br i1 [[TMP0]], label [[ENTRY_SPLIT:%.*]], label [[CALL_SQRT:%.*]]
; CHECK: call.sqrt:
Expand All @@ -21,14 +21,32 @@ entry:

define float @f_writeonly(float %val) {
; CHECK-LABEL: @f_writeonly(
; CHECK-NEXt: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #[[READNONE]]
; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #[[ATTR0]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp oge float [[VAL]], 0.000000e+00
; CHECK-NEXT: br i1 [[TMP1]], label [[DOTSPLIT:%.*]], label [[CALL_SQRT:%.*]]
; CHECK: call.sqrt:
; CHECK-NEXT: [[TMP2:%.*]] = tail call float @sqrtf(float [[VAL]]) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: br label [[DOTSPLIT]]
; CHECK: .split:
; CHECK-NEXT: [[TMP3:%.*]] = phi float [ [[RES]], [[TMP0:%.*]] ], [ [[TMP2]], [[CALL_SQRT]] ]
; CHECK-NEXT: ret float [[TMP3]]
;
%res = tail call float @sqrtf(float %val) writeonly
ret float %res
}

define float @f_readonly(float %val) {
; CHECK-LABEL: @f_readonly(
; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: ret float [[RES]]
;
%res = tail call float @sqrtf(float %val) readonly
ret float %res
}

declare float @sqrtf(float)
;.
; CHECK: attributes #[[ATTR0]] = { memory(none) }
; CHECK: attributes #[[ATTR1]] = { memory(write) }
; CHECK: attributes #[[ATTR2]] = { memory(read) }
;.
Loading