<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104905>104905</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mikaelholmen
</td>
</tr>
</table>
<pre>
llvm commit: c91cc459d396d
Reproduce with:
```opt -passes=instcombine bbi-98201.ll -o /dev/null```
Result:
```
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
```
It does succeed without error if we allow two iterations like
```
opt -passes="instcombine<max-iterations=2>" bbi-98201.ll -o /dev/null
```
Debug printouts when it fails:
```
Args: build-all/bin/opt -passes=instcombine bbi-98201.ll -o /dev/null -debug
INSTCOMBINE ITERATION #1 on test
ADD: ret i16 0
ADD: %call2 = call i16 @check_i16(i16 %lnot.ext)
ADD: %lnot.ext = zext i1 %lnot to i16
ADD: %lnot = xor i1 %cmp, true
ADD: %cmp = icmp eq ptr %1, %2
ADD: %2 = load ptr, ptr %sp_post, align 1
ADD: %1 = load ptr, ptr %sp_pre, align 1
ADD: store ptr %0, ptr %sp_post, align 1
ADD: %0 = call ptr @getsp()
ADD: call void @llvm.lifetime.start.p0(i64 1, ptr %sp_post)
ADD: call void asm sideeffect "// barrier", "~{memory}"()
ADD: %call1 = call i16 @check_i16(i16 0)
ADD: call void asm sideeffect "// barrier", "~{memory}"()
ADD: store ptr null, ptr %sp_pre, align 1
ADD: %sp_post = alloca ptr, align 1
ADD: %sp_pre = alloca ptr, align 1
IC: Visiting: %sp_pre = alloca ptr, align 1
IC: Visiting: %sp_post = alloca ptr, align 1
IC: Visiting: store ptr null, ptr %sp_pre, align 1
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"()
IC: Mod = call void asm sideeffect "// barrier", "~{memory}"()
New = call void asm sideeffect "// barrier", "~{memory}"() #1
ADD: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: %call1 = call i16 @check_i16(i16 0)
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"()
IC: Mod = call void asm sideeffect "// barrier", "~{memory}"()
New = call void asm sideeffect "// barrier", "~{memory}"() #1
ADD: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: call void @llvm.lifetime.start.p0(i64 1, ptr %sp_post)
IC: Mod = call void @llvm.lifetime.start.p0(i64 1, ptr %sp_post)
New = call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sp_post)
ADD: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sp_post)
IC: Visiting: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sp_post)
IC: Visiting: %0 = call ptr @getsp()
IC: Visiting: store ptr %0, ptr %sp_post, align 1
IC: Visiting: %1 = load ptr, ptr %sp_pre, align 1
IC: Visiting: %2 = load ptr, ptr %sp_post, align 1
IC: Replacing %2 = load ptr, ptr %sp_post, align 1
with %0 = call ptr @getsp()
IC: Mod = %2 = load ptr, ptr %sp_post, align 1
New = %2 = load ptr, ptr %sp_post, align 1
IC: ERASE %2 = load ptr, ptr %sp_post, align 1
ADD DEFERRED: %sp_post = alloca ptr, align 1
ADD: %sp_post = alloca ptr, align 1
IC: Visiting: %sp_post = alloca ptr, align 1
IC: ERASE store ptr %0, ptr %sp_post, align 1
ADD DEFERRED: %0 = call ptr @getsp()
ADD DEFERRED: %cmp = icmp eq ptr %1, %0
ADD DEFERRED: %sp_post = alloca ptr, align 1
ADD DEFERRED: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sp_post)
IC: ERASE call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sp_post)
IC: ERASE %sp_post = alloca ptr, align 1
ADD: %0 = call ptr @getsp()
IC: Visiting: %0 = call ptr @getsp()
IC: Visiting: %cmp = icmp eq ptr %1, %0
IC: Visiting: %lnot = xor i1 %cmp, true
IC: Replacing %lnot = xor i1 %cmp, true
with %cmp = icmp ne ptr %1, %0
ADD: %lnot = xor i1 %cmp, true
IC: Mod = %lnot = xor i1 %cmp, true
New = %lnot = xor i1 %cmp, true
IC: ERASE %lnot = xor i1 %cmp, true
ADD DEFERRED: %cmp = icmp ne ptr %1, %0
ADD DEFERRED: %lnot.ext = zext i1 %cmp to i16
ADD: %cmp = icmp ne ptr %1, %0
IC: Visiting: %cmp = icmp ne ptr %1, %0
IC: Visiting: %lnot.ext = zext i1 %cmp to i16
IC: Visiting: %call2 = call i16 @check_i16(i16 %lnot.ext)
IC: Visiting: ret i16 0
INSTCOMBINE ITERATION #2 on test
ADD: ret i16 0
ADD: %call2 = call i16 @check_i16(i16 %lnot.ext)
ADD: %lnot.ext = zext i1 %cmp to i16
ADD: %cmp = icmp ne ptr %1, %0
ADD: %1 = load ptr, ptr %sp_pre, align 1
ADD: %0 = call ptr @getsp()
ADD: call void asm sideeffect "// barrier", "~{memory}"() #1
ADD: %call1 = call i16 @check_i16(i16 0)
ADD: call void asm sideeffect "// barrier", "~{memory}"() #1
ADD: store ptr null, ptr %sp_pre, align 1
ADD: %sp_pre = alloca ptr, align 1
IC: Visiting: %sp_pre = alloca ptr, align 1
IC: Visiting: store ptr null, ptr %sp_pre, align 1
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: %call1 = call i16 @check_i16(i16 0)
IC: Visiting: call void asm sideeffect "// barrier", "~{memory}"() #1
IC: Visiting: %0 = call ptr @getsp()
IC: Visiting: %1 = load ptr, ptr %sp_pre, align 1
Captured?: %sp_pre = alloca ptr, align 1 = not captured
IC: Replacing %1 = load ptr, ptr %sp_pre, align 1
with ptr null
IC: Mod = %1 = load ptr, ptr %sp_pre, align 1
New = %1 = load ptr, ptr %sp_pre, align 1
IC: ERASE %1 = load ptr, ptr %sp_pre, align 1
ADD DEFERRED: %sp_pre = alloca ptr, align 1
ADD DEFERRED: store ptr null, ptr %sp_pre, align 1
ADD: store ptr null, ptr %sp_pre, align 1
ADD: %sp_pre = alloca ptr, align 1
IC: Visiting: %sp_pre = alloca ptr, align 1
IC: ERASE store ptr null, ptr %sp_pre, align 1
ADD DEFERRED: %sp_pre = alloca ptr, align 1
IC: ERASE %sp_pre = alloca ptr, align 1
IC: Visiting: %cmp = icmp ne ptr null, %0
IC: Mod = %cmp = icmp ne ptr null, %0
New = %cmp = icmp ne ptr %0, null
ADD: %cmp = icmp ne ptr %0, null
IC: Visiting: %cmp = icmp ne ptr %0, null
IC: Visiting: %lnot.ext = zext i1 %cmp to i16
IC: Visiting: %call2 = call i16 @check_i16(i16 %lnot.ext)
IC: Visiting: ret i16 0
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
```
[bbi-98201.ll.gz](https://github.com/user-attachments/files/16672257/bbi-98201.ll.gz)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWltv4roT_zTmZQRynHB74KEtICHtdiV2ta8rkwzg_zpx_rZTuvtwPvuRTWm5pSQp3d2jc6SqBMe_mfHMZG6BGyNWGeKIdG9Jd9zihV0rPUrFd45yrWSKWWuhkh8jKR9SiFWaCkvCG4iHQRxH3WESDnsJoWNCb-aYa5UUMcJG2DUJb7bLpEe3fyq30M65MWhIOBaZsbFKFyJDWCxEezhgNOhICW0FhE0TfCBsmhVSPuN3XEwh7Sn17dcPH75-hMl8_mnuhJxlxuoitkJlcOd5iWwFiUggUxY08ngNHJbiMVcis8CXFjUEICxq7kDmLI-ZhUShAVPEMWLiT6sKC6i10iCWsEHgUqoN2I3aIwZSfMezFA81QxjbUw4J71L-2N6TKRwzEk4IYxf0do7TGBfFCnItMqsKa2CzxgyEhSUX0pQp9Uav3D1YFEImbS4lYdOFyAibNjQptBMvxxO3vf-z-89f7j59vJ3dT2D2ZTK_-TL7dA-EhQGoDCwa-yTSeOwkAtBoQQQ9o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