From ebf23316f60104f65f7269a8b3b1788552b22e76 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Thu, 22 Sep 2022 16:02:47 +0100 Subject: [PATCH] Fix the "-yk-no-fallthrough" flag. This is working by chance! The correct way to add external storage for a CLI option is described here: https://llvm.org/docs/CommandLine.html#internal-vs-external-storage --- llvm/lib/CodeGen/CodeGen.cpp | 6 ++++-- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 2 +- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp index e92288fa7336eb8..2027cf1a7427027 100644 --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -18,8 +18,10 @@ using namespace llvm; -llvm::cl::opt YkNoFallThrough( - "yk-no-fallthrough", cl::Hidden, cl::init(false), +bool YkNoFallThrough; +llvm::cl::opt YkNoFallThroughParser( + "yk-no-fallthrough", cl::Hidden, cl::location(YkNoFallThrough), + cl::init(false), cl::desc("Always emit a branch even if fallthrough is possible. This " "is required for the yk JIT, so that the machine IR has the " "same block structure as the high-level IR")); diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index c7fc250e87974e7..2d4883d2da5f7a5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -110,7 +110,7 @@ using namespace llvm; using namespace PatternMatch; -extern cl::opt YkNoFallThrough; +extern bool YkNoFallThrough; #define DEBUG_TYPE "isel" diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 699d644a944d343..bc34ed90b32d951 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -129,7 +129,7 @@ static cl::opt SwitchPeelThreshold( "switch statement. A value greater than 100 will void this " "optimization")); -extern cl::opt YkNoFallThrough; +extern bool YkNoFallThrough; // Limit the width of DAG chains. This is important in general to prevent // DAG-based analysis from blowing up. For example, alias analysis and