Skip to content

[RISC-V] Use of %0 does not have a corresponding definition on every path with -O0 #93587

Closed
@patrick-rivos

Description

@patrick-rivos

Reduced LLVM IR:

define i16 @f() {
BB:
  br label %BB1

BB1:                                              ; preds = %BB1, %BB
  %A = or i16 0, 0
  %B = fcmp true float 0.000000e+00, 0.000000e+00
  %C = or i1 %B, false
  br i1 %C, label %BB1, label %BB2

BB2:                                              ; preds = %BB1
  ret i16 %A
}

Godbolt: https://godbolt.org/z/7GGzqs5c6

BB state before the LiveIntervalAnalysis pass from debug log:

BB.0    BB.3 (unreachable)
 |     /    \
BB.1(loops)  BB.2 -> ret

Since BB.1 defines %0 and BB.2 reads it, LiveIntervalAnalysis complains about
the undefined value in the unreachable codepath.

First visibly bad commit:
af82d01 [RISCV] Separate doLocalPostpass into new pass...

I think this is just because LiveIntervalAnalysis isn't run before this commit.

One step further back is the commit that causes bb to be split into bb.3.
2c18570 [RISCV] Remove setJumpIsExpensive()

Can be mitigated by -mllvm -jump-is-expensive=true

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions