[llvm] [SROA] Unfold gep of index phi (round 2) (PR #83494)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 03:58:02 PST 2024


dtcxzyw wrote:

```
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"
target triple = "x86_64-unknown-linux-gnu"

%struct.FloatParts128 = type { i8, i8, i32, i64, i64 }

define { i64, i64 } @float128_div(ptr %pa, i8 %cond) {
entry:
  %pa1 = alloca %struct.FloatParts128, align 8
  br label %parts128_div.exit

if.end48.i:                                       ; No predecessors!
  switch i8 %cond, label %common.ret [
    i8 1, label %parts128_div.exit
    i8 0, label %parts128_div.exit
  ]

common.ret:                                       ; preds = %parts128_div.exit, %if.end48.i
  ret { i64, i64 } zeroinitializer

parts128_div.exit:                                ; preds = %if.end48.i, %if.end48.i, %entry
  %retval.i7.0 = phi ptr [ %pa, %if.end48.i ], [ %pa, %if.end48.i ], [ %pa1, %entry ]
  %frac_lo.i = getelementptr i8, ptr %retval.i7.0, i64 16
  %0 = load i64, ptr %frac_lo.i, align 8
  br label %common.ret
}

```

```
> bin/opt -passes=sroa reduced.ll -S

PHI node has multiple entries for the same basic block with different incoming values!
  %retval.i7.0.sroa.phi = phi ptr [ %retval.i7.0.sroa.gep, %if.end48.i ], [ %retval.i7.0.sroa.gep1, %if.end48.i ], [ %pa1.sroa.0, %entry ]
label %if.end48.i
  %retval.i7.0.sroa.gep = getelementptr i8, ptr %pa, i64 16
  %retval.i7.0.sroa.gep1 = getelementptr i8, ptr %pa, i64 16
LLVM ERROR: Broken module found, compilation aborted!
```

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


More information about the llvm-commits mailing list