Author: Benjamin Kramer Date: 2022-10-13T09:46:32+02:00 New Revision: c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b
URL: https://github.com/llvm/llvm-project/commit/c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b DIFF: https://github.com/llvm/llvm-project/commit/c5d950f4699ff0d9eee20fa144a2ef5f2deffa7b.diff LOG: [HLSL] Simplify code and fix unused variable warnings. NFC. Added: Modified: clang/lib/CodeGen/CGHLSLRuntime.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index 245fe88c170f..e1011db758d6 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -98,16 +98,12 @@ GlobalVariable *replaceBuffer(CGHLSLRuntime::Buffer &Buf) { IRBuilder<> B(CBGV->getContext()); Value *ZeroIdx = B.getInt32(0); // Replace Const use with CB use. - for (auto &Const : Buf.Constants) { - llvm::Type *EltTy = Buf.LayoutStruct->getElementType(Const.second); - GlobalVariable *GV = Const.first; - unsigned Offset = Const.second; - + for (auto &[GV, Offset]: Buf.Constants) { Value *GEP = B.CreateGEP(Buf.LayoutStruct, CBGV, {ZeroIdx, B.getInt32(Offset)}); - llvm::Type *GVTy = GV->getValueType(); - assert(EltTy == GVTy && "constant type mismatch"); + assert(Buf.LayoutStruct->getElementType(Offset) == GV->getValueType() && + "constant type mismatch"); // Replace. GV->replaceAllUsesWith(GEP); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits