[llvm] [SPIR-V] Add pre-headers to loops. (PR #75844)

Natalie Chouinard via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 08:31:34 PST 2024


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/75844 at github.com>


================
@@ -151,6 +152,13 @@ TargetPassConfig *SPIRVTargetMachine::createPassConfig(PassManagerBase &PM) {
 }
 
 void SPIRVPassConfig::addIRPasses() {
+  if (TM.getSubtargetImpl()->isVulkanEnv()) {
+    // Once legalized, we need to structurize the CFG to follow the spec.
+    // This is done through the following 8 steps.
+    // TODO(#75801): add the remaining steps.
+    addPass(createLoopSimplifyPass());
----------------
sudonatalie wrote:

Maybe add a brief comment for each step here:

```
// 1.  Simplify loop for subsequent transformations by inserting pre-headers and guaranteeing a single backedge.
```

https://github.com/llvm/llvm-project/pull/75844


More information about the llvm-commits mailing list