diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp --- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp @@ -63,11 +63,18 @@ "Use 32-bit pointers for accessing const/local/shared address spaces."), cl::init(false), cl::Hidden); +// FIXME: intended as a temporary debugging aid. Should be removed before it +// makes it into the LLVM-17 release. +static cl::opt + ExitOnUnreachable("nvptx-exit-on-unreachable", + cl::desc("Lower 'unreachable' as 'exit' instruction."), + cl::init(true), cl::Hidden); + namespace llvm { void initializeGenericToNVVMLegacyPassPass(PassRegistry &); void initializeNVPTXAllocaHoistingPass(PassRegistry &); -void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry&); +void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &); void initializeNVPTXAtomicLowerPass(PassRegistry &); void initializeNVPTXCtorDtorLoweringLegacyPass(PassRegistry &); void initializeNVPTXLowerAggrCopiesPass(PassRegistry &); @@ -403,7 +410,8 @@ addPass(createSROAPass()); } - addPass(createNVPTXLowerUnreachablePass()); + if (ExitOnUnreachable) + addPass(createNVPTXLowerUnreachablePass()); } bool NVPTXPassConfig::addInstSelector() { @@ -456,11 +464,10 @@ if (addPass(&MachineSchedulerID)) printAndVerify("After Machine Scheduling"); - addPass(&StackSlotColoringID); // FIXME: Needs physical registers - //addPass(&MachineLICMID); + // addPass(&MachineLICMID); printAndVerify("After StackSlotColoring"); }