[PATCH] D71389: [ConstantFold][SVE] Fix constant folding for bitcast.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 04:14:58 PST 2019
sdesmalen added a comment.
Thanks for adding the extra constant fold @huihuiz!
================
Comment at: llvm/lib/IR/ConstantFold.cpp:580
+ m_ShuffleVector(
+ m_InsertElement(m_Undef(), m_Constant(SplatV), m_Zero()),
+ m_Value(), m_Zero()))) {
----------------
Because we're matching for a zero mask, explicitly matching `m_Undef` here seems unnecessarily restrictive, `m_Value()` should be sufficient.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:587
+ UndefValue::get(DestTy), NewCast,
+ cast<Constant>(InsertElem->getOperand(2)));
+ return ConstantExpr::getShuffleVector(
----------------
Can we match this value directly with `m_Zero(Zero)`, rather than needing `auto InsertElem` and `InsertElem->getOperand(2)` ?
================
Comment at: llvm/lib/IR/ConstantFold.cpp:590
+ NewInsertElem,
+ ConstantExpr::getCast(opc, CE->getOperand(1), DestTy),
+ CE->getOperand(2));
----------------
Can we match the value for `CE->getOperand(1)` value directly with something like `m_Value(Vec2)`. I'd expect `CE->getOperand(2)` can reuse `Zero` as suggested above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71389/new/
https://reviews.llvm.org/D71389
More information about the llvm-commits
mailing list