llvm / llvm/llvm-project

Why does opt produce "unknown module pass 'xxx'" in case of default<O3>?

Open
#185,003 3 comments 0 reactions 0 assignees View on GitHub
question tools:opt
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

If I run:

```
opt -S --load-pass-plugin=yyy.so -passes="xxx" < foo.ll
```

then opt produces:

```

```
which is expected (pass 'xxx' is found and executed).

If I run:

```
opt -S --load-pass-plugin=yyy.so -passes="xxx" -O3 < foo.ll
```

then opt produces:

```
Cannot specify -O# and --passes=/--foo-pass, use -passes='default,other-pass'
```

If I run:

```
opt -S --load-pass-plugin=yyy.so -passes="default,xxx" < foo.ll
```

then opt produces:

```
opt: unknown module pass 'xxx'
```

Why? How to execute module pass 'xxx' together with all passes in -O3?

```
$ opt --version
LLVM (http://llvm.org/):
LLVM version 21.1.0
Optimized build with assertions.
Default target:
Host CPU: cascadelake
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the three commands with opt using the shown LLVM 21.1.0 setup, then compare how -O3, --passes, and default are interpreted. Trace the pass-pipeline handling behind the “unknown module pass” diagnostic; done means the behavior is explained and the supported way to run the custom module pass with the O3 pipeline is documented or verified.

Written by the indexing model from the issue text.

Assessment

Domain
cli, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.