Skip to content

Commit c80cabf

Browse files
committed
[SCCP] Avoid use of undef value in test (NFC)
Avoid optimization away most of the code if we resolve this to a specific value.
1 parent 0f5f440 commit c80cabf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/test/Transforms/SCCP/widening.ll

+4-4
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ exit:
432432
; In the function below, the condition %c.1 results in a range [7, 6), which
433433
; can be used as a widening bound. It does not fully contain the range we get
434434
; from combining it with the information from %tmp12.
435-
define void @foo(ptr %arg) {
435+
define void @foo(ptr %arg, i8 %x) {
436436
; SCCP-LABEL: @foo(
437437
; SCCP-NEXT: bb:
438-
; SCCP-NEXT: [[TMP:%.*]] = zext i8 undef to i32
438+
; SCCP-NEXT: [[TMP:%.*]] = zext i8 [[X:%.*]] to i32
439439
; SCCP-NEXT: [[TMP2:%.*]] = load i64, ptr [[ARG:%.*]], align 8
440440
; SCCP-NEXT: switch i32 [[TMP]], label [[BB20:%.*]] [
441441
; SCCP-NEXT: i32 1, label [[BB3:%.*]]
@@ -472,7 +472,7 @@ define void @foo(ptr %arg) {
472472
;
473473
; IPSCCP-LABEL: @foo(
474474
; IPSCCP-NEXT: bb:
475-
; IPSCCP-NEXT: [[TMP:%.*]] = zext i8 undef to i32
475+
; IPSCCP-NEXT: [[TMP:%.*]] = zext i8 [[X:%.*]] to i32
476476
; IPSCCP-NEXT: [[TMP2:%.*]] = load i64, ptr [[ARG:%.*]], align 8
477477
; IPSCCP-NEXT: switch i32 [[TMP]], label [[BB20:%.*]] [
478478
; IPSCCP-NEXT: i32 1, label [[BB3:%.*]]
@@ -508,7 +508,7 @@ define void @foo(ptr %arg) {
508508
; IPSCCP-NEXT: ret void
509509
;
510510
bb:
511-
%tmp = zext i8 undef to i32
511+
%tmp = zext i8 %x to i32
512512
%tmp2 = load i64, ptr %arg, align 8
513513
switch i32 %tmp, label %bb20 [
514514
i32 1, label %bb3

0 commit comments

Comments
 (0)