Co-written, directed by and starring Don Cheadle, "Miles Ahead" is based on the life of jazz musician Miles Davis. (  / Sony Pictures Classics)

Don’t bother fact-checking “Miles Ahead.” Large swaths of the movie about jazz legend Miles Davis were cooked up by screenwriters Steven Baigelman and director-star Don Cheadle. The shootout and car chase? Never happened. But somehow it works in this intentionally off-the-rails biography. After all, Davis was a fan of improvisation.

In another risky move, the story focuses on the prolific musician’s fallow period. During the late 1970s, he didn’t record a thing, instead spending his time on booze, women and drugs. And that’s when we meet him at the start of “Miles Ahead.” He’s holed up in his New York brownstone, wearing a robe in the middle of the day, like some eccentric has-been hermit, when Rolling Stone reporter Dave Brill — another invention, gamely played by Ewan McGregor — shows up to write the story of Davis’s anticipated comeback. Davis responds by punching him in the nose, then slamming the door in his face.

But the reporter manages to weasel his way into the musician’s confidence, which gives Davis an excuse to revisit his past. In flashbacks to the 1940s, we see a man who is clean-cut and suited up, though no less prone to outbursts. Most of the scenes revolve around his first wife and muse, dancer Frances Taylor (Emayatzy Corinealdi), whom Davis obsesses over even while juggling affairs with other women. During their first meeting, Davis notices her watching him, so he walks up and hands her a $20 bill with his phone number on it. “Now you don’t have to stare,” he tells her. (The kicker: He borrowed the cash from the woman who had been snuggling up to him just moments before.)

In his feature directorial debut, Don Cheadle delivers a dazzling performance as Miles Davis. (Brian Douglas/Sony Pictures Classics)

Emayatzy Corinealdi steals the show as the mercurial musician’s first wife. (Brian Douglas/Sony Pictures Classics)

The story can shift from uproarious to heartbreaking in the span of a scene, but Cheadle, in his feature directorial debut, controls the tone like a veteran. In the acting department, the Oscar nominee delivers a typically tremendous performance, perfecting Davis’s throaty whisper and capturing both the man’s creative brilliance in recording sessions and his unruly personal life.

But Corinealdi steals the show whenever she is on-screen, nailing the full spectrum of emotion, beginning with that flirtatious introduction. That joy makes her pain all the more affecting after Frances finds herself in an abusive marriage with a philandering drug addict.

As these marital flashbacks turn violent, life also gets increasingly chaotic for Davis and his new sidekick, Dave, as they drive around New York trying to track down a stolen audio recording. It all culminates in a shooting at a boxing match while we watch a young version of Davis playing trumpet in the ring.

And no, that didn’t really happen either.

“Miles Ahead” isn’t interested in gritty realism. It isn’t really interested in facts at all. But it does seem to capture some essence of Davis — his volatility and selfishness, perhaps, as well as his genius and humor — that alone would make the movie worth watching, even without the killer soundtrack.

R. At area theaters. Contains strong language, drug use, some sexuality, nudity and brief violence. 100 minutes.