[IR] Add Freeze instruction
Summary:
- Define Instruction::Freeze, let it be UnaryOperator
- Add support for freeze to LLLexer/LLParser/BitcodeReader/BitcodeWriter
The format is `%x = freeze <ty> %v`
- Add support for freeze instruction to llvm-c interface.
- Add m_Freeze in PatternMatch.
- Erase freeze when lowering IR to SelDag.
Reviewers: deadalnix, hfinkel, efriedma, lebedev.ri, nlopes, jdoerfert, regehr, filcab, delcypher, whitequark
Reviewed By: lebedev.ri, jdoerfert
Subscribers: jfb, kristof.beyls, hiraditya, lebedev.ri, steven_wu, dexonsmith, xbolva00, delcypher, spatel, regehr, trentxintong, vsk, filcab, nlopes, mehdi_amini, deadalnix, llvm-commits
Differential Revision: https://reviews.llvm.org/D29011
2019-11-05 14:53:22 +08:00
|
|
|
; RUN: llvm-as < %s | llvm-dis > %t.orig
|
|
|
|
; RUN: llvm-as < %s | llvm-c-test --echo > %t.echo
|
|
|
|
; RUN: diff -w %t.orig %t.echo
|
|
|
|
|
|
|
|
%struct.T = type { i32, i32 }
|
|
|
|
|
|
|
|
define i32 @f(i32 %arg, <2 x i32> %arg2, float %arg3, <2 x float> %arg4,
|
|
|
|
i8* %arg5, %struct.T %arg6, [2 x i32] %arg7, { i32, i32 } %arg8) {
|
|
|
|
%1 = freeze i32 %arg
|
|
|
|
%2 = freeze i32 10
|
|
|
|
%3 = freeze i32 %1
|
|
|
|
%4 = freeze i32 undef
|
|
|
|
%5 = freeze i666 11
|
|
|
|
%6 = freeze <2 x i32> %arg2
|
|
|
|
%7 = freeze float %arg3
|
|
|
|
%8 = freeze <2 x float> %arg4
|
|
|
|
%9 = freeze i8* %arg5
|
|
|
|
%10 = freeze %struct.T %arg6
|
|
|
|
%11 = freeze [2 x i32] %arg7
|
|
|
|
%12 = freeze { i32, i32 } %arg8
|
[IR] Redefine Freeze instruction
Summary:
This patch redefines freeze instruction from being UnaryOperator to a subclass of UnaryInstruction.
ConstantExpr freeze is removed, as discussed in the previous review.
FreezeOperator is not added because there's no ConstantExpr freeze.
`freeze i8* null` test is added to `test/Bindings/llvm-c/freeze.ll` as well, because the null pointer-related bug in `tools/llvm-c/echo.cpp` is now fixed.
InstVisitor has visitFreeze now because freeze is not unaryop anymore.
Reviewers: whitequark, deadalnix, craig.topper, jdoerfert, lebedev.ri
Reviewed By: craig.topper, lebedev.ri
Subscribers: regehr, nlopes, mehdi_amini, hiraditya, steven_wu, dexonsmith, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69932
2019-11-07 00:17:49 +08:00
|
|
|
%13 = freeze i8* null
|
[IR] Add Freeze instruction
Summary:
- Define Instruction::Freeze, let it be UnaryOperator
- Add support for freeze to LLLexer/LLParser/BitcodeReader/BitcodeWriter
The format is `%x = freeze <ty> %v`
- Add support for freeze instruction to llvm-c interface.
- Add m_Freeze in PatternMatch.
- Erase freeze when lowering IR to SelDag.
Reviewers: deadalnix, hfinkel, efriedma, lebedev.ri, nlopes, jdoerfert, regehr, filcab, delcypher, whitequark
Reviewed By: lebedev.ri, jdoerfert
Subscribers: jfb, kristof.beyls, hiraditya, lebedev.ri, steven_wu, dexonsmith, xbolva00, delcypher, spatel, regehr, trentxintong, vsk, filcab, nlopes, mehdi_amini, deadalnix, llvm-commits
Differential Revision: https://reviews.llvm.org/D29011
2019-11-05 14:53:22 +08:00
|
|
|
ret i32 %1
|
|
|
|
}
|