-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[DirectX] Fix build breaks #128556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DirectX] Fix build breaks #128556
Conversation
@llvm/pr-subscribers-backend-directx Author: Farzon Lotfi (farzonl) Changes
Full diff: https://github.com/llvm/llvm-project/pull/128556.diff 5 Files Affected:
diff --git a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
index 543fbd10db230..a65a619bfc9c3 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
@@ -243,6 +243,10 @@ class DXILBitcodeWriter {
}
void writeDIDerivedType(const DIDerivedType *N,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev);
+ void writeDISubrangeType(const DISubrangeType *N,
+ SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
+ llvm_unreachable("DXIL cannot contain DISubrangeType Nodes");
+ }
void writeDICompositeType(const DICompositeType *N,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev);
void writeDISubroutineType(const DISubroutineType *N,
diff --git a/llvm/lib/Target/DirectX/DirectXInstrInfo.h b/llvm/lib/Target/DirectX/DirectXInstrInfo.h
index 4fe79ee547fe1..e2c7036fc74a7 100644
--- a/llvm/lib/Target/DirectX/DirectXInstrInfo.h
+++ b/llvm/lib/Target/DirectX/DirectXInstrInfo.h
@@ -21,8 +21,9 @@
namespace llvm {
struct DirectXInstrInfo : public DirectXGenInstrInfo {
+ const DirectXRegisterInfo RI;
explicit DirectXInstrInfo() : DirectXGenInstrInfo() {}
-
+ const DirectXRegisterInfo &getRegisterInfo() const { return RI; }
~DirectXInstrInfo() override;
};
} // namespace llvm
diff --git a/llvm/lib/Target/DirectX/DirectXRegisterInfo.cpp b/llvm/lib/Target/DirectX/DirectXRegisterInfo.cpp
index c54b494f37304..690a9afdd5e2a 100644
--- a/llvm/lib/Target/DirectX/DirectXRegisterInfo.cpp
+++ b/llvm/lib/Target/DirectX/DirectXRegisterInfo.cpp
@@ -22,3 +22,24 @@
using namespace llvm;
DirectXRegisterInfo::~DirectXRegisterInfo() {}
+
+const MCPhysReg *
+DirectXRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
+ return nullptr;
+}
+BitVector
+DirectXRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
+ return BitVector(getNumRegs());
+}
+
+bool DirectXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
+ int SPAdj, unsigned FIOperandNum,
+ RegScavenger *RS) const {
+ return false;
+}
+
+// Debug information queries.
+Register
+DirectXRegisterInfo::getFrameRegister(const MachineFunction &MF) const {
+ return Register();
+}
diff --git a/llvm/lib/Target/DirectX/DirectXRegisterInfo.h b/llvm/lib/Target/DirectX/DirectXRegisterInfo.h
index 023c5c3ef337f..3e750bb4f89b2 100644
--- a/llvm/lib/Target/DirectX/DirectXRegisterInfo.h
+++ b/llvm/lib/Target/DirectX/DirectXRegisterInfo.h
@@ -22,6 +22,14 @@ namespace llvm {
struct DirectXRegisterInfo : public DirectXGenRegisterInfo {
DirectXRegisterInfo() : DirectXGenRegisterInfo(0) {}
~DirectXRegisterInfo();
+
+ const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
+ BitVector getReservedRegs(const MachineFunction &MF) const override;
+ bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
+ unsigned FIOperandNum,
+ RegScavenger *RS = nullptr) const override;
+ // Debug information queries.
+ Register getFrameRegister(const MachineFunction &MF) const override;
};
} // namespace llvm
diff --git a/llvm/lib/Target/DirectX/DirectXSubtarget.h b/llvm/lib/Target/DirectX/DirectXSubtarget.h
index 464d05a0e1ffe..b2374caaf3cdf 100644
--- a/llvm/lib/Target/DirectX/DirectXSubtarget.h
+++ b/llvm/lib/Target/DirectX/DirectXSubtarget.h
@@ -49,6 +49,10 @@ class DirectXSubtarget : public DirectXGenSubtargetInfo {
const DirectXFrameLowering *getFrameLowering() const override { return &FL; }
const DirectXInstrInfo *getInstrInfo() const override { return &InstrInfo; }
+
+ const DirectXRegisterInfo *getRegisterInfo() const override {
+ return &InstrInfo.getRegisterInfo();
+ }
};
} // end namespace llvm
|
@@ -22,6 +22,14 @@ namespace llvm { | |||
struct DirectXRegisterInfo : public DirectXGenRegisterInfo { | |||
DirectXRegisterInfo() : DirectXGenRegisterInfo(0) {} | |||
~DirectXRegisterInfo(); | |||
|
|||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to implement these overrides to be able to create an instance of DirectXRegisterInfo
in llvm/lib/Target/DirectX/DirectXInstrInfo.h
✅ With the latest revision this PR passed the C/C++ code formatter. |
@@ -243,6 +243,10 @@ class DXILBitcodeWriter { | |||
} | |||
void writeDIDerivedType(const DIDerivedType *N, | |||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev); | |||
void writeDISubrangeType(const DISubrangeType *N, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a virtual function impl? It'd be great if this file used "override". (Probably out of scope for this change)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No its caused by HANDLE_SPECIALIZED_MDNODE_LEAF_UNIQUABLE(DISubrangeType)
in llvm/include/llvm/IR/Metadata.def
line 121. This is because llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
uses Metadata.def
in DXILBitcodeWriter::writeMetadataRecords
All exisitng 201 DirectX tests pass. This is in effect a NFC as everything is more or less a stub to get the build fixed. |
1. Fix build break caused by llvm#126772 by adding `writeDISubrangeType` stub to `DXILBitcodeWriter.cpp` 2. Fix build break caused by llvm#128480 by adding implementation of pure virtual method `TargetSubtargetInfo::getRegisterInfo`
b558c4e
to
a34b101
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but probably want a review from someone more familiar with part of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Heads up: 28 DirectX tests are failing when ran under my hwasan build of this PR's branch. It appears to be because of
Replacing |
writeDISubrangeType
stub toDXILBitcodeWriter.cpp
TargetSubtargetInfo::getRegisterInfo