[llvm] (Draft) [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 02:46:23 PDT 2024


v01dXYZ wrote:

The following breaks:

```
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 @foo(
       i32 noundef %n_real_zones,
        ptr noundef %real_zones
) {
entry:
  br label %for.cond

for.cond:                                         ; preds = %for.cond.cleanup3, %entry
  %j.0 = phi i32 [ 0, %entry ], [ %inc7, %for.cond.cleanup3 ]
  %n_real_zones.addr.0 = phi i32 [ %n_real_zones, %entry ], [ %n_real_zones.addr.1, %for.cond.cleanup3 ]
  %cmp = icmp ult i32 %j.0, 128
  br label %for.cond1

for.cond1:                                        ; preds = %for.body4, %for.cond
  %n_real_zones.addr.1 = phi i32 [ %n_real_zones.addr.0, %for.cond ], [ %inc, %for.body4 ]
  %i.0 = phi i32 [ 0, %for.cond ], [ %inc5, %for.body4 ]
  %cmp2 = icmp ult i32 %i.0, 128
  br i1 %cmp2, label %for.body4, label %for.cond.cleanup3

for.cond.cleanup3:                                ; preds = %for.cond1
  %inc7 = add nuw nsw i32 %j.0, 1
  br label %for.cond

for.body4:                                        ; preds = %for.cond1
  %idxprom = sext i32 %n_real_zones.addr.1 to i64
  %arrayidx = getelementptr inbounds i32, ptr %real_zones, i64 %idxprom
  store i32 %j.0, ptr %arrayidx, align 4
  %inc = add nsw i32 %n_real_zones.addr.1, 1
  %inc5 = add nuw nsw i32 %i.0, 1
  br label %for.cond1
}
```

I don't know why it seems to depend on `datalayout`.

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


More information about the llvm-commits mailing list