[JumpThreading] Fix tryToUnfoldSelectInCurrBB to treat and/or and its select form equally

This is a minor fix to update tryToUnfoldSelectInCurrBB to ignore select
form of and/ors because the function does not look into binops as well
This commit is contained in:
Juneyoung Lee 2021-03-02 18:34:32 +09:00
parent 1e34cb008f
commit 365f5e2475
1 changed files with 4 additions and 1 deletions

View File

@ -2874,11 +2874,14 @@ bool JumpThreadingPass::tryToUnfoldSelectInCurrBB(BasicBlock *BB) {
continue;
auto isUnfoldCandidate = [BB](SelectInst *SI, Value *V) {
using namespace PatternMatch;
// Check if SI is in BB and use V as condition.
if (SI->getParent() != BB)
return false;
Value *Cond = SI->getCondition();
return (Cond && Cond == V && Cond->getType()->isIntegerTy(1));
bool IsAndOr = match(SI, m_CombineOr(m_LogicalAnd(), m_LogicalOr()));
return Cond && Cond == V && Cond->getType()->isIntegerTy(1) && !IsAndOr;
};
SelectInst *SI = nullptr;