diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-08 16:37:34 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-08 16:53:46 +0200 |
commit | 8edb9c3c56e88e38d82582e5fc96befca3d6223c (patch) | |
tree | 3f92b21c971b5188095e2d10bec313e0853fe478 | |
parent | fc18a88231ccca7c5e93f7563e44fd636833ed2c (diff) | |
download | llvm-8edb9c3c56e88e38d82582e5fc96befca3d6223c.zip llvm-8edb9c3c56e88e38d82582e5fc96befca3d6223c.tar.gz llvm-8edb9c3c56e88e38d82582e5fc96befca3d6223c.tar.bz2 |
[ConstantExpr] Don't create float binop expressions
Mark the fadd, fsub, fmul, fdiv, and frem expressions as
undesirable, so they are not created automatically. This is in
preparation for their removal.
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 10 | ||||
-rw-r--r-- | llvm/test/Transforms/Reassociate/crash2.ll | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 650b076..9eefd01 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2328,6 +2328,11 @@ bool ConstantExpr::isDesirableBinOp(unsigned Opcode) { case Instruction::SDiv: case Instruction::URem: case Instruction::SRem: + case Instruction::FAdd: + case Instruction::FSub: + case Instruction::FMul: + case Instruction::FDiv: + case Instruction::FRem: return false; case Instruction::Add: case Instruction::Sub: @@ -2338,11 +2343,6 @@ bool ConstantExpr::isDesirableBinOp(unsigned Opcode) { case Instruction::And: case Instruction::Or: case Instruction::Xor: - case Instruction::FAdd: - case Instruction::FSub: - case Instruction::FMul: - case Instruction::FDiv: - case Instruction::FRem: return true; default: llvm_unreachable("Argument must be binop opcode"); diff --git a/llvm/test/Transforms/Reassociate/crash2.ll b/llvm/test/Transforms/Reassociate/crash2.ll index 0da5bde..f45fbef 100644 --- a/llvm/test/Transforms/Reassociate/crash2.ll +++ b/llvm/test/Transforms/Reassociate/crash2.ll @@ -7,7 +7,7 @@ define float @undef1() { ; CHECK-LABEL: @undef1( -; CHECK-NEXT: ret float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float fneg (float bitcast (i32 ptrtoint (i32* @g to i32) to float)), float fneg (float bitcast (i32 ptrtoint (i32* @g to i32) to float))))) +; CHECK-NEXT: ret float 0.000000e+00 ; %t0 = fadd fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), bitcast (i32 ptrtoint (i32* @g to i32) to float) %t1 = fsub fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), %t0 |