Skip to content
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

LLVM: Bump to LLVM 18 #454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 171 additions & 176 deletions CMakeLists.txt

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions include/dg/llvm/LLVMSlicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define LLVM_DG_SLICER_H_

#include <llvm/Config/llvm-config.h>
#include <llvm/IR/Module.h>
#if ((LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR < 5))
#include <llvm/Support/CFG.h>
#else
Expand Down Expand Up @@ -228,7 +229,7 @@ void sliceCallNode(LLVMNode *callNode, uint32_t slice_id)

Value *fval = graph->getEntry()->getKey();
Function *F = cast<Function>(fval);
F->getBasicBlockList().push_back(block);
F->insert(F->end(), block);

// fill in basic block just with return value
ReturnInst *RI;
Expand Down Expand Up @@ -585,7 +586,7 @@ void sliceCallNode(LLVMNode *callNode, uint32_t slice_id)

// set it as a new entry by pusing the block to the front
// of the list
F->getBasicBlockList().push_front(block);
F->insert(F->begin(), block);

// FIXME: propagate this change to dependence graph
}
Expand Down
3 changes: 2 additions & 1 deletion lib/llvm/LLVMDependenceGraph.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <llvm/IR/IntrinsicInst.h>
#include <set>
#include <unordered_map>
#include <utility>
Expand Down Expand Up @@ -1258,7 +1259,7 @@ void LLVMDependenceGraph::addDefUseEdges(bool preserveDbg) {
else if (auto *DI = dyn_cast<DbgValueInst>(&I))
val = DI->getValue();
#if LLVM_VERSION_MAJOR > 5
else if (auto *DI = dyn_cast<DbgAddrIntrinsic>(&I))
else if (auto *DI = dyn_cast<DbgAssignIntrinsic>(&I))
val = DI->getAddress();
#endif

Expand Down
2 changes: 1 addition & 1 deletion lib/llvm/PointerAnalysis/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Pointer
LLVMPointerGraphBuilder::handleConstantBitCast(const llvm::CastInst *BC) {
using namespace llvm;

if (!BC->isLosslessCast()) {
if (!BC->getSrcTy()->canLosslesslyBitCastTo(BC->getDestTy())) {
// If this is a cast to a bigger type (if that can ever happen?),
// then preserve the pointer. Otherwise, the pointer is cropped,
// and there's nothing we can do...
Expand Down
4 changes: 3 additions & 1 deletion lib/llvm/PointerAnalysis/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ void LLVMPointerGraphBuilder::handleGlobalVariableInitializer(

static uint64_t getAllocatedSize(const llvm::GlobalVariable *GV,
const llvm::DataLayout *DL) {
llvm::Type *Ty = GV->getType()->getContainedType(0);
if (!GV->hasInitializer())
return 0;
llvm::Type *Ty = GV->getInitializer()->getType();
if (!Ty->isSized())
return 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/llvm/PointerAnalysis/Instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Offset accumulateEVOffsets(const llvm::ExtractValueInst *EV,
if (llvm::StructType *STy = llvm::dyn_cast<llvm::StructType>(type)) {
assert(STy->indexValid(idx) && "Invalid index");
const llvm::StructLayout *SL = DL.getStructLayout(STy);
off += SL->getElementOffset(idx);
off += SL->getElementOffset(idx).getFixedValue();
} else {
// array or vector, so just move in the array
if (auto *arrTy = llvm::dyn_cast<llvm::ArrayType>(type)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/llvm/PointerAnalysis/Structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void LLVMPointerGraphBuilder::addCFGEdges(
// check whether we created the entry block. If not, we would
// have a problem while adding successors, so fake that
// the entry block is the root or the last argument
const llvm::BasicBlock *entry = &F->getBasicBlockList().front();
const llvm::BasicBlock *entry = &F->front();
auto it = finfo.llvmBlocks.find(entry);
if (it != finfo.llvmBlocks.end()) {
// if we have the entry block, just make it the successor
Expand Down
3 changes: 2 additions & 1 deletion lib/llvm/ValueRelations/RelationsAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ void RelationsAnalyzer::remGen(ValueRelations &graph,

void RelationsAnalyzer::castGen(ValueRelations &graph,
const llvm::CastInst *cast) {
if (cast->isLosslessCast() || cast->isNoopCast(module.getDataLayout()))
if (cast->getSrcTy()->canLosslesslyBitCastTo(cast->getDestTy()) ||
cast->isNoopCast(module.getDataLayout()))
graph.setEqual(cast, cast->getOperand(0));
}

Expand Down
2 changes: 1 addition & 1 deletion tools/include/dg/tools/llvm-slicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class ModuleWriter {
globals.insert(gv);
}

for (GlobalAlias &ga : M->getAliasList()) {
for (GlobalAlias &ga : M->aliases()) {
if (ga.hasNUses(0))
aliases.insert(&ga);
}
Expand Down
Loading