[polly] 347e21a - [Polly] Use GenDT in assertion (#179433)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 03:11:00 PST 2026


Author: Michael Kruse
Date: 2026-02-03T11:10:54Z
New Revision: 347e21a2445733f4a32614080289ea13f484c9f8

URL: https://github.com/llvm/llvm-project/commit/347e21a2445733f4a32614080289ea13f484c9f8
DIFF: https://github.com/llvm/llvm-project/commit/347e21a2445733f4a32614080289ea13f484c9f8.diff

LOG: [Polly] Use GenDT in assertion (#179433)

`DT` is always the analysis for the to-be-optimized function while
`GenDT` is the analysis of the function that we currently generate code
for which can also be an outlined function. Here, we want to check
dominance in the generated code, hence we must use `GenDT`.

Fixes: #179135

Added: 
    polly/test/CodeGen/OpenMP/issue179135.ll

Modified: 
    polly/lib/CodeGen/BlockGenerators.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index b87c40c94243e..9d3e2bfea8713 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -778,12 +778,12 @@ void BlockGenerator::generateScalarStores(
 
           Val = getNewValue(Stmt, Val, BBMap, LTS, L);
           assert((!isa<Instruction>(Val) ||
-                  DT.dominates(cast<Instruction>(Val)->getParent(),
-                               Builder.GetInsertBlock())) &&
+                  GenDT->dominates(cast<Instruction>(Val)->getParent(),
+                                   Builder.GetInsertBlock())) &&
                  "Domination violation");
           assert((!isa<Instruction>(Address) ||
-                  DT.dominates(cast<Instruction>(Address)->getParent(),
-                               Builder.GetInsertBlock())) &&
+                  GenDT->dominates(cast<Instruction>(Address)->getParent(),
+                                   Builder.GetInsertBlock())) &&
                  "Domination violation");
 
           Builder.CreateStore(Val, Address);

diff  --git a/polly/test/CodeGen/OpenMP/issue179135.ll b/polly/test/CodeGen/OpenMP/issue179135.ll
new file mode 100644
index 0000000000000..77bb86dde23df
--- /dev/null
+++ b/polly/test/CodeGen/OpenMP/issue179135.ll
@@ -0,0 +1,32 @@
+; RUN: opt  %loadNPMPolly '--passes=polly-custom<delicm;codegen>' --polly-parallel -S < %s | FileCheck %s
+
+; https://github.com/llvm/llvm-project/issues/179135
+; CHECK: @func_polly_subfn(
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+
+define void @func(ptr %arg, i32 %arg1) {
+bb:
+  br label %bb2
+
+bb2:                                              ; preds = %bb9, %bb
+  %i = phi i64 [ 0, %bb ], [ %i10, %bb9 ]
+  br label %bb3
+
+bb3:                                              ; preds = %bb3, %bb2
+  %i4 = phi i64 [ 0, %bb2 ], [ %i7, %bb3 ]
+  %i5 = phi i32 [ 0, %bb2 ], [ %arg1, %bb3 ]
+  %i6 = getelementptr i32, ptr %arg, i64 %i
+  store i32 %i5, ptr %i6, align 4
+  %i7 = add i64 %i4, 1
+  %i8 = icmp eq i64 %i4, 1
+  br i1 %i8, label %bb9, label %bb3
+
+bb9:                                              ; preds = %bb3
+  %i10 = add i64 %i, 1
+  %i11 = icmp eq i64 %i, 1
+  br i1 %i11, label %bb12, label %bb2
+
+bb12:                                             ; preds = %bb9
+  ret void
+}


        


More information about the llvm-commits mailing list