mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
1edc654103
First attempt at implementing -fsemantic-interposition. Rely on GlobalValue::isInterposable that already captures most of the expected behavior. Rely on a ModuleFlag to state whether we should respect SemanticInterposition or not. The default remains no. So this should be a no-op if -fsemantic-interposition isn't used, and if it is, isInterposable being already used in most optimisation, they should honor it properly. Note that it only impacts architecture compiled with -fPIC and no pie. Differential Revision: https://reviews.llvm.org/D72829
27 lines
578 B
LLVM
27 lines
578 B
LLVM
; Check that @callee1 gets inlined while @callee2 is not, because of
|
|
; SemanticInterposition.
|
|
|
|
; RUN: opt < %s -inline -S | FileCheck %s
|
|
|
|
define internal i32 @callee1(i32 %A) {
|
|
ret i32 %A
|
|
}
|
|
|
|
define i32 @callee2(i32 %A) {
|
|
ret i32 %A
|
|
}
|
|
|
|
; CHECK-LABEL: @caller
|
|
define i32 @caller(i32 %A) {
|
|
; CHECK-NOT: call i32 @callee1(i32 %A)
|
|
%A1 = call i32 @callee1(i32 %A)
|
|
; CHECK: %A2 = call i32 @callee2(i32 %A)
|
|
%A2 = call i32 @callee2(i32 %A)
|
|
; CHECK: add i32 %A, %A2
|
|
%R = add i32 %A1, %A2
|
|
ret i32 %R
|
|
}
|
|
|
|
!llvm.module.flags = !{!0}
|
|
!0 = !{i32 1, !"SemanticInterposition", i32 1}
|