Explorar o código

Clear maps for cast before createFlattenedFunction and createFlattenedFunctionCall.

Xiang Li %!s(int64=8) %!d(string=hai) anos
pai
achega
5977eece4c
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp

+ 8 - 1
lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp

@@ -4845,7 +4845,7 @@ Value *SROA_Parameter_HLSL::castArgumentIfRequired(
         V = Builder.CreateExtractElement(OldV, (uint64_t)0);
         vectorEltsMap[V].emplace_back(V);
         for (unsigned i = 1; i < vecSize; i++) {
-          Value *Elt = Builder.CreateExtractElement(OldV, (uint64_t)0);
+          Value *Elt = Builder.CreateExtractElement(OldV, i);
           vectorEltsMap[V].emplace_back(Elt);
         }
       }
@@ -5538,6 +5538,9 @@ void SROA_Parameter_HLSL::createFlattenedFunction(Function *F) {
   if (F->getReturnType()->isVoidTy() && F->getArgumentList().empty()) {
     return;
   }
+  // Clear maps for cast.
+  castParamMap.clear();
+  vectorEltsMap.clear();
 
   DxilFunctionAnnotation *funcAnnotation = m_pHLModule->GetFunctionAnnotation(F);
   DXASSERT(funcAnnotation, "must find annotation for function");
@@ -5797,6 +5800,10 @@ void SROA_Parameter_HLSL::createFlattenedFunctionCall(Function *F, Function *fla
   DxilFunctionAnnotation *funcAnnotation = m_pHLModule->GetFunctionAnnotation(F);
   DXASSERT(funcAnnotation, "must find annotation for function");
 
+  // Clear maps for cast.
+  castParamMap.clear();
+  vectorEltsMap.clear();
+
   DxilTypeSystem &typeSys = m_pHLModule->GetTypeSystem();
 
   std::vector<Value *> FlatParamList;