File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,16 @@ bool GlobOpt::ArraySrcOpt::CheckOpCode()
151151 return false ;
152152 }
153153
154+ if (instr->GetSrc1 ()->IsAddrOpnd ())
155+ {
156+ const int64 val = instr->GetSrc1 ()->GetImmediateValue (instr->m_func );
157+ if (Js::TaggedInt::Is (val))
158+ {
159+ originalIndexOpnd = instr->UnlinkSrc1 ();
160+ instr->SetSrc1 (IR::IntConstOpnd::New (Js::TaggedInt::ToInt32 (val), TyInt32, instr->m_func ));
161+ }
162+ }
163+
154164 if (!instr->GetSrc1 ()->IsRegOpnd () && !instr->GetSrc1 ()->IsIntConstOpnd ())
155165 {
156166 return false ;
@@ -199,7 +209,7 @@ void GlobOpt::ArraySrcOpt::TypeSpecIndex()
199209 {
200210 // If the optimization is unable to eliminate the bounds checks, we need to restore the original var sym.
201211 Assert (originalIndexOpnd == nullptr );
202- originalIndexOpnd = instr->GetSrc1 ()->Copy (func)-> AsRegOpnd () ;
212+ originalIndexOpnd = instr->GetSrc1 ()->Copy (func);
203213 globOpt->ToTypeSpecIndex (instr, instr->GetSrc1 ()->AsRegOpnd (), nullptr );
204214 }
205215 }
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class GlobOpt::ArraySrcOpt
5252 IR::IndirOpnd * baseOwnerIndir = nullptr ;
5353 IR::RegOpnd * baseOpnd = nullptr ;
5454 IR::Opnd * indexOpnd = nullptr ;
55- IR::RegOpnd * originalIndexOpnd = nullptr ;
55+ IR::Opnd * originalIndexOpnd = nullptr ;
5656 bool isProfilableLdElem = false ;
5757 bool isProfilableStElem = false ;
5858 bool isLoad = false ;
You can’t perform that action at this time.
0 commit comments