Files
clang-p2996/llvm/test/Transforms/MergeFunc/inline-asm.ll
Craig Topper 784929d045 Implementation of asm-goto support in LLVM
This patch accompanies the RFC posted here:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/127239.html

This patch adds a new CallBr IR instruction to support asm-goto
inline assembly like gcc as used by the linux kernel. This
instruction is both a call instruction and a terminator
instruction with multiple successors. Only inline assembly
usage is supported today.

This also adds a new INLINEASM_BR opcode to SelectionDAG and
MachineIR to represent an INLINEASM block that is also
considered a terminator instruction.

There will likely be more bug fixes and optimizations to follow
this, but we felt it had reached a point where we would like to
switch to an incremental development model.

Patch by Craig Topper, Alexander Ivchenko, Mikhail Dvoretckii

Differential Revision: https://reviews.llvm.org/D53765

llvm-svn: 353563
2019-02-08 20:48:56 +00:00

54 lines
1.2 KiB
LLVM

; RUN: opt -mergefunc -S < %s | FileCheck %s
; CHECK-LABEL: @int_ptr_arg_different
; CHECK-NEXT: call void asm
; CHECK-LABEL: @int_ptr_null
; CHECK-NEXT: tail call void @float_ptr_null()
; CHECK-LABEL: @int_ptr_arg_same
; CHECK-NEXT: %2 = bitcast i32* %0 to float*
; CHECK-NEXT: tail call void @float_ptr_arg_same(float* %2)
; Used to satisfy minimum size limit
declare void @stuff()
; Can be merged
define void @float_ptr_null() {
call void asm "nop", "r"(float* null)
call void @stuff()
ret void
}
define void @int_ptr_null() {
call void asm "nop", "r"(i32* null)
call void @stuff()
ret void
}
; Can be merged (uses same argument differing by pointer type)
define void @float_ptr_arg_same(float*) {
call void asm "nop", "r"(float* %0)
call void @stuff()
ret void
}
define void @int_ptr_arg_same(i32*) {
call void asm "nop", "r"(i32* %0)
call void @stuff()
ret void
}
; Can not be merged (uses different arguments)
define void @float_ptr_arg_different(float*, float*) {
call void asm "nop", "r"(float* %0)
call void @stuff()
ret void
}
define void @int_ptr_arg_different(i32*, i32*) {
call void asm "nop", "r"(i32* %1)
call void @stuff()
ret void
}