aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorMatthew Voss <matthew.voss@sony.com>2023-07-26 12:56:02 -0700
committerMatthew Voss <matthew.voss@sony.com>2023-07-26 12:56:31 -0700
commit9eb73f9c9d409f35151b0c1e01f1ed95808acd0c (patch)
treeed9e15541b66dc663f2a8fa71f61ffea50f8ee65 /llvm/lib/IR/ConstantFold.cpp
parent380dbfd8cab0c48c46c01b519b908c6ef4d6e775 (diff)
downloadllvm-9eb73f9c9d409f35151b0c1e01f1ed95808acd0c.zip
llvm-9eb73f9c9d409f35151b0c1e01f1ed95808acd0c.tar.gz
llvm-9eb73f9c9d409f35151b0c1e01f1ed95808acd0c.tar.bz2
Revert "[ConstantFold] Avoid creation of undesirable binop"
This reverts commit 673a4671f3e8b7158d990f6456428175a6eac38c. Depends on reverted commit 0cab8d20417c0e2ccc1ffc5505e080126f5de8e6. That commit was reverted due to an LTO crash. I've put a reduced test case here: https://github.com/llvm/llvm-project/issues/64114
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index db1a83b..4c33250 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1084,9 +1084,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
} else if (isa<ConstantInt>(C1)) {
// If C1 is a ConstantInt and C2 is not, swap the operands.
if (Instruction::isCommutative(Opcode))
- return ConstantExpr::isDesirableBinOp(Opcode)
- ? ConstantExpr::get(Opcode, C2, C1)
- : ConstantFoldBinaryInstruction(Opcode, C2, C1);
+ return ConstantExpr::get(Opcode, C2, C1);
}
if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {