Skip to content

Commit

Permalink
PIX: Null check before dyn_cast (#3654) (#3660)
Browse files Browse the repository at this point in the history
dbg.value can occasionally return a null value. (Hit this in a customer (343) shader via PIX.) This is expected. From IntrinsicInst.cpp:

  // When the value goes to null, it gets replaced by an empty MDNode.

Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
  • Loading branch information
jeffnn and Jeff Noyle authored Apr 2, 2021
1 parent 76e7647 commit 1e84ea8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/DxilPIXPasses/PixPassHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ using namespace hlsl;

namespace PIXPassHelpers {
bool IsAllocateRayQueryInstruction(llvm::Value *Val) {
if (llvm::Instruction *Inst = llvm::dyn_cast<llvm::Instruction>(Val)) {
return hlsl::OP::IsDxilOpFuncCallInst(Inst,
hlsl::OP::OpCode::AllocateRayQuery);
if (Val != nullptr) {
if (llvm::Instruction *Inst = llvm::dyn_cast<llvm::Instruction>(Val)) {
return hlsl::OP::IsDxilOpFuncCallInst(Inst,
hlsl::OP::OpCode::AllocateRayQuery);
}
}
return false;
}
Expand Down

0 comments on commit 1e84ea8

Please sign in to comment.