# Load external LLVM pass plugins via Swift frontend

**URL:** <https://forums.swift.org/t/load-external-llvm-pass-plugins-via-swift-frontend/67596>\
**Category:** Compiler\
**Tags:** llvm, swift-frontend\
**Created:** [September 29, 2023, 5:40pm UTC](https://forums.swift.org/t/load-external-llvm-pass-plugins-via-swift-frontend/67596 "2023-09-29T17:40:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afrighetto](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/afrighetto/32/31787_2.png) [@afrighetto](https://forums.swift.org/u/afrighetto)\
**Post date:** [September 29, 2023, 5:40pm UTC](https://forums.swift.org/t/load-external-llvm-pass-plugins-via-swift-frontend/67596/1 "2023-09-29T17:40:39Z")

</div>

Hello,

While working on our downstream project based on LLVM, we have identified the need to dynamically load LLVM passes during compilation. Apple Clang offers this possibility via `-fpass-plugin` option, which allows the driver to forward the plugin to LLVM. However, it seems that the Swift frontend/driver doesn't have a comparable feature.

I believe introducing a similar option to the Swift compiler might be beneficial, yet, before considering a patch in this direction, I would be grateful for a feedback from the community.

Thank you.

---

<div class="post-metadata">

**Author:** ![Douglas\_Gregor](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/douglas_gregor/32/1362_2.png) [@Douglas\_Gregor](https://forums.swift.org/u/Douglas_Gregor)\
**Post date:** [September 29, 2023, 5:57pm UTC](https://forums.swift.org/t/load-external-llvm-pass-plugins-via-swift-frontend/67596/2 "2023-09-29T17:57:44Z")

</div>

> [@afrighetto](#):
>
> I believe introducing a similar option to the Swift compiler might be beneficial, yet, before considering a patch in this direction, I would be grateful for a feedback from the community.

Do you mean re-exposing Clang's `-fpass-plugin` through the Swift driver, or do you mean something specific to Swift?

Doug

---

<div class="post-metadata">

**Author:** ![afrighetto](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/afrighetto/32/31787_2.png) [@afrighetto](https://forums.swift.org/u/afrighetto)\
**Post date:** [September 29, 2023, 7:21pm UTC](https://forums.swift.org/t/load-external-llvm-pass-plugins-via-swift-frontend/67596/3 "2023-09-29T19:21:17Z")

</div>

> Do you mean re-exposing Clang's `-fpass-plugin` through the Swift driver, or do you mean something specific to Swift?

Yes, I mean providing the Swift driver (and frontend) with Clang's `-fpass-plugin` option (mimic Clang's behaviour). Sorry for not clarifying it better.
