Taiwan Semiconductor Manufacturing (TSM -4.86%), the world's largest contract chipmaker, has been a divisive investment over the past year. The bears argued that cooling sales of PCs in a post-pandemic market, supply chain challenges for smartphones, and other macro headwinds would throttle the growth of the semiconductor sector and curb the market's demand for its services.

The bulls pointed out that TSMC has weathered plenty of cyclical downturns before, and that it would likely remain far ahead of its closest rivals -- Samsung and Intel -- in the "process race" to manufacture smaller and denser chips.

TSMC's Fab 16 in Nanjing, China.

Image source: TSMC.

Yet TSMC's stock remains down more than 30% this year, which suggests most investors are still siding with the bears. Let's see if two recent events -- a green flag and a red flag for this Taiwanese tech giant's future -- can shift that balance.

The green flag: Berkshire's big buy

Last month, Warren Buffett's Berkshire Hathaway (BRK.A 0.64%) (BRK.B 0.54%) disclosed a $4.1 billion stake in TSMC. That makes the chipmaker Berkshire's ninth-largest holding at 1.4% of its entire portfolio.

Buffett hasn't publicly spoken about that investment yet, but Berkshire has only bought a handful of tech stocks throughout its entire history. Its top holding is Apple (AAPL -0.57%), which accounts for a whopping 39.2% of its portfolio, while other notable tech plays include Activision Blizzard (1.3%), HP (1%), Amazon (0.3%), and Snowflake (0.3%). Speaking at a recent meeting in Taipei, TSMC Chairman Mark Liu complimented Buffett for his "sharp eye" for good investments.

Buffett usually favors undervalued companies with stable long-term growth and wide moats. TSMC checks all three boxes: Its stock trades at just 13 times forward earnings, it grew its net income at a compound annual growth rate (CAGR) of 17% between 2011 and 2021, and it remains the sole manufacturer of the world's smallest and most powerful chips.

The red flag: Apple's problems in China

TSMC's largest customer accounted for 26% of its revenue in 2021. TSMC didn't specifically name that customer in its latest annual report, but it's widely believed to be Apple. Therefore, the Mac maker's recent problems in China could generate significant headwinds for TSMC's near-term growth.

Last month, violent protests erupted at Foxconn's largest iPhone manufacturing plant in China in response to the facility's rigid COVID-19 policies and unpaid bonuses. Those disruptions have reportedly reduced the plant's November production by more than 30%, which will likely throttle Apple's available supply of iPhones throughout the holiday season.

But that's not all. Other protests subsequently erupted across China in response to the government's draconian "zero-COVID" policies, and that ongoing social unrest could impact Apple's sales across the "Greater China" region, which accounted for 19% of its top line in fiscal 2022 (ended in September). And that, in turn, could take a toll on TSMC. 

Does the good news outweigh the bad news?

Berkshire's big buy suggests that TSMC is still a solid investment for long-term investors. However, the chipmaker's heavy dependence on Apple could become a near-term liability amid its recent problems in China.

On their own, I don't think either headline will tilt the balance in favor of the bulls or the bears. I personally believe TSMC's stock will remain stuck in neutral over the next few quarters as investors continue to fret over the PC market's slowdown, Apple's supply chain challenges, and the Biden administration's recent ban on advanced chip sales to China.

But over the long term, I believe TSMC will continue to grow as Samsung and Intel abandon their costly plans to catch up in the process race. TSMC still aims to spend $36 billion on capex this year to ramp up its production of advanced chips, compared to Intel's capex of $21 billion and Samsung's combined capex of $37 billion for its semiconductors and displays.

So if you're looking for short-term gains, TSMC will likely be a disappointing investment. But if you plan to follow Buffett's mantra of buying quality stocks and holding them "forever," then TSMC is still a great long-term buy.