Fix compiler error: init-statements in if/switch.

Reviewed By: pifon2a

Differential Revision: https://reviews.llvm.org/D131061
This commit is contained in:
Johannes Reifferscheid 2022-08-03 11:34:51 +02:00
parent 646e2f4803
commit 3e9e43b48e
1 changed files with 2 additions and 2 deletions

View File

@ -7315,8 +7315,8 @@ ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) {
// CreateSCEV calls getNoWrapFlagsFromUB, which under certain conditions
// requires a SCEV for the LHS.
if (NewBO->Op && (NewBO->IsNSW || NewBO->IsNUW)) {
if (auto *I = dyn_cast<Instruction>(NewBO->Op);
I && programUndefinedIfPoison(I)) {
auto *I = dyn_cast<Instruction>(NewBO->Op);
if (I && programUndefinedIfPoison(I)) {
Ops.push_back(BO->LHS);
break;
}