From 533bd17268a7eb5454fd6865ca4ad488b0a35982 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 4 Mar 2015 19:24:16 +0000 Subject: [PATCH] Fix test/CodeGen/builtins.c for platforms that don't lower sjlj Opt in Win64 to supporting sjlj lowering. We have the backend lowering, so I think this was just an oversight because WinX86_64TargetCodeGenInfo doesn't inherit from X86_64TargetCodeGenInfo. llvm-svn: 231280 --- clang/lib/CodeGen/TargetInfo.cpp | 4 ++++ clang/test/CodeGen/builtin-longjmp.c | 1 + clang/test/CodeGen/builtins.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 31f4a4353518..0fa61378995d 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -1724,6 +1724,10 @@ public: unsigned getOpenMPSimdDefaultAlignment(QualType) const override { return HasAVX ? 32 : 16; } + + bool hasSjLjLowering(CodeGen::CodeGenFunction &CGF) const override { + return true; + } }; void WinX86_64TargetCodeGenInfo::SetTargetAttributes(const Decl *D, diff --git a/clang/test/CodeGen/builtin-longjmp.c b/clang/test/CodeGen/builtin-longjmp.c index 8c895af51676..73ef4f2bf8c6 100644 --- a/clang/test/CodeGen/builtin-longjmp.c +++ b/clang/test/CodeGen/builtin-longjmp.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s| FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| FileCheck %s diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c index 1ab29a659b31..bf7874b08862 100644 --- a/clang/test/CodeGen/builtins.c +++ b/clang/test/CodeGen/builtins.c @@ -220,6 +220,8 @@ void test_float_builtin_ops(float F, double D, long double LD) { // CHECK: call x86_fp80 @llvm.fabs.f80(x86_fp80 } +// __builtin_longjmp isn't supported on all platforms, so only test it on X86. +#ifdef __x86_64__ // CHECK-LABEL: define void @test_builtin_longjmp void test_builtin_longjmp(void **buffer) { // CHECK: [[BITCAST:%.*]] = bitcast @@ -227,6 +229,7 @@ void test_builtin_longjmp(void **buffer) { __builtin_longjmp(buffer, 1); // CHECK-NEXT: unreachable } +#endif // CHECK-LABEL: define i64 @test_builtin_readcyclecounter long long test_builtin_readcyclecounter() {