Skip to content

Commit 0eeeced

Browse files
committed
allow unknown
1 parent eb82363 commit 0eeeced

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
426426
bool useAA() const { return getST()->useAA(); }
427427

428428
bool isTypeLegal(Type *Ty) {
429-
EVT VT = getTLI()->getValueType(DL, Ty);
429+
EVT VT = getTLI()->getValueType(DL, Ty, /*AllowUnknown=*/true);
430430
return getTLI()->isTypeLegal(VT);
431431
}
432432

llvm/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,3 +2068,25 @@ cond.end: ; preds = %entry, %cond.false
20682068
%conv = sext i3 %cond to i8
20692069
ret i8 %conv
20702070
}
2071+
2072+
; Don't create a table with an unknown type
2073+
define { i8, i8 } @test_unknown_result_type(i8 %n) {
2074+
; CHECK-LABEL: @test_unknown_result_type(
2075+
; CHECK-NEXT: entry:
2076+
; CHECK-NEXT: switch
2077+
entry:
2078+
switch i8 %n, label %sw.default [
2079+
i8 0, label %return
2080+
i8 1, label %return
2081+
i8 2, label %return
2082+
]
2083+
2084+
sw.default: ; preds = %entry
2085+
%0 = insertvalue { i8, i8 } undef, i8 0, 0
2086+
%1 = insertvalue { i8, i8 } %0, i8 1, 1
2087+
br label %return
2088+
2089+
return: ; preds = %sw.default, %entry, %entry, %entry
2090+
%retval.0 = phi { i8, i8 } [ undef, %entry ], [ undef, %entry ], [ undef, %entry ], [ %1, %sw.default ]
2091+
ret { i8, i8 } %retval.0
2092+
}

0 commit comments

Comments
 (0)