What a difference four months have made for chip stocks.

After tumbling during the last quarter of 2018 thanks to both a broader market selloff and worries about a major cyclical downturn, the Philadelphia Semiconductor Index  (SOXX - Get Report) is up 39% from a late-December low of $144.79, and has made fresh 52-week highs. A number of chip developers and equipment makers, including Xilinx (XLNX - Get Report) , Microchip Technology (MCHP - Get Report) , Lam Research (LRCX - Get Report) , Cree  (CREE - Get Report) and Micron (MU - Get Report) , are now up over 50% from their December lows.

Aside from broader strength in equity markets, a few other factors have helped chip stocks start 2019 off with a bang:

  1. While a cyclical downturn has arrived for the industry, it hasn't (looking at the industry as a whole) been as severe as many investors feared in late 2018. Clearly, many of the sellers who helped push chip stock multiples to rock-bottom levels in December were expecting a giant downturn comparable to what the industry has seen during some past cycles.
  2. Many chip firms -- some notable names include Micron, Microchip, Skyworks (SWKS - Get Report) , Nvidia  (NVDA - Get Report) and Broadcom  (AVGO - Get Report) -- have forecast demand will improve meaningfully during the second half of the year.
  3. Relative to technology stocks overall, chip stocks were especially vulnerable to trade war worries. As a result, just as chip stocks were hurt more than many other tech names as trade tensions between the U.S. and China escalated last year, they appear to have benefited more than other names as tensions have eased.

But now that chip stocks have risen sharply from their December lows, this is probably a good time for investors in the space to take a more selective approach to stocks in the space -- particularly since some business risks remain for the group.

One key remaining risk: While the odds of a massive, no-holds-barred, trade war between Washington and Beijing have diminished, China's GDP and consumer spending growth continue showing signs of slowing. German chipmaker Infineon recently cited weak Chinese auto sales as a reason for cutting its full-year guidance.

Another risk: Both inside and outside of China, demand weakness could persist for certain end-markets. Smartphone sales growth recently turned negative, and might not see a major rebound until 5G and foldable phones are ready to go mainstream. And while cloud capital spending (currently in the middle of a lull) will likely improve during the back half of the year, there's a good chance that spending on traditional enterprise hardware (pressured by cloud infrastructure adoption) will remain soft.

And when looking at both memory makers and the chip equipment firms that supply them, it's worth keeping in mind that a memory recovery doesn't merely depend on improved end-market demand, but on price stabilization and the clearing of customer inventories. While it's pretty likely that the DRAM and flash memory markets will have better supply/demand balances during the back half of the year, thanks to stronger end-market demand, inventory clearing and the impact of recent capital spending cuts, there are still some wild cards at play.

For these reasons, this might be a good time for chip stock investors to pare their exposure to higher-multiple names that have less of a margin for error in the event that a recovery doesn't go exactly as planned and/or some company-specific pressures emerge. Xilinx, which now trades for 34 times its expected fiscal 2020 (ends in March 2020) EPS consensus, and Cree, which now trades for 33 times its fiscal 2021 (ends in June 2021) EPS consensus, are two examples of firms that now don't have much of a margin for error.

On the flip side, there are still a number of chip suppliers that are still trading for less than 15 times their expected fiscal 2020 earnings, and -- though having some exposure to end-markets that could potentially remain weak -- which are unlikely to see demand fall off a cliff. Examples include Broadcom, Skyworks, Qorvo (QRVO - Get Report) , ON Semiconductor  (ON - Get Report) and Cypress Semiconductor (CY - Get Report) .

Such stocks are still likely to trade lower if the overall market sees profit-taking. However, they might not get hurt too badly if demand in one or two end-markets remains under pressure for longer than expected.

Lam Research and Nvidia are holdings in Jim Cramer's Action Alerts PLUS member club. Want to be alerted before Jim Cramer buys or sells LRCX or NVDA? Learn more now.