[llvm] [InstCombine] Support well-defined recurrences in isGuaranteedNotToBeUndefOrPoison (PR #150420)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 03:32:36 PDT 2025
================
@@ -7657,6 +7720,13 @@ static bool isGuaranteedNotToBeUndefOrPoison(
}
if (IsWellDefined)
return true;
+
+ bool StartNeedsFreeze;
+ if (canFoldFreezeIntoRecurrence(
+ const_cast<PHINode *>(PN), const_cast<DominatorTree *>(DT),
----------------
david-arm wrote:
Is it possible to avoid the `const_cast` if you change the interface `canFoldFreezeIntoRecurrence` to be
```
Use *llvm::canFoldFreezeIntoRecurrence(
const PHINode *PN, const DominatorTree *DT, bool &StartNeedsFreeze,
```
? I'm just a bit worried that callers of `isGuaranteedNotToBeUndefOrPoison` really expect the `PN` and `DT` objects not to change and by using this cast here you're violating some assumption.
https://github.com/llvm/llvm-project/pull/150420
More information about the llvm-commits
mailing list