Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Runs on all bench
Browse files Browse the repository at this point in the history
  • Loading branch information
li3zhen1 committed Mar 19, 2024
1 parent ca07b8a commit d14fac3
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 137 deletions.
Binary file added .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions benchmark/micro_benchmark/test/test3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
static int a[200] = {0};
static int b[20][12] = {0};

void tt(int t[20][20]) { t[1][1] = 1; }

int main() {
int local1d[200] = {0};
local1d[42] = 77;
a[1] = 1;
b[1][1] = 1;
}
20 changes: 15 additions & 5 deletions src/BoundCheckInsertion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,15 @@ PreservedAnalyses BoundCheckInsertion::run(Function &F,
Value *Bound =
cast<ValueAsMetadata>(MN->getOperand(1).get())->getValue();

// llvm::errs() << "Unknown GEP type: ";
// GEP->print(llvm::errs());
Value *subscript = nullptr;
if (GEP->getSourceElementType()->isArrayTy()) {
subscript = GEP->getOperand(2);
subscript = GEP->getOperand(GEP->getNumIndices());
} else if (GEP->getSourceElementType()->isIntegerTy()) {
subscript = GEP->getOperand(1);
} else {

// GEP->print(errs());
subscript = GEP->getOperand(1);
// throw std::runtime_error("Unknown GEP type.");
subscript = GEP->getOperand(GEP->getNumIndices());
}

createCheckBoundCall(&I, Bound, subscript);
Expand Down Expand Up @@ -102,6 +101,17 @@ PreservedAnalyses BoundCheckInsertion::run(Function &F,
}
}
}


for (auto &BB : F) {
// llvm::errs() << "BB: ";
BB.printAsOperand(llvm::errs());
llvm::errs() << "\n";
for (auto &Inst : BB) {
Inst.print(llvm::errs());
llvm::errs() << "\n";
}
}
return PreservedAnalyses::none();
}

Expand Down
Loading

0 comments on commit d14fac3

Please sign in to comment.