[PATCH] D77795: [GlobalISel] translate freeze to COPY
Dominik Montada via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 06:28:43 PDT 2020
gargaroff updated this revision to Diff 256269.
gargaroff added a comment.
remove unrelated style changes from diff
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77795/new/
https://reviews.llvm.org/D77795
Files:
llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Index: llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
+++ llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
@@ -2360,4 +2360,14 @@
ret i64 %res
}
+define i64 @test_freeze() {
+ ; CHECK-LABEL: name: test_freeze
+ ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
+ ; CHECK-NEXT: [[RES:%[0-9]+]]:_(s64) = COPY [[C]]
+ ; CHECK-NEXT: $x0 = COPY [[RES]]
+ ; CHECK-NEXT: RET_ReallyLR implicit $x0
+ %res = freeze i64 0
+ ret i64 %res
+}
+
!0 = !{ i64 0, i64 2 }
Index: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2104,6 +2104,17 @@
return true;
}
+bool IRTranslator::translateFreeze(const llvm::User &U,
+ llvm::MachineIRBuilder &MIRBuilder) {
+ // TODO: We don't have FREEZE pseudo-instruction in MachineInstr-level now.
+ // If FREEZE instruction is added later, the code below must be changed as
+ // well.
+ const Register DstReg = getOrCreateVReg(U);
+ const Register SrcReg = getOrCreateVReg(*U.getOperand(0));
+ MIRBuilder.buildCopy(DstReg, SrcReg);
+ return true;
+}
+
void IRTranslator::finishPendingPhis() {
#ifndef NDEBUG
DILocationVerifier Verifier;
Index: llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
+++ llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
@@ -453,6 +453,7 @@
bool translateAtomicCmpXchg(const User &U, MachineIRBuilder &MIRBuilder);
bool translateAtomicRMW(const User &U, MachineIRBuilder &MIRBuilder);
bool translateFence(const User &U, MachineIRBuilder &MIRBuilder);
+ bool translateFreeze(const User &U, MachineIRBuilder &MIRBuilder);
// Stubs to keep the compiler happy while we implement the rest of the
// translation.
@@ -483,9 +484,6 @@
bool translateUserOp2(const User &U, MachineIRBuilder &MIRBuilder) {
return false;
}
- bool translateFreeze(const User &U, MachineIRBuilder &MIRBuilder) {
- return false;
- }
/// @}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77795.256269.patch
Type: text/x-patch
Size: 2323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/9c53e352/attachment.bin>
More information about the llvm-commits
mailing list