Skip to content

Commit 365f5e2

Browse files
committed
[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
1 parent 1e34cb0 commit 365f5e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Transforms/Scalar/JumpThreading.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2874,11 +2874,14 @@ bool JumpThreadingPass::tryToUnfoldSelectInCurrBB(BasicBlock *BB) {
28742874
continue;
28752875

28762876
auto isUnfoldCandidate = [BB](SelectInst *SI, Value *V) {
2877+
using namespace PatternMatch;
2878+
28772879
// Check if SI is in BB and use V as condition.
28782880
if (SI->getParent() != BB)
28792881
return false;
28802882
Value *Cond = SI->getCondition();
2881-
return (Cond && Cond == V && Cond->getType()->isIntegerTy(1));
2883+
bool IsAndOr = match(SI, m_CombineOr(m_LogicalAnd(), m_LogicalOr()));
2884+
return Cond && Cond == V && Cond->getType()->isIntegerTy(1) && !IsAndOr;
28822885
};
28832886

28842887
SelectInst *SI = nullptr;

0 commit comments

Comments
 (0)