diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-08 17:43:55 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-08 17:45:33 +0200 |
commit | d686ea32b1af5f0a00fe577f530817c4214e16d0 (patch) | |
tree | 06fa023d544f83657bc477d5b410b2e28dea3538 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 74a8fce6e87e81802b4fe69769daec19504753bf (diff) | |
download | llvm-d686ea32b1af5f0a00fe577f530817c4214e16d0.zip llvm-d686ea32b1af5f0a00fe577f530817c4214e16d0.tar.gz llvm-d686ea32b1af5f0a00fe577f530817c4214e16d0.tar.bz2 |
[ConstantFolding] Guard against unfolded FP binop
Check that the operation actually folded before trying to flush
denormals. A minor variation of the pr33453 test exposed this
with the FP binops marked as undesirable.
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 85d9385..aa4da27be 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1397,6 +1397,8 @@ Constant *llvm::ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, // Calculate constant result. Constant *C = ConstantFoldBinaryOpOperands(Opcode, Op0, Op1, DL); + if (!C) + return nullptr; // Flush denormal output if needed. return FlushFPConstant(C, I, /* IsOutput */ true); |