The previous position of llvm.protected.field.ptr lowering for loads and stores was problematic as it not only inhibited optimizations such as DSE (as stores to a llvm.protected.field.ptr were not considered to must-alias stores to the non-protected.field pointer) but also required changes to other optimization passes to avoid transformations that would reduce PFP coverage. Address this by moving the load/store part of the lowering to InstCombine, where it will run earlier than the PFP-breaking and AA-relying transformations. The deactivation symbol, null comparison and EmuPAC parts of the lowering remain in PreISelLowering. Now that the transformation inhibitions are no longer needed, remove them (i.e. partially revert #151649, and revert #182976). This change resulted in a 2.4% reduction in Fleetbench .text size and the following improvements to PFP performance overhead for BM_PROTO_Arena on various microarchitectures: before after Apple M2 Ultra 3.5% 3.3% Google Axion C4A 3.3% 2.9% Google Axion N4A 2.7% 2.2% Reviewers: fmayer, nikic, vitalybuka Reviewed By: fmayer Pull Request: https://github.com/llvm/llvm-project/pull/186548
43 lines
1.5 KiB
LLVM
43 lines
1.5 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
|
|
; RUN: opt -passes=pre-isel-intrinsic-lowering -mattr=+pauth -S < %s | FileCheck %s
|
|
|
|
target triple = "aarch64-unknown-linux-gnu"
|
|
|
|
@ds1 = external global i8
|
|
@ds2 = external global i8
|
|
|
|
|
|
;.
|
|
; CHECK: @ds1 = external global i8
|
|
; CHECK: @ds2 = hidden alias i8, inttoptr (i64 3573751839 to ptr)
|
|
;.
|
|
define i1 @compare(ptr %ptrptr) {
|
|
; CHECK-LABEL: define i1 @compare(
|
|
; CHECK-SAME: ptr [[PTRPTR:%.*]]) #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[PTRPTR]], null
|
|
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq ptr null, [[PTRPTR]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = or i1 [[CMP1]], [[CMP2]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%protptrptr = call ptr @llvm.protected.field.ptr.p0(ptr %ptrptr, i64 3, i1 true) [ "deactivation-symbol"(ptr @ds1) ]
|
|
%cmp1 = icmp eq ptr %protptrptr, null
|
|
%cmp2 = icmp eq ptr null, %protptrptr
|
|
%cmp = or i1 %cmp1, %cmp2
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define ptr @escape(ptr %ptrptr) {
|
|
; CHECK-LABEL: define ptr @escape(
|
|
; CHECK-SAME: ptr [[PTRPTR:%.*]]) #[[ATTR0]] {
|
|
; CHECK-NEXT: ret ptr [[PTRPTR]]
|
|
;
|
|
%protptrptr = call ptr @llvm.protected.field.ptr.p0(ptr %ptrptr, i64 3, i1 true) [ "deactivation-symbol"(ptr @ds2) ]
|
|
ret ptr %protptrptr
|
|
}
|
|
|
|
declare ptr @llvm.protected.field.ptr.p0(ptr, i64, i1 immarg)
|
|
;.
|
|
; CHECK: attributes #[[ATTR0]] = { "target-features"="+pauth" }
|
|
; CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(none) "target-features"="+pauth" }
|
|
;.
|