Commit 69d6409f authored by Patrick Flynn's avatar Patrick Flynn Committed by Patrick McCormick
Browse files

Fixed error with loop being optimized away on higher optimization levels

parent 45cec3e6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -313,6 +313,10 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE,
  InductionVarDecl = EmitKokkosParallelForInductionVar(Lambda).at(0);
  EmitVarDecl(*InductionVarDecl);
  
  Address Addr = GetAddrOfLocalVar(InductionVarDecl);
  llvm::Value *Zero = llvm::ConstantInt::get(ConvertType(InductionVarDecl->getType()), 0);
  Builder.CreateStore(Zero, Addr);

   // Create the sync region. 
  PushSyncRegion();
  llvm::Instruction *SRStart = EmitSyncRegionStart();