From 4ed8522a78ad4bbf3eabce5176638c7556d3c355 Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Thu, 2 May 2024 13:56:58 -0700 Subject: [PATCH] blah --- libclambcc/ClamBCRemovePointerPHIs.cpp | 13 +++++++++++++ libclambcc/ClamBCWriter.cpp | 1 + 2 files changed, 14 insertions(+) diff --git a/libclambcc/ClamBCRemovePointerPHIs.cpp b/libclambcc/ClamBCRemovePointerPHIs.cpp index 1a050569d9..60035c312d 100644 --- a/libclambcc/ClamBCRemovePointerPHIs.cpp +++ b/libclambcc/ClamBCRemovePointerPHIs.cpp @@ -248,12 +248,25 @@ class ClamBCRemovePointerPHIs : public PassInfoMixin std::vector newInsts; Instruction *insPt = findFirstNonPHI(pn->getParent()); + if (pBasePtr->getType() != pn->getType()){ + pBasePtr = CastInst::CreatePointerCast(pBasePtr, pn->getType(), "ClamBCRemovePointerPHIs_cast_", insPt); + } + PointerType *pt = llvm::dyn_cast(pBasePtr->getType()); if (nullptr == pt) { assert(0 && "This pass is only for pointer phis, how did we get here???"); } Type *elementType = pt->getPointerElementType(); + DEBUG_VALUE(pn); + DEBUG_VALUE(pBasePtr); + DEBUG_VALUE(pn->getType()); + DEBUG_VALUE(pBasePtr->getType()); + DEBUG_NONPOINTER((pBasePtr->getType() == pn->getType())); + + DEBUG_VALUE(pBasePtr); + DEBUG_VALUE(elementType); + Instruction *gepiNew = GetElementPtrInst::Create(elementType, pBasePtr, idxNode, "ClamBCRemovePointerPHIs_gepi_", insPt); if (pn->getType() != gepiNew->getType()) { gepiNew = CastInst::CreatePointerCast(gepiNew, pn->getType(), "ClamBCRemovePointerPHIs_cast_", insPt); diff --git a/libclambcc/ClamBCWriter.cpp b/libclambcc/ClamBCWriter.cpp index 7cba33786a..704650daef 100644 --- a/libclambcc/ClamBCWriter.cpp +++ b/libclambcc/ClamBCWriter.cpp @@ -810,6 +810,7 @@ class ClamBCWriter : public PassInfoMixin, public InstVisitorgetType(); pType = pType->getPointerElementType(); + DEBUG_NONPOINTER("REMOVE THIS"); if (not pType->isIntegerTy()) { DEBUG_VALUE(pGep); llvm::errs() << "<" << __FUNCTION__ << "::" << __LINE__ << ">" << "EXITING\n";