[llvm-branch-commits] [llvm] LICM: Drop -licm-force-thread-model-single in favor of the module flag (PR #223158)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Sep 12 08:46:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Now that the threading model is carried by the "thread-model" IR module flag,
the hidden -licm-force-thread-model-single override is redundant: a test can
select the single-threaded model by setting the module flag directly.
isThreadLocalObject reads only Module::getThreadModel.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply@<!-- -->anthropic.com>
---
Full diff: https://github.com/llvm/llvm-project/pull/223158.diff
2 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/LICM.cpp (+1-5)
- (modified) llvm/test/Transforms/LICM/promote-single-thread.ll (+9-2)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index a82b249a4384c..17c1e927b14b0 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -128,10 +128,6 @@ static cl::opt<bool> ControlFlowHoisting(
"licm-control-flow-hoisting", cl::Hidden, cl::init(false),
cl::desc("Enable control flow (and PHI) hoisting in LICM"));
-static cl::opt<bool>
- SingleThread("licm-force-thread-model-single", cl::Hidden, cl::init(false),
- cl::desc("Force thread model single in LICM pass"));
-
static cl::opt<uint32_t> MaxNumUsesTraversed(
"licm-max-num-uses-traversed", cl::Hidden, cl::init(8),
cl::desc("Max num uses visited for identifying load "
@@ -1997,7 +1993,7 @@ bool isThreadLocalObject(const Value *Object, const Loop *L,
// In a single-threaded environment, all objects are effectively thread-local.
const Module *M = L->getHeader()->getModule();
- return M->getThreadModel() == ThreadModel::Single || SingleThread;
+ return M->getThreadModel() == ThreadModel::Single;
}
} // namespace
diff --git a/llvm/test/Transforms/LICM/promote-single-thread.ll b/llvm/test/Transforms/LICM/promote-single-thread.ll
index 89935b5f1ae01..5660df3e39bb0 100644
--- a/llvm/test/Transforms/LICM/promote-single-thread.ll
+++ b/llvm/test/Transforms/LICM/promote-single-thread.ll
@@ -1,7 +1,9 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -passes=licm < %s | FileCheck %s --check-prefixes=CHECK,MT
-; RUN: opt -S -passes=licm -licm-force-thread-model-single < %s | FileCheck %s --check-prefixes=CHECK,ST
+; RUN: split-file %s %t
+; RUN: opt -S -passes=licm < %t/body.ll | FileCheck %s --check-prefixes=CHECK,MT
+; RUN: cat %t/body.ll %t/single.ll | opt -S -passes=licm | FileCheck %s --check-prefixes=CHECK,ST
+;--- body.ll
@g = external global i32
@c = external constant i32
@@ -233,3 +235,8 @@ latch:
exit:
ret void
}
+
+;--- single.ll
+; Appended to the body to select the single-threaded thread model.
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"thread-model", !"single"}
``````````
</details>
https://github.com/llvm/llvm-project/pull/223158
More information about the llvm-branch-commits
mailing list