[llvm] [LoopInterchange] Check all inner-exit LCSSA PHIs (PR #200860)
Madhur Amilkanthwar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 2 23:50:18 PDT 2026
================
@@ -0,0 +1,54 @@
+; Non-reduction LCSSA PHIs in the inner-loop exit must still be validated
+; even when a reduction LCSSA PHI is present. Used to crash.
+;
+; RUN: opt < %s -passes=loop-interchange -loop-interchange-reduction-to-mem \
+; RUN: -pass-remarks-missed=loop-interchange -pass-remarks-output=%t -S \
+; RUN: | FileCheck -check-prefix=IR %s
+; RUN: FileCheck --input-file=%t %s
+
+; CHECK: --- !Missed
+; CHECK-NEXT: Pass: loop-interchange
+; CHECK-NEXT: Name: UnsupportedExitPHI
+; CHECK-NEXT: Function: reduction_lcssa_with_non_phi_user
+; CHECK-NEXT: Args:
+; CHECK-NEXT: - String: Found unsupported PHI node in loop exit.
+
+ at A = common global [100 x [100 x i32]] zeroinitializer
+ at sum = common global [100 x i32] zeroinitializer
+
+; IR-LABEL: @reduction_lcssa_with_non_phi_user(
+; IR-NOT: split
+define void @reduction_lcssa_with_non_phi_user() {
+entry:
+ br label %outer.header
+
+outer.header:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %outer.latch ]
+ %sum.ptr = getelementptr inbounds [100 x i32], ptr @sum, i64 0, i64 %i
----------------
madhur13490 wrote:
Hmm..I think we need to discuss this. I did a quick check of llvm/test/ and it shows all (64) files using my way for the suggested element-typed shape, including the surrounding LoopInterchange/ tests (17). I don't see precedent in code for what you're suggesting for GEP instruction.
https://github.com/llvm/llvm-project/pull/200860
More information about the llvm-commits
mailing list