Skip to content

[DirectX] Implement memcpy in DXIL CBuffer Access pass #144436

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

Merged
merged 10 commits into from
Jun 30, 2025
10 changes: 9 additions & 1 deletion llvm/lib/Target/DirectX/DXILCBufferAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
#include "llvm/Frontend/HLSL/CBuffer.h"
#include "llvm/Frontend/HLSL/HLSLResource.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/IntrinsicsDirectX.h"
#include "llvm/IR/Operator.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/Local.h"

#define DEBUG_TYPE "dxil-cbuffer-access"
Expand Down Expand Up @@ -161,7 +164,12 @@ static void replaceAccessesWithHandle(GlobalVariable *Global,
}

// Otherwise, walk users looking for a load...
ToProcess.append(Cur->user_begin(), Cur->user_end());
if (isa<GetElementPtrInst>(Cur) || isa<GEPOperator>(Cur)) {
ToProcess.append(Cur->user_begin(), Cur->user_end());
continue;
}

reportFatalInternalError("Unexpected user of Global");
}
RecursivelyDeleteTriviallyDeadInstructions(DeadInsts);
}
Expand Down