aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-08-21 16:10:02 +0100
committerFlorian Hahn <flo@fhahn.com>2020-08-21 16:50:56 +0100
commitbc72a3ab949e14b990c080985fc1e74475f1e7d2 (patch)
treeb8cef97e4f23329d0e74096cc4a5c336b6725f9e /llvm/lib/IR/Constants.cpp
parent365f861c45bb504c7b61f64943916fc570818cd1 (diff)
downloadllvm-bc72a3ab949e14b990c080985fc1e74475f1e7d2.zip
llvm-bc72a3ab949e14b990c080985fc1e74475f1e7d2.tar.gz
llvm-bc72a3ab949e14b990c080985fc1e74475f1e7d2.tar.bz2
[Constants] Handle FNeg in getWithOperands.
Currently ConstantExpr::getWithOperands does not handle FNeg and subsequently treats FNeg as binary operator, leading to an assertion failure or segmentation fault if built without assertions. Originally I reproduced this with llvm-dis on a bitcode file, which I unfortunately cannot share and also cannot really reduce. But PR45426 describes the same issue and has a reproducer with Clang, so I'll go with that. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D86274
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index b252ef7..1cd2ced 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1441,6 +1441,8 @@ Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
OnlyIfReducedTy);
case Instruction::ExtractValue:
return ConstantExpr::getExtractValue(Ops[0], getIndices(), OnlyIfReducedTy);
+ case Instruction::FNeg:
+ return ConstantExpr::getFNeg(Ops[0]);
case Instruction::ShuffleVector:
return ConstantExpr::getShuffleVector(Ops[0], Ops[1], getShuffleMask(),
OnlyIfReducedTy);