Skip to content

Commit

Permalink
[Transforms][DXIL] Basic debug output in dxil-upgrade. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
bogner committed Dec 20, 2023
1 parent bbc2976 commit 1f3d70a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions llvm/lib/Transforms/Utils/DXILUpgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
//===----------------------------------------------------------------------===//

#include "llvm/Transforms/Utils/DXILUpgrade.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"

using namespace llvm;

#define DEBUG_TYPE "dxil-upgrade"

static bool handleValVerMetadata(Module &M) {
NamedMDNode *ValVer = M.getNamedMetadata("dx.valver");
if (!ValVer)
return false;

LLVM_DEBUG({
MDNode *N = ValVer->getOperand(0);
auto X = mdconst::extract<ConstantInt>(N->getOperand(0))->getZExtValue();
auto Y = mdconst::extract<ConstantInt>(N->getOperand(1))->getZExtValue();
dbgs() << "DXIL: validation version: " << X << "." << Y << "\n";
});
// We don't need the validation version internally, so we drop it.
ValVer->dropAllReferences();
ValVer->eraseFromParent();
Expand Down

0 comments on commit 1f3d70a

Please sign in to comment.