@@ -155,6 +155,14 @@ PATH_info lifterClass::solvePath(Function* function, uint64_t& dest,
155
155
return nullopt;
156
156
};
157
157
Value* condition = nullptr ;
158
+
159
+ // condition value is a kind of hack
160
+ // 1- if its a select, we can extract the condition
161
+ // 1a- if firstcase is in the select, extract the condition
162
+ // 1b- if secondcase is in the select, extract the condition and reverse
163
+ // values
164
+ // 2- create a hacky compare for condition == potentialvalue
165
+
158
166
if (auto can_simplify = try_simplify (firstcase, simplifyValue))
159
167
condition = can_simplify.value ();
160
168
else if (auto can_simplify2 = try_simplify (secondcase, simplifyValue)) {
@@ -166,21 +174,21 @@ PATH_info lifterClass::solvePath(Function* function, uint64_t& dest,
166
174
builder.getIntN (simplifyValue->getType ()->getIntegerBitWidth (),
167
175
firstcase.getZExtValue ()));
168
176
printvalue (condition);
169
- auto BR = builder.CreateCondBr (condition, bb_false, bb_true );
177
+ auto BR = builder.CreateCondBr (condition, bb_true, bb_false );
170
178
171
179
RegisterBranch (BR);
172
180
173
181
printvalue2 (firstcase);
174
182
printvalue2 (secondcase);
175
- blockInfo = BBInfo (secondcase.getZExtValue (), bb_true );
183
+ blockInfo = BBInfo (secondcase.getZExtValue (), bb_false );
176
184
// for [this], we can assume condition is true
177
185
// we can simplify any value tied to is dependent on condition,
178
186
// and try to simplify any value calculates condition
179
187
180
188
lifterClass* newlifter = new lifterClass (*this );
181
189
182
190
// for [newlifter], we can assume condition is false
183
- newlifter->blockInfo = BBInfo (firstcase.getZExtValue (), bb_false );
191
+ newlifter->blockInfo = BBInfo (firstcase.getZExtValue (), bb_true );
184
192
printvalue (condition);
185
193
newlifter->assumptions [cast<Instruction>(condition)] = 1 ;
186
194
0 commit comments