<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66418>66418</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LoopPredication] Wrong widenable branch identification
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
aleks-tmb
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aleks-tmb
</td>
</tr>
</table>
<pre>
We met a testcase with a widenable branch in the form of br(c0 && (c1 && WC)):
```
%wc = call i1 @llvm.experimental.widenable.condition()
%and0 = and i1 %wc, %cond0
%and1 = and i1 %and0, %cond1
br i1 %and1, label %loop, label %deopt
```
That form is going to be supported after we finish GuardWidening reworking from branch widening to widenable conditions widening. But for now we still need to check that widenable branch is in the form of:
`br(widenable_condition & (...))`
That's why the one of the changes in the d6e7c162e1df3736d8e2b3610a831b7cfa5be99b was introduced too early:
```
bool llvm::isWidenableBranch(const User *U) {
- Value *Condition, *WidenableCondition;
- BasicBlock *GuardedBB, *DeoptBB;
- return parseWidenableBranch(U, Condition, WidenableCondition, GuardedBB,
- DeoptBB);
+ return extractWidenableCondition(U) != nullptr;
}
```
We need to revert that change to state that branch above isn't widenable.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE1zszgM_jXORVMGTMLHgUNoJnvZwx62m-OOP5TgrWMztilv__2OgZC0zbwZhmBZj_RYeizmvboYxIbsWkIp0_juX8KVE0rJ7rBhQ-isa1bzhlv52ZwQrhiAQUAfBPMIowodMBiVRMO4RuCOGdGBMhA6hLN1V7Bn4I7QSqRAaEFoAXGR3RanV0Lr-OR7kh5IensX6fJMSwBCd6MAkh9AMK1BZUC2qdYf1wR_9ejUFU1gOlmpJMIaqYKyhtAqxr_HYUamUyRm5BQohib0NX5E1C3n7Jp9c43oB-fsFpi7u0MWHTTjqKNBW9t_MUi0fXh6zvn9d8fCXDzl4WKVuUCwwBH80PfWBZTAzgEdjAh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