Index: lib/Analysis/InstructionSimplify.cpp =================================================================== --- lib/Analysis/InstructionSimplify.cpp +++ lib/Analysis/InstructionSimplify.cpp @@ -4297,6 +4297,7 @@ case Intrinsic::rint: case Intrinsic::nearbyint: case Intrinsic::round: + case Intrinsic::canonicalize: return true; } } Index: test/Transforms/InstSimplify/call.ll =================================================================== --- test/Transforms/InstSimplify/call.ll +++ test/Transforms/InstSimplify/call.ll @@ -242,6 +242,7 @@ declare float @llvm.trunc.f32(float) nounwind readnone declare float @llvm.rint.f32(float) nounwind readnone declare float @llvm.nearbyint.f32(float) nounwind readnone +declare float @llvm.canonicalize.f32(float) nounwind readnone ; Test idempotent intrinsics define float @test_idempotence(float %a) { @@ -278,13 +279,17 @@ %f0 = call float @llvm.nearbyint.f32(float %a) %f1 = call float @llvm.nearbyint.f32(float %f0) + %g0 = call float @llvm.canonicalize.f32(float %a) + %g1 = call float @llvm.canonicalize.f32(float %g0) + %r0 = fadd float %a1, %b1 %r1 = fadd float %r0, %c1 %r2 = fadd float %r1, %d1 %r3 = fadd float %r2, %e1 %r4 = fadd float %r3, %f1 + %r5 = fadd float %r4, %g1 - ret float %r4 + ret float %r5 } define i8* @operator_new() {