diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4801,7 +4801,8 @@ // If the parent function flushes denormals, the canonical output cannot // be a denormal. - const fltSemantics &FPType = II->getType()->getFltSemantics(); + const fltSemantics &FPType = + II->getType()->getScalarType()->getFltSemantics(); DenormalMode DenormMode = II->getFunction()->getDenormalMode(FPType); if (DenormMode.inputsAreZero() || DenormMode.outputsAreZero()) Known.knownNot(fcSubnormal); diff --git a/llvm/test/Transforms/InstCombine/canonicalize.ll b/llvm/test/Transforms/InstCombine/canonicalize.ll --- a/llvm/test/Transforms/InstCombine/canonicalize.ll +++ b/llvm/test/Transforms/InstCombine/canonicalize.ll @@ -457,5 +457,20 @@ ret i1 %cmp } +; -------------------------------------------------------------------- +; Others +; -------------------------------------------------------------------- + +; Regression test checking that the vector version of llvm.canonicalize works. +define <2 x i1> @vec_canonicalize_with_fpclass(<2 x float> %x) { +; CHECK-LABEL: @vec_canonicalize_with_fpclass( +; CHECK-NEXT: ret <2 x i1> zeroinitializer +; + %canon = call <2 x float> @llvm.canonicalize.v2f32(<2 x float> %x) + %fpclass = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %canon, i32 1) + ret <2 x i1> %fpclass +} + declare float @llvm.canonicalize.f32(float) declare <2 x float> @llvm.canonicalize.v2f32(<2 x float>) +declare <2 x i1> @llvm.is.fpclass.v2f32(<2 x float>, i32 immarg)