Bläddra i källkod

Fixed invalid lifetimeStart emission with dynLife vregs

Brian Fiete 3 år sedan
förälder
incheckning
d10951527a
1 ändrade filer med 10 tillägg och 1 borttagningar
  1. 10 1
      IDEHelper/Backend/BeMCContext.cpp

+ 10 - 1
IDEHelper/Backend/BeMCContext.cpp

@@ -16748,7 +16748,16 @@ void BeMCContext::Generate(BeFunction* function)
 					auto castedInst = (BeLifetimeEndInst*)inst;
 					auto mcPtr = GetOperand(castedInst->mPtr, false, true);
 					if (mcPtr)
-						AllocInst(BeMCInstKind_LifetimeStart, mcPtr);
+					{
+						auto vregInfo = GetVRegInfo(mcPtr);
+						if ((vregInfo != NULL) && (vregInfo->mHasDynLife))
+						{
+							// This alloca had an assignment (ie: `mov vregX, [RBP+homeSize0]`) so it must be defined at the mov
+							// This may indicate incorrectly generated code where we thought an alloca would be in the head but it isn't
+						}
+						else
+							AllocInst(BeMCInstKind_LifetimeStart, mcPtr);
+					}
 				}
 				break;
 			case BeLifetimeExtendInst::TypeId: