[llvm] [ValueTracking] Fix crash in PR175590 (PR #180355)
Kshitij Paranjape via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 07:18:49 PST 2026
================
@@ -9248,6 +9289,40 @@ static bool matchTwoInputRecurrence(const PHINode *PN, InstTy *&Inst,
return false;
}
+template <typename InstTy>
+static bool matchThreeInputRecurrence(const PHINode *PN, InstTy *&Inst,
+ Value *&Init, Value *&OtherOp0,
+ Value *&OtherOp1) {
+ if (PN->getNumIncomingValues() != 2)
+ return false;
+
+ for (unsigned I = 0; I != 2; ++I) {
+ if (auto *Operation = dyn_cast<InstTy>(PN->getIncomingValue(I));
+ Operation) {
----------------
kshitijvp wrote:
Is that the reason for the crash, although I can't understand how.
Because `matchThreeInputRecurrence` is being called only through `matchSimpleTernaryIntrinsicRecurrence` where the arguments are checked as:
```
if (I->arg_size() != 3 || I->getType() != I->getArgOperand(0)->getType() ||
I->getType() != I->getArgOperand(1)->getType() ||
I->getType() != I->getArgOperand(2)->getType())
return false;
```
https://github.com/llvm/llvm-project/pull/180355
More information about the llvm-commits
mailing list