[llvm] 365f5e2 - [JumpThreading] Fix tryToUnfoldSelectInCurrBB to treat and/or and its select form equally
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 01:35:28 PST 2021
Author: Juneyoung Lee
Date: 2021-03-02T18:35:18+09:00
New Revision: 365f5e24758826a6ba4e58ad424b321d3a5c49a2
URL: https://github.com/llvm/llvm-project/commit/365f5e24758826a6ba4e58ad424b321d3a5c49a2
DIFF: https://github.com/llvm/llvm-project/commit/365f5e24758826a6ba4e58ad424b321d3a5c49a2.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Scalar/JumpThreading.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 1a15b8ce041a..05c64f17bd95 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -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;
More information about the llvm-commits
mailing list