[llvm] 515a826 - [NFC][InferAlignment] Swap extern declaration and definition of EnableInferAlignmentPass

Dhruv Chawla via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 00:48:21 PDT 2023


Author: Dhruv Chawla
Date: 2023-09-20T13:07:13+05:30
New Revision: 515a8263269278466b4fbbf22073bc6f84e6fd70

URL: https://github.com/llvm/llvm-project/commit/515a8263269278466b4fbbf22073bc6f84e6fd70
DIFF: https://github.com/llvm/llvm-project/commit/515a8263269278466b4fbbf22073bc6f84e6fd70.diff

LOG: [NFC][InferAlignment] Swap extern declaration and definition of EnableInferAlignmentPass

This prevents a linker issue when only InstCombine is linked without
PassBuilder, like in the case of bugpoint.

Added: 
    

Modified: 
    llvm/lib/Passes/PassBuilderPipelines.cpp
    llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 29cf2f75fd6ca3f..5f5d92d277c1bfc 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -275,10 +275,7 @@ cl::opt<bool> EnableMemProfContextDisambiguation(
     "enable-memprof-context-disambiguation", cl::init(false), cl::Hidden,
     cl::ZeroOrMore, cl::desc("Enable MemProf context disambiguation"));
 
-cl::opt<bool> EnableInferAlignmentPass(
-    "enable-infer-alignment-pass", cl::init(true), cl::Hidden, cl::ZeroOrMore,
-    cl::desc("Enable the InferAlignment pass, disabling alignment inference in "
-             "InstCombine"));
+extern cl::opt<bool> EnableInferAlignmentPass;
 
 PipelineTuningOptions::PipelineTuningOptions() {
   LoopInterleaving = true;

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 3767ecd6539f3b9..ec4523d1a7cedf2 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -36,7 +36,10 @@ static cl::opt<unsigned> MaxCopiedFromConstantUsers(
     cl::desc("Maximum users to visit in copy from constant transform"),
     cl::Hidden);
 
-extern cl::opt<bool> EnableInferAlignmentPass;
+cl::opt<bool> EnableInferAlignmentPass(
+    "enable-infer-alignment-pass", cl::init(true), cl::Hidden, cl::ZeroOrMore,
+    cl::desc("Enable the InferAlignment pass, disabling alignment inference in "
+             "InstCombine"));
 
 /// isOnlyCopiedFromConstantMemory - Recursively walk the uses of a (derived)
 /// pointer to an alloca.  Ignore any reads of the pointer, return false if we


        


More information about the llvm-commits mailing list