https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94043
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Kewen Lin from comment #12) > Created attachment 48122 [details] > ppc64le tested patch > > Thanks Richi! > > A patch draft attached to ensure on the right track, also > bootstrapped/regresstested. I tried to reproduce the case that the stmts for > lane extracting is empty (due to folding) with test cases associated in that > old commit but failed. I think we don't need to deal with it? The new copy > assignment instead of the phi could not be caught by the LC-PHI check in > expand_simple_operations. + /* Find all SSA NAMEs in stmts which is defined in current loop, create + PHIs for them, and replace them with phi results accordingly. */ + for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + update_stmt (stmt); + ... should not be necessary. What's missing in your patch is that when the current code has computed vec_lhs it needs to create a LC PHI node for it _before_ computing the lane extraction and instead use vec_lhs' there.