forked from OSchip/llvm-project
[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:
parent
1e34cb008f
commit
365f5e2475
|
@ -2874,11 +2874,14 @@ bool JumpThreadingPass::tryToUnfoldSelectInCurrBB(BasicBlock *BB) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto isUnfoldCandidate = [BB](SelectInst *SI, Value *V) {
|
auto isUnfoldCandidate = [BB](SelectInst *SI, Value *V) {
|
||||||
|
using namespace PatternMatch;
|
||||||
|
|
||||||
// Check if SI is in BB and use V as condition.
|
// Check if SI is in BB and use V as condition.
|
||||||
if (SI->getParent() != BB)
|
if (SI->getParent() != BB)
|
||||||
return false;
|
return false;
|
||||||
Value *Cond = SI->getCondition();
|
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;
|
SelectInst *SI = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue