llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[LSR] crashed on "asserting value handle still pointed to this value!"

Open coderchenlin opened this issue 2 years ago • 3 comments

https://godbolt.org/z/MWWcGdxT5 LSR crashed when deleting dead PHIs

coderchenlin avatar Mar 11 '24 03:03 coderchenlin

I will give a resolution to fix it later.

coderchenlin avatar Mar 11 '24 03:03 coderchenlin

#84777 For this case, I think we should not set the value with nullptr when the value's uses are not empty.

coderchenlin avatar Mar 11 '24 16:03 coderchenlin

Reduced:

define i64 @test() {
bb:
  br label %bb1

bb1:
  %phi = phi i8 [ %zext6, %bb5 ], [ 0, %bb ]
  br label %bb2

bb2:
  %phi3 = phi i8 [ %add, %bb2 ], [ %phi, %bb1 ]
  %phi4 = phi i32 [ 0, %bb2 ], [ 1, %bb1 ]
  %add = add i8 %phi3, 1
  br i1 true, label %bb5, label %bb2

bb5:
  %zext = zext i8 %add to i32
  %icmp = icmp sge i32 %phi4, 0
  %zext6 = zext i1 %icmp to i8
  br label %bb1
}

nikic avatar Mar 12 '24 15:03 nikic