starstarstar-halfstar-outline(2.5 stars)

A deep core of sadness lurks in even the sunniest corners of “Once Upon a Time in Hollywood,” Quentin Tarantino’s valentine to the Los Angeles of his youth. Set in 1969, six months before followers of cult leader Charles Manson murdered actress Sharon Tate and three of her friends, this particular fairy tale seeks both to preserve nostalgic Hollywood glamour and smooth over its most nihilistic contours. Putting a bevy of optimistic, newly minted stars into play alongside dogged almost-weres and never-beens in a balmy Southern Californian reverie, Tarantino might relish evoking the era’s most sybaritic pleasures, but both he and the audience are all too aware of the unspeakable pain to come.

At the center of this adamantly revisionist history are Rick Dalton (Leonardo DiCaprio) and Cliff Booth (Brad Pitt), the former star of a “Gunsmoke”-like program and his body double, who now serves as Rick’s chauffeur, drinking buddy and one-man entourage. Rick now makes his living doing guest shots as villains on prime-time TV shows, but he still drives a creamy yellow Cadillac (well, Cliff drives it), and Edmund O’Brien once advised him to buy, not rent, when he started earning money. So Rick owns the swank mid-century home on Cielo Drive in Benedict Canyon, where the hotshot director Roman Polanski (Rafal Zawierucha) and his gorgeous wife, Sharon Tate (Margot Robbie), have just moved in.

“Hollywood” obeys the usual Tarantino structural rules of parallel story lines, opportunistic intersections, long, verbose set pieces and equally windy digressions. While Rick tries to stay afloat as an actor in a business where you live and die by your last take, Cliff plies the highways and byways of L.A., where he has occasion to cross paths with Pussycat (Margaret Qualley), a halter-topped hippie chick who just can’t wait to introduce him to “Charlie.”

Tarantino cleverly exposes the dichotomous worlds of 1960s L.A.: a swinging, star-studded party at the Playboy Mansion serves as a cautionary mirror to the playboy Manson and his band of nubile wastrels. And the ways he confects to have them intersect are part of the fun of “Hollywood,” even if “fun” here comes with a toxic kick. The film benefits from committed, laser-focused performances from DiCaprio and Pitt, the latter of whom especially brings a sly knowingness to the subtleties of playing second banana. (Although debates will surely ensue as to which real-life figures Rick and Cliff are based on, Cliff most resembles Gary Lockwood’s restless Angeleno plying the asphalt seas in Jacques Demy’s 1969 film “Model Shop.”)

And there are some toothsome supporting turns, especially from Dakota Fanning as Manson follower Squeaky Fromme, Bruce Dern as the owner of the decrepit Spahn Ranch, where the cult hangs out, and Julia Butters in a nifty, scene-stealing sequence as a self-serious actress — sorry, “ac-TOR” — preparing.

That moment comes midway through a protracted interlude during which Rick fights hair, makeup, costumes and an ambitious director to deliver a satisfactory performance on the series “Lancer” — one of several things-within-a-thing in a hall of mirrors composed mostly of stuff Tarantino loves. The viewer’s enjoyment of “Hollywood” is most likely directly proportional to the degree of overlap with the director’s own fetishistic obsessions, be they old TV shows, B-movies, mid-century architecture, poppy palettes, vintage neon, Asian martial arts films, semi-obscure needle drops and lots and lots of feet — including Sharon Tate’s white go-go boots and the surprisingly off-putting result when she takes them off.

The state of Tate’s soles are no reflection on her angelic soul in a movie that, at its most sincere and touching, rescues her from the tabloid headline she never deserved and reminds audiences of what a beautiful, gifted comedian she was — and the star she could have become. When Tarantino announced that he was making “Hollywood,” it was impossible not to harbor deep misgivings about him exploiting a vicious crime for its campy, sadistically violent potential. He threads the needle here, managing to indulge his penchant for horrific brutality — especially against women — but in the name of cathartic revenge.

It’s not clear that the deep meaning Tarantino attaches to an ugly, utterly meaningless act will resonate with anyone else as strongly. “Once Upon a Time in Hollywood” is often diverting to watch, and it’s been shot on 35mm film with lovingly expressive care by Robert Richardson. But true to its title, it plays like a bedtime story concocted by a petulant child who insists on getting his own back from the people who poisoned his most honeyed dreams. “Once Upon a Time in Hollywood” is of a piece with the filmmaker’s alternate-history oeuvre that seeks to tease the audience with some of history’s biggest what-ifs, allowing us to believe for a few hours that pure imaginative will is enough to reverse the most grievous wrongs. Wouldn’t it be pretty to think so.

R. At area theaters. Contains crude language throughout, some strong graphic violence, drug use and sexual references. 161 minutes.