Skip to content

[LVI][CVP] CVP error deleted the and instruction. #68381

Closed
llvm/llvm-project-release-prs
#728
@dianqk

Description

@dianqk

I tried this IR:

define i32 @foo(i1 %c0, i1 %c1, i8 %v1, i8 %v2) {
start:
  br i1 %c0, label %bb0, label %bb1

bb0:                                              ; preds = %bb1, %start
  %v2_i32 = zext i8 %v2 to i32
  br label %bb1

bb1:                                              ; preds = %bb0, %start
  %x = phi i32 [ %v2_i32, %bb0 ], [ undef, %start ]
  br i1 %c1, label %bb0, label %bb2

bb2:                                              ; preds = %bb1
  %v1_i32 = zext i8 %v1 to i32
  %y = or i32 %x, %v1_i32
  %z = and i32 %y, 255
  ret i32 %z
}

%z = and i32 %y, 255 should not be deleted by CVP.

alive2: https://alive2.llvm.org/ce/z/A9T1PH
godbolt: https://llvm.godbolt.org/z/YEqPjTv83

This issue started with LLVM 15.

This IR is reduced from https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Implementing.20niche.20checks.

Extended to abs: https://alive2.llvm.org/ce/z/k_8paG.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions