mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[DAGCombine] Don't fold dependent loads across SELECT_CC.
DAGCombine will try to fold two loads that feed a SELECT or SELECT_CC after the select, resulting in a select of an address and a single load after. If either of the loads depend on the other, this is not legal as it could introduce cycles. However, it only checked this if the opcode was a SELECT, and not for a SELECT_CC. Unfortunately, the only reproducer I have for this is for our downstream target. I've tried getting it to trigger on an upstream one but haven't been successful. Patch thanks to Bevin Hansson. llvm-svn: 342980
This commit is contained in:
parent
4d1bc5dc43
commit
ba65b2d43a
@ -17873,6 +17873,10 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
LLD->getBasePtr().getValueType()))
|
||||
return false;
|
||||
|
||||
// The loads must not depend on one another.
|
||||
if (LLD->isPredecessorOf(RLD) || RLD->isPredecessorOf(LLD))
|
||||
return false;
|
||||
|
||||
// Check that the select condition doesn't reach either load. If so,
|
||||
// folding this will induce a cycle into the DAG. If not, this is safe to
|
||||
// xform, so create a select of the addresses.
|
||||
@ -17882,10 +17886,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
if ((LLD->hasAnyUseOfValue(1) && LLD->isPredecessorOf(CondNode)) ||
|
||||
(RLD->hasAnyUseOfValue(1) && RLD->isPredecessorOf(CondNode)))
|
||||
return false;
|
||||
// The loads must not depend on one another.
|
||||
if (LLD->isPredecessorOf(RLD) ||
|
||||
RLD->isPredecessorOf(LLD))
|
||||
return false;
|
||||
|
||||
Addr = DAG.getSelect(SDLoc(TheSelect),
|
||||
LLD->getBasePtr().getValueType(),
|
||||
TheSelect->getOperand(0), LLD->getBasePtr(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user