rsmith added a comment. Based on the ASan output, it looks like the miscompile is probably happening in `SparseSolver<LatticeKey, LatticeVal, KeyInfo>::getValueState(LatticeKey)` at around include/llvm/Analysis/SparsePropagation.h:240:
template <class LatticeKey, class LatticeVal, class KeyInfo> LatticeVal SparseSolver<LatticeKey, LatticeVal, KeyInfo>::getValueState(LatticeKey Key) { auto I = ValueState.find(Key); if (I != ValueState.end()) return I->second; // Common case, in the map if (LatticeFunc->IsUntrackedValue(Key)) return LatticeFunc->getUntrackedVal(); LatticeVal LV = LatticeFunc->ComputeLatticeVal(Key); // If this value is untracked, don't add it to the map. if (LV == LatticeFunc->getUntrackedVal()) return LV; return ValueState[Key] = LV; } I'm guessing we somehow get confused about whether `LV` is an NRVO variable during template instantiation, and apply NRVO to it despite there being a return of something else in its scope. Repository: rC Clang https://reviews.llvm.org/D47067 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits