mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-18 21:24:32 -04:00
[WideableCond] Fix a nasty bug in detection of "explicit guards"
The code was failing to actually check for the presence of the call to widenable_condition. The whole point of specifying the widenable_condition intrinsic was allowing widening transforms. A normal branch is not widenable. A normal branch leading to a deopt is not widenable (in general). I added a test case via LoopPredication, but GuardWidening has an analogous bug. Those are the only two passes actually using this utility just yet. Noticed while working on LoopPredication for non-widenable branches; POC in D60111. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -39,6 +39,11 @@ bool llvm::parseWidenableBranch(const User *U, Value *&Condition,
|
||||
Value *&WidenableCondition,
|
||||
BasicBlock *&IfTrueBB, BasicBlock *&IfFalseBB) {
|
||||
using namespace llvm::PatternMatch;
|
||||
return match(U, m_Br(m_And(m_Value(Condition), m_Value(WidenableCondition)),
|
||||
IfTrueBB, IfFalseBB));
|
||||
if (!match(U, m_Br(m_And(m_Value(Condition), m_Value(WidenableCondition)),
|
||||
IfTrueBB, IfFalseBB)))
|
||||
return false;
|
||||
// TODO: At the moment, we only recognize the branch if the WC call in this
|
||||
// specific position. We should generalize!
|
||||
return match(WidenableCondition,
|
||||
m_Intrinsic<Intrinsic::experimental_widenable_condition>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user