diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp --- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -80,7 +80,7 @@ getActionDefinitionsBuilder({G_IMPLICIT_DEF, G_FREEZE}) .legalFor({p0, s1, s8, s16, s32, s64}) .legalFor(PackedVectorAllTypeList) - .clampScalar(0, s1, s64) + .clampScalar(0, s8, s64) .widenScalarToNextPow2(0, 8) .fewerElementsIf( [=](const LegalityQuery &Query) { diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-freeze.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-freeze.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-freeze.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-freeze.mir @@ -85,3 +85,35 @@ $w0 = COPY %1 $w1 = COPY %2 ... +--- +name: test_freeze_s1 +body: | + bb.0.entry: + liveins: $x0 + ; CHECK-LABEL: name: test_freeze_s1 + ; CHECK: %x:_(s1) = G_IMPLICIT_DEF + ; CHECK: %freeze:_(s1) = G_FREEZE %x + ; CHECK: %ext:_(s64) = G_ZEXT %freeze(s1) + ; CHECK: $x0 = COPY %ext(s64) + %x:_(s1) = G_IMPLICIT_DEF + %freeze:_(s1) = G_FREEZE %x + %ext:_(s64) = G_ZEXT %freeze + $x0 = COPY %ext(s64) +... +--- +name: test_freeze_s2 +body: | + bb.0.entry: + liveins: $x0 + ; CHECK-LABEL: name: test_freeze_s2 + ; CHECK: [[DEF:%[0-9]+]]:_(s8) = G_IMPLICIT_DEF + ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY [[DEF]](s8) + ; CHECK: [[FREEZE:%[0-9]+]]:_(s8) = G_FREEZE [[COPY]] + ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 3 + ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[FREEZE]](s8) + ; CHECK: %ext:_(s64) = G_AND [[ANYEXT]], [[C]] + ; CHECK: $x0 = COPY %ext(s64) + %x:_(s2) = G_IMPLICIT_DEF + %freeze:_(s2) = G_FREEZE %x + %ext:_(s64) = G_ZEXT %freeze + $x0 = COPY %ext(s64)