https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115033
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |alias CC| |hubicka at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- resultIsStatic = 1; D.39198.__inputIsStatic = &inputIsStatic; D.39198.__resultIsStatic = &resultIsStatic; D.39198.__newShape = &newShape; D.39198.__totalSize = &totalSize; resultShape = llvm::map_to_vector<llvm::ArrayRef<long int>&, inferReshapeExpandedType(llvm::ArrayRef<long int>, llvm::ArrayRef<long int>)::<lambda(int64_t)> > (&newShape, &D.39198); [return slot optimization] D.39198 ={v} {CLOBBER(eol)}; inputIsStatic.3_7 = inputIsStatic; _8 = ~inputIsStatic.3_7; if (inputIsStatic.3_7 != 0) goto <bb 14>; [INV] else goto <bb 10>; [INV] <bb 10> : resultIsStatic.4_9 = resultIsStatic; I don't see how llvm::map_to_vector modifies 'resultIsStatic' so it seems like a correct optimization to assume it is 1? Or maybe I am misunderstanding the call. We end up in struct SmallVector llvm::map_to_vector<llvm::ArrayRef<long int>&, inferReshapeExpandedType(llvm::ArrayRef<long int>, llvm::ArrayRef<long int>)::<lambda(int64_t)> > (struct ArrayRef & C, struct ._anon_81 & F) where I can see a struct .anon_81 (that's from the lambda I guess). The source seems to be bool resultIsStatic = true; auto resultShape = llvm::map_to_vector(newShape, [&](int64_t size) -> int64_t { if (size >= 0) return size; if (!inputIsStatic) { resultIsStatic = false; return kDynamic; ... so it might be interesting to try reducing it further. I'll note that using -fno-ipa-modref avoids FRE doing the CSE but -fno-strict-aliasing doesn't. So maybe it's a genuine modref bug. IIRC there are some that might be fixed in GCC 14 but not yet earlier.