Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 0d4e7c6

Browse files
committed
temp
1 parent f589d86 commit 0d4e7c6

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111
if (NOT LLVM_BUILD_TYPE)
1212
set(LLVM_BUILD_TYPE ${CMAKE_BUILD_TYPE})
1313
endif()
14-
set(LLVM_CONFIG_EXECUTABLE ${CMAKE_SOURCE_DIR}/third_party/llvm-${LLVM_BUILD_TYPE}-install/bin/llvm-config)
14+
set(LLVM_CONFIG_EXECUTABLE ${CMAKE_SOURCE_DIR}/third_party/llvm-Release-install/bin/llvm-config)
1515
if(NOT EXISTS ${LLVM_CONFIG_EXECUTABLE})
1616
message(FATAL_ERROR "llvm-config could not be found!")
1717
endif()

lib/Infer/Preconditions.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#include <llvm/Support/CommandLine.h>
55
using llvm::APInt;
66

7+
static llvm::cl::opt<bool> FixitNoVar("fixit-no-vars",
8+
llvm::cl::desc("Do not restrict vars."
9+
"(default=false)"),
10+
llvm::cl::init(false));
11+
712
namespace souper {
813
std::vector<std::map<Inst *, llvm::KnownBits>>
914
inferAbstractKBPreconditions(SynthesisContext &SC, Inst *RHS,
@@ -35,6 +40,16 @@ std::vector<std::map<Inst *, llvm::KnownBits>>
3540
std::vector<Inst *> Vars;
3641
findVars(Mapping.LHS, Vars);
3742

43+
std::set<Inst *> FilteredVars;
44+
45+
for (auto Var : Vars) {
46+
std::string NamePrefix = Var->Name;
47+
NamePrefix.resize(4);
48+
if (!FixitNoVar || Var->K != Inst::Var || NamePrefix == "fake") {
49+
FilteredVars.insert(Var);
50+
}
51+
}
52+
3853
std::map<Inst *, VarInfo> OriginalState;
3954

4055
for (auto V : Vars) {
@@ -106,6 +121,11 @@ std::vector<std::map<Inst *, llvm::KnownBits>>
106121
std::map<Inst *, llvm::KnownBits> Known;
107122
if (FoundWeakest) {
108123
for (unsigned J = 0; J < ModelInsts.size(); ++J) {
124+
if (FilteredVars.find(ModelInsts[J]) == FilteredVars.end()) {
125+
Known[ModelInsts[J]].One = llvm::APInt(ModelInsts[J]->Width, 0);
126+
Known[ModelInsts[J]].Zero = llvm::APInt(ModelInsts[J]->Width, 0);
127+
continue;
128+
}
109129
llvm::KnownBits KBCurrent(ModelInsts[J]->Width);
110130
Known[ModelInsts[J]].One = ModelVals[J];
111131
if (DebugLevel >= 3) {
@@ -126,10 +146,16 @@ std::vector<std::map<Inst *, llvm::KnownBits>>
126146
}
127147
}
128148
for (unsigned J = 0; J < Vars.size(); ++J) {
149+
if (FilteredVars.find(Vars[J]) == FilteredVars.end()) {
150+
continue;
151+
}
129152
Vars[J]->KnownZeros = Known[Vars[J]].Zero;
130153
Vars[J]->KnownOnes = Known[Vars[J]].One;
131154
}
132155
for (unsigned J = 0; J < Vars.size(); ++J) {
156+
if (FilteredVars.find(Vars[J]) == FilteredVars.end()) {
157+
continue;
158+
}
133159
auto W = Vars[J]->Width;
134160
for (unsigned I=0; I< W; I++) {
135161
if (Known[Vars[J]].Zero[I]) {

0 commit comments

Comments
 (0)