@@ -59,18 +59,6 @@ static Value *createLogicFromTable3Var(const std::bitset<8> &Table, Value *Op0,
59
59
Value *Op1, Value *Op2, Value *Root,
60
60
IRBuilderBase &Builder, bool HasOneUse) {
61
61
uint8_t TruthValue = Table.to_ulong ();
62
-
63
- // Skip transformation if expression is already simple (at most 2 levels
64
- // deep).
65
- if (Root->hasOneUse () && isa<BinaryOperator>(Root)) {
66
- if (auto *BO = dyn_cast<BinaryOperator>(Root)) {
67
- bool IsSimple = !isa<BinaryOperator>(BO->getOperand (0 )) ||
68
- !isa<BinaryOperator>(BO->getOperand (1 ));
69
- if (IsSimple)
70
- return nullptr ;
71
- }
72
- }
73
-
74
62
auto FoldConstant = [&](bool Val) {
75
63
Constant *Res = Val ? Builder.getTrue () : Builder.getFalse ();
76
64
if (Op0->getType ()->isVectorTy ())
@@ -230,6 +218,17 @@ static Value *foldThreeVarBoolExpr(Value *Root,
230
218
if (!isa<BinaryOperator>(Root))
231
219
return nullptr ;
232
220
221
+ // Skip transformation if expression is already simple (at most 2 levels
222
+ // deep).
223
+ if (Root->hasOneUse () && isa<BinaryOperator>(Root)) {
224
+ if (auto *BO = dyn_cast<BinaryOperator>(Root)) {
225
+ bool IsSimple = !isa<BinaryOperator>(BO->getOperand (0 )) ||
226
+ !isa<BinaryOperator>(BO->getOperand (1 ));
227
+ if (IsSimple)
228
+ return nullptr ;
229
+ }
230
+ }
231
+
233
232
auto [Op0, Op1, Op2] = extractThreeVariables (Root);
234
233
if (!Op0 || !Op1 || !Op2)
235
234
return nullptr ;
0 commit comments