diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -939,11 +939,12 @@ if (isReassociableOp(V1, Instruction::Add, Instruction::FAdd) || isReassociableOp(V1, Instruction::Sub, Instruction::FSub)) return true; - Value *VB = Sub->user_back(); - if (Sub->hasOneUse() && - (isReassociableOp(VB, Instruction::Add, Instruction::FAdd) || - isReassociableOp(VB, Instruction::Sub, Instruction::FSub))) - return true; + if (Sub->hasOneUse()) { + Value *VB = Sub->user_back(); + if (isReassociableOp(VB, Instruction::Add, Instruction::FAdd) || + isReassociableOp(VB, Instruction::Sub, Instruction::FSub)) + return true; + } return false; }