Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed May 2, 2024
1 parent 553524b commit 4ed8522
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libclambcc/ClamBCRemovePointerPHIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,25 @@ class ClamBCRemovePointerPHIs : public PassInfoMixin<ClamBCRemovePointerPHIs>
std::vector<Instruction *> 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<PointerType>(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);
Expand Down
1 change: 1 addition & 0 deletions libclambcc/ClamBCWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ class ClamBCWriter : public PassInfoMixin<ClamBCWriter>, public InstVisitor<Clam
Type *pType = operand->getType();
pType = pType->getPointerElementType();

DEBUG_NONPOINTER("REMOVE THIS");
if (not pType->isIntegerTy()) {
DEBUG_VALUE(pGep);
llvm::errs() << "<" << __FUNCTION__ << "::" << __LINE__ << ">" << "EXITING<END>\n";
Expand Down

0 comments on commit 4ed8522

Please sign in to comment.