[PATCH] D50992: [InstCombine] try to fold insertelt + vector op into scalar op + insertelt

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 11:30:27 PDT 2018


lebedev.ri added a comment.

Looks ok to me.



================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1362
+  ConstantInt *Idx;
+  bool ConstOp1 = isa<Constant>(Inst.getOperand(1));
+  if (match(&Inst, m_c_BinOp(
----------------
I'd prefer `ConstIsOp1`


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1372
+    Value *ScalarOp = Builder.CreateBinOp(Opcode, NewLHS, NewRHS);
+    if (auto *ScalarBO = dyn_cast<BinaryOperator>(ScalarOp))
+      ScalarBO->copyIRFlags(&Inst);
----------------
Hm, why `dyn_cast<>()`, we did just use `CreateBinOp()`?


https://reviews.llvm.org/D50992





More information about the llvm-commits mailing list