[llvm] bdba827 - [VectorCombine] Avoid ConstantExpr::get() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 08:18:00 PDT 2022
Author: Nikita Popov
Date: 2022-06-29T17:17:52+02:00
New Revision: bdba8278d9c361103d32cfd56a215d017d444e9c
URL: https://github.com/llvm/llvm-project/commit/bdba8278d9c361103d32cfd56a215d017d444e9c
DIFF: https://github.com/llvm/llvm-project/commit/bdba8278d9c361103d32cfd56a215d017d444e9c.diff
LOG: [VectorCombine] Avoid ConstantExpr::get() (NFC)
Use IRBuilder APIs instead, which will still constant fold.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 94c690aaf41b1..90598937affcb 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -697,8 +697,9 @@ bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {
ScalarInst->copyIRFlags(&I);
// Fold the vector constants in the original vectors into a new base vector.
- Constant *NewVecC = IsCmp ? ConstantExpr::getCompare(Pred, VecC0, VecC1)
- : ConstantExpr::get(Opcode, VecC0, VecC1);
+ Value *NewVecC =
+ IsCmp ? Builder.CreateCmp(Pred, VecC0, VecC1)
+ : Builder.CreateBinOp((Instruction::BinaryOps)Opcode, VecC0, VecC1);
Value *Insert = Builder.CreateInsertElement(NewVecC, Scalar, Index);
replaceValue(I, *Insert);
return true;
More information about the llvm-commits
mailing list