Index: lib/CodeGen/CGClass.cpp =================================================================== --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -1608,6 +1608,7 @@ LexicalScope Scope(*this, RootCS->getSourceRange()); + incrementProfileCounter(RootCS); AssignmentMemcpyizer AM(*this, AssignOp, Args); for (auto *I : RootCS->body()) AM.emitAssignment(I); Index: test/Profile/def-assignop.cpp =================================================================== --- test/Profile/def-assignop.cpp +++ test/Profile/def-assignop.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -x c++ %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s + + +struct B { + int B; + void *operator=(const struct B &b2) { + if (b2.B == 0) { + B = b2.B + 1; + } else + B = b2.B; + return this; + } +}; + +struct A : public B { + A &operator=(const A &) = default; +// PGOGEN: define {{.*}}@_ZN1AaSERKS_( +// PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSERKS_ +// PGOGEN: {{.*}}add{{.*}}%pgocount, 1 +// PGOGEN: store{{.*}}@__profc__ZN1AaSERKS_ + int I; + int J; + int getI() { return I; } +}; + +A aa; +int g; +int main() { + A aa2; + aa2 = aa; + + g = aa2.getI(); + return 0; +}