Skip to content

Commit

Permalink
llvm2alive: create unique !range regs
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Oct 7, 2024
1 parent 528a5c0 commit 1b7531c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm_util/llvm2alive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ unsigned constexpr_idx;
unsigned copy_idx;
unsigned alignopbundle_idx;
unsigned metadata_idx;
unsigned range_idx;

#define PARSE_UNOP() \
auto ty = llvm_type2alive(i.getType()); \
Expand Down Expand Up @@ -1455,8 +1456,9 @@ class llvm2alive_ : public llvm::InstVisitor<llvm2alive_, unique_ptr<Instr>> {
auto CR = attr.getValueAsConstantRange();
vector<Value*> bounds{ make_intconst(CR.getLower()),
make_intconst(CR.getUpper()) };
string name = "%#range_" + to_string(range_idx++) + "_" + val.getName();
return
make_unique<AssumeVal>(val.getType(), "%#range_" + val.getName(), val,
make_unique<AssumeVal>(val.getType(), std::move(name), val,
std::move(bounds), AssumeVal::Range,
is_welldefined);
}
Expand Down Expand Up @@ -1794,6 +1796,7 @@ class llvm2alive_ : public llvm::InstVisitor<llvm2alive_, unique_ptr<Instr>> {
copy_idx = 0;
alignopbundle_idx = 0;
metadata_idx = 0;
range_idx = 0;

// don't even bother if number of BBs or instructions is huge..
if (distance(f.begin(), f.end()) > 5000 ||
Expand Down

0 comments on commit 1b7531c

Please sign in to comment.