@@ -176,40 +176,23 @@ inline int_pred_ty<is_zero_int> m_ZeroInt() {
176176// / For vectors, this includes constants with undefined elements.
177177inline int_pred_ty<is_one> m_One () { return int_pred_ty<is_one>(); }
178178
179- struct apint_match {
180- const APInt * &Res;
179+ struct bind_const_int {
180+ uint64_t &Res;
181181
182- apint_match ( const APInt * &Res) : Res(Res) {}
182+ bind_const_int ( uint64_t &Res) : Res(Res) {}
183183
184184 bool match (VPValue *VPV) const {
185185 if (!VPV->isLiveIn ())
186186 return false ;
187187 Value *V = VPV->getLiveInIRValue ();
188188 if (!V)
189189 return false ;
190+ assert (!V->getType ()->isVectorTy () && " Unexpected vector live-in" );
190191 const auto *CI = dyn_cast<ConstantInt>(V);
191- if (!CI && V->getType ()->isVectorTy ())
192- if (const auto *C = dyn_cast<Constant>(V))
193- CI = dyn_cast_or_null<ConstantInt>(
194- C->getSplatValue (/* AllowPoison=*/ false ));
195192 if (!CI)
196193 return false ;
197- Res = &CI->getValue ();
198- return true ;
199- }
200- };
201-
202- struct bind_const_intval_ty {
203- uint64_t &VR;
204-
205- bind_const_intval_ty (uint64_t &V) : VR(V) {}
206-
207- template <typename ITy> bool match (ITy *V) const {
208- const APInt *ConstInt;
209- if (!apint_match (ConstInt).match (V))
210- return false ;
211- if (auto C = ConstInt->tryZExtValue ()) {
212- VR = *C;
194+ if (auto C = CI->getValue ().tryZExtValue ()) {
195+ Res = *C;
213196 return true ;
214197 }
215198 return false ;
@@ -218,7 +201,7 @@ struct bind_const_intval_ty {
218201
219202// / Match a plain integer constant no wider than 64-bits, capturing it if we
220203// / match.
221- inline bind_const_intval_ty m_ConstantInt (uint64_t &C) { return C; }
204+ inline bind_const_int m_ConstantInt (uint64_t &C) { return C; }
222205
223206// / Matching combinators
224207template <typename LTy, typename RTy> struct match_combine_or {
0 commit comments