From 46a52ff9eda0750ff05311310774d954bcaf3408 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 21 Apr 2020 21:00:19 -0700 Subject: [PATCH] [TargetPassConfig] Run MachineVerifier after more passes. We were disabling verification for no reason in a bunch of places; just turn it on. At this point, there are two key places where we don't run verification: during register allocation, and after addPreEmitPass. Regalloc probably isn't worth messing with; it has its own invariants, and verifying afterwards is probably good enough. For after addPreEmitPass, it's probably worth investigating improvements. --- llvm/lib/CodeGen/TargetPassConfig.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 336b1a8..4432c3f 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -934,7 +934,7 @@ void TargetPassConfig::addMachinePasses() { } else { // If the target requests it, assign local variables to stack slots relative // to one another and simplify frame index references where possible. - addPass(&LocalStackSlotAllocationID, false); + addPass(&LocalStackSlotAllocationID); } if (TM->Options.EnableIPRA) @@ -1006,10 +1006,10 @@ void TargetPassConfig::addMachinePasses() { addBlockPlacement(); // Insert before XRay Instrumentation. - addPass(&FEntryInserterID, false); + addPass(&FEntryInserterID); - addPass(&XRayInstrumentationID, false); - addPass(&PatchableFunctionID, false); + addPass(&XRayInstrumentationID); + addPass(&PatchableFunctionID); addPreEmitPass(); @@ -1018,6 +1018,8 @@ void TargetPassConfig::addMachinePasses() { // clobbered registers, to be used to optimize call sites. addPass(createRegUsageInfoCollector()); + // FIXME: Some backends are incompatible with running the verifier after + // addPreEmitPass. Maybe only pass "false" here for those targets? addPass(&FuncletLayoutID, false); addPass(&StackMapLivenessID, false); @@ -1048,15 +1050,15 @@ void TargetPassConfig::addMachineSSAOptimization() { // Optimize PHIs before DCE: removing dead PHI cycles may make more // instructions dead. - addPass(&OptimizePHIsID, false); + addPass(&OptimizePHIsID); // This pass merges large allocas. StackSlotColoring is a different pass // which merges spill slots. - addPass(&StackColoringID, false); + addPass(&StackColoringID); // If the target requests it, assign local variables to stack slots relative // to one another and simplify frame index references where possible. - addPass(&LocalStackSlotAllocationID, false); + addPass(&LocalStackSlotAllocationID); // With optimization, dead code should already be eliminated. However // there is one known exception: lowered code for arguments that are only @@ -1069,8 +1071,8 @@ void TargetPassConfig::addMachineSSAOptimization() { // loop info, just like LICM and CSE below. addILPOpts(); - addPass(&EarlyMachineLICMID, false); - addPass(&MachineCSEID, false); + addPass(&EarlyMachineLICMID); + addPass(&MachineCSEID); addPass(&MachineSinkingID); -- 2.7.4