================
@@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass {
TargetSchedModel SchedModel;
public:
+ friend class MachineTraceMetricsWrapperPass;
friend class Ensemble;
friend class Trace;
class Ensemble;
- static char ID;
+ // For legacy pass.
+ MachineTraceMetrics() {
+ std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr);
+ }
----------------
cdevadas wrote:
It isn't possible to move out the Ensembles pointer initialization from the
constructors. Certain tests crashed while the destructor invokes clear() that
tries to delete the Ensemble pointers (some garbage value). The default
constructor for these tests doesn't appropriately clear the object's members.
The tests that crashed don't contain any function definitions, but only some
global declarations. So the run() instances won't be invoked for clearing these
pointers. Also, they should point to the dynamically allocated addresses
(otherwise the initial null addresses) before the destructor is invoked.
https://github.com/llvm/llvm-project/pull/108507
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits