[Constants] Handle FNeg in getWithOperands.
authorFlorian Hahn <flo@fhahn.com>
Fri, 21 Aug 2020 15:10:02 +0000 (16:10 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 21 Aug 2020 15:50:56 +0000 (16:50 +0100)
commitbc72a3ab949e14b990c080985fc1e74475f1e7d2
treeb8cef97e4f23329d0e74096cc4a5c336b6725f9e
parent365f861c45bb504c7b61f64943916fc570818cd1
[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
clang/test/CodeGen/constantexpr-fneg.c [new file with mode: 0644]
llvm/lib/IR/Constants.cpp