The film hit the headlines after Olivia was romantically linked to the former One Direction star.
After production on the psychological thriller wrapped, Olivia posted a glowing tribute to the singer, praising him for his willingness to star in a female-led film.
Harry appears alongside British actress Florence Pugh, who is in the lead role.
Sharing a black-and-white picture of Harry in a vintage car on Instagram, Olivia wrote: “Little known fact: most male actors don’t want to play supporting roles in female-led films.
“The industry has raised them to believe it lessens their power (i.e financial value) to accept these roles, which is one of the reasons it’s so hard to get financing for movies focusing on female stories.
“No joke, it is harrrrrd to find actors who recognise why it might be worth it to allow for a woman to hold the spotlight.”
She added: “Enter: @harrystyles, our ‘Jack’. Not only did he relish the opportunity to allow for the brilliant @florencepugh to hold centre stage as our ‘Alice’, but he infused every scene with a nuanced sense of humanity.
“He didn’t have to join our circus, but he jumped on board with humility and grace, and blew us away every day with his talent, warmth, and ability to drive backwards.”
Don’t Worry Darling is Harry’s second major Hollywood role, alongside Florence and US actor Chris Pine.
It is set in the 1950s in an isolated, utopian community in the California desert and features an unhappy housewife and her husband who harbours a dark secret.
The cast and crew of Don’t Worry Darling posed for a picture together to celebrate the film wrapping up production.
Asif Ali posted it to Instagram on Sunday. It showed Harry with his arm around Olivia.
Olivia, an actress known for her work on TV series House, was previously engaged to actor and comedian Jason Sudeikis, who she has two children with.