From nicholas at mxc.ca Mon Jan 31 00:09:16 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 30 Jan 2011 22:09:16 -0800 Subject: [llvm-commits] [llvm] r124282 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp In-Reply-To: <4D3FDFF6.9090906@free.fr> References: <20110126084022.877D52A6C12D@llvm.org> <4D3FDFF6.9090906@free.fr> Message-ID: <4D46520C.8020207@mxc.ca> Duncan Sands wrote: > Hi Nick, > >> Fix memory corruption. If one of the SCEV creation functions calls another but >> doesn't return immediately after then the insert position in UniqueSCEVs will >> be out of date. No test because this is a memory corruption issue. Fixes PR9051! > > thanks for fixing it. Adding a test is still useful since the valgrind > buildbots should spot the memory corruption if it ever comes back. The only testcase I have requires running 9 optimization passes including instcombine and inlining. Changes in any of those or could cause this testcase to change pass/fail. I don't think that's a useful testcase to commit; it won't be testing for this problem in the near future when those other passes change. And I can't write anything more targeted since it's a memory corruption issue. Nick From baldrick at free.fr Mon Jan 31 02:43:21 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 31 Jan 2011 09:43:21 +0100 Subject: [llvm-commits] [llvm] r124567 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/add.ll In-Reply-To: <20110130220113.BD5322A6C12C@llvm.org> References: <20110130220113.BD5322A6C12C@llvm.org> Message-ID: <4D467629.6010405@free.fr> Hi Anders, > Recognize and simplify > > (A+B) == A -> B == 0 > A == (A+B) -> B == 0 there are similar transforms for subtraction and xor. Ciao, Duncan. From geek4civic at gmail.com Mon Jan 31 03:41:20 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 31 Jan 2011 09:41:20 -0000 Subject: [llvm-commits] [llvm] r124583 - /llvm/trunk/include/llvm/Config/llvm-config.h.cmake Message-ID: <20110131094120.8E36B2A6C12C@llvm.org> Author: chapuni Date: Mon Jan 31 03:41:20 2011 New Revision: 124583 URL: http://llvm.org/viewvc/llvm-project?rev=124583&view=rev Log: CMake: Fix a few definition to suppress warnings. Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=124583&r1=124582&r2=124583&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Mon Jan 31 03:41:20 2011 @@ -47,7 +47,7 @@ #cmakedefine LLVM_MANDIR "${LLVM_MANDIR}" /* Build multithreading support into LLVM */ -#cmakedefine LLVM_MULTITHREADED +#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED} /* LLVM architecture name for the native architecture, if available */ #cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH} @@ -62,10 +62,10 @@ #cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter /* Define if this is Unixish platform */ -#cmakedefine LLVM_ON_UNIX +#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} /* Define if this is Win32ish platform */ -#cmakedefine LLVM_ON_WIN32 +#cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32} /* Define to path to circo program if found or 'echo circo' otherwise */ #cmakedefine LLVM_PATH_CIRCO "${LLVM_PATH_CIRCO}" From geek4civic at gmail.com Mon Jan 31 06:18:18 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Mon, 31 Jan 2011 21:18:18 +0900 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) Message-ID: Good evening, guys! Now I can build clang and llvm on Windows x64 with both mingw-w64-g++ and w64-clang. Here, some patches are, to build. Please take a look into them. I have checked on x86_64-centos5, mingw32(and msys), msvs10 and stage3-mingw64-clang(with my patches). ps. please see also; http://llvm.org/bugs/show_bug.cgi?id=9100 ...Takumi * 0001-Windows-Windows.h-mingw64-might-have-_WIN32_WINN.patch.txt [PR8848] I will honor predefined _WN32_WINNT on x64 compilers. * 0002-Windows-DynamicLibrary.inc-ELM_Callback-fix.patch.txt [PR8848] I split conditions. It would be easier to read, I suppose. * 0003-lib-Target-X86-X86JITInfo.cpp-Add-Win64-stuff.patch.txt It would be essential to run JIT on x64 with mingw64. * 0004-autoconf-define-HAVE_DECL_SETINFORMATIONJOBOBJEC.patch.txt * 0005-Regenerate-configure-and-config.h.in.patch.txt.gz * 0006-CMake-define-HAVE_DECL_SETINFORMATIONJOBOBJECT-f.patch.txt * 0007-Windows-Program.inc-Declare-SetInformationJobObj.patch.txt Ancient mingw32 might not have the declaration of SetInformationJobObject(). Autoconf and CMake can find the decl in windows.h(winbase.h). * 0008-Autoconf-may-check-symbols-in-libgcc.a-for-JIT-o.patch.txt * 0009-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz * 0010-CMake-may-check-symbols-in-libgcc.a-for-JIT-on-M.patch.txt * 0011-Windows-DynamicLibrary.inc-Split-explicit-symbol.patch.txt I know it would be gross, but I think it practical. Autoconf and CMake seeks symbols for JIT. FIXME: __cmpdi2 and __main would never be referred to by anyone, I guess. FIXME: Is there good way to extract symbols for JIT from lib/CodeGen/SelectionDAG/TargetLowering.cpp? * 0012-autoconf-Seek-strerror_s-with-AC_CHECK_DECLS.patch.txt * 0013-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz * 0014-CMake-Use-HAVE_DECL_STRERROR_S.patch.txt * 0015-lib-Support-Errno.cpp-Use-HAVE_DECL_STRERROR_S.patch.txt On mingw64, strerror_s() is defined in libs but not defined int string.h by default. AC_CHECK_DECL can inspect the declaration. I wish it would work even if strerror_s() were defined by default! -------------- next part -------------- From 12a7fe6d728fadbcd0f1bee6a6f51e9446546ed1 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:33:35 +0900 Subject: [PATCH 01/15] Windows/Windows.h: mingw64 might have _WIN32_WINNT. --- lib/Support/Windows/Windows.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/Support/Windows/Windows.h b/lib/Support/Windows/Windows.h index 6e0b585..8eaaf31 100644 --- a/lib/Support/Windows/Windows.h +++ b/lib/Support/Windows/Windows.h @@ -17,9 +17,15 @@ //===----------------------------------------------------------------------===// // Require at least Windows 2000 API. +#ifdef _WIN32_WINNT +#if _WIN32_WINNT < 0x0500 +#error "We assume at least Windows 2000 API." +#endif +#else #define _WIN32_WINNT 0x0500 #define _WIN32_IE 0x0500 // MinGW at it again. #define WIN32_LEAN_AND_MEAN +#endif #include "llvm/Config/config.h" // Get build system configuration settings #include -- 1.7.1.GIT -------------- next part -------------- From 153aaa222fa30c42c6484743ea3e8b2926fbebe4 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 18 Jan 2011 15:30:58 +0900 Subject: [PATCH 14/15] CMake: Use HAVE_DECL_STRERROR_S. --- cmake/config-ix.cmake | 2 +- include/llvm/Config/config.h.cmake | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 7a4bc4b..4c7cce6 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -120,7 +120,7 @@ check_symbol_exists(sbrk unistd.h HAVE_SBRK) check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) -check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) +check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S) check_symbol_exists(memcpy string.h HAVE_MEMCPY) check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index af96713..bc19dbe 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -84,6 +84,10 @@ to 0 if you don't. */ #cmakedefine HAVE_DECL_SETINFORMATIONJOBOBJECT ${HAVE_DECL_SETINFORMATIONJOBOBJECT} +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_STRERROR_S ${HAVE_DECL_STRERROR_S} + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} @@ -390,9 +394,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} -/* Define to 1 if you have the `strerror_s' function. */ -#cmakedefine HAVE_STRERROR_S ${HAVE_STRERROR_S} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} -- 1.7.1.GIT -------------- next part -------------- From 66d99c25103322e8b698ccf7cf34e814599eca9a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:32:27 +0900 Subject: [PATCH 15/15] lib/Support/Errno.cpp: Use HAVE_DECL_STRERROR_S. --- lib/Support/Errno.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Support/Errno.cpp b/lib/Support/Errno.cpp index 312d91e..c2a0f71 100644 --- a/lib/Support/Errno.cpp +++ b/lib/Support/Errno.cpp @@ -50,7 +50,7 @@ std::string StrError(int errnum) { # else strerror_r(errnum,buffer,MaxErrStrLen-1); # endif -#elif defined(HAVE_STRERROR_S) // Windows. +#elif HAVE_DECL_STRERROR_S // MSVCRT.DLL does not provide one. if (errnum) strerror_s(buffer, errnum); #elif defined(HAVE_STRERROR) -- 1.7.1.GIT -------------- next part -------------- From 55a639b49c6f98ccd66ff28a2edc66c1b44264fc Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:32:50 +0900 Subject: [PATCH 02/15] Windows/DynamicLibrary.inc: ELM_Callback fix --- lib/Support/Windows/DynamicLibrary.inc | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5fad37a..5e10f77 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -55,7 +55,17 @@ extern "C" { // Use new callback if: // - Newer Visual Studio (comes with newer SDK). // - Visual Studio 2005 with Windows SDK 6.0+ -#if !defined(_MSC_VER) || _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) +#if defined(_MSC_VER) + #if _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) + #define OLD_ELM_CALLBACK_DECL 1 + #endif +#elif defined(__MINGW64__) + // Use new callback. +#elif defined(__MINGW32__) + #define OLD_ELM_CALLBACK_DECL 1 +#endif + +#ifdef OLD_ELM_CALLBACK_DECL static BOOL CALLBACK ELM_Callback(PSTR ModuleName, ModuleBaseType ModuleBase, ULONG ModuleSize, -- 1.7.1.GIT -------------- next part -------------- From 4b332e7e9a52c34fcea820b903fad2b83d05c256 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 19 Dec 2010 15:20:08 +0900 Subject: [PATCH 03/15] lib/Target/X86/X86JITInfo.cpp: Add Win64 stuff. --- lib/Target/X86/X86JITInfo.cpp | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp index 759de77..127738d 100644 --- a/lib/Target/X86/X86JITInfo.cpp +++ b/lib/Target/X86/X86JITInfo.cpp @@ -127,9 +127,17 @@ extern "C" { "movaps %xmm6, 96(%rsp)\n" "movaps %xmm7, 112(%rsp)\n" // JIT callee +#ifdef _WIN64 + "subq $32, %rsp\n" + "movq %rbp, %rcx\n" // Pass prev frame and return address + "movq 8(%rbp), %rdx\n" + "call " ASMPREFIX "X86CompilationCallback2\n" + "addq $32, %rsp\n" +#else "movq %rbp, %rdi\n" // Pass prev frame and return address "movq 8(%rbp), %rsi\n" "call " ASMPREFIX "X86CompilationCallback2\n" +#endif // Restore all XMM arg registers "movaps 112(%rsp), %xmm7\n" "movaps 96(%rsp), %xmm6\n" -- 1.7.1.GIT -------------- next part -------------- From 1b0da0721514257a220a196b8a7aee4e1ea25cc5 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 12:57:55 +0900 Subject: [PATCH 04/15] autoconf: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- autoconf/configure.ac | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 0cc3d3e..cc39ee4 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1220,6 +1220,7 @@ AC_CHECK_LIB(m,sin) if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(imagehlp, main) AC_CHECK_LIB(psapi, main) + AC_CHECK_DECLS([SetInformationJobObject],,,[#include ]) fi dnl dlopen() is required for plugin support. -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-Regenerate-configure-and-config.h.in.patch.txt.gz Type: application/x-gzip Size: 1304 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/0ff31aeb/attachment-0003.gz -------------- next part -------------- From 823a234b5b05bde1f1c0106a359b34a43a3795c6 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:07:38 +0900 Subject: [PATCH 06/15] CMake: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- cmake/config-ix.cmake | 1 + include/llvm/Config/config.h.cmake | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 4a87a23..68f52ca 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -126,6 +126,7 @@ check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) + check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index e017dd9..ec9c3d0 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -80,6 +80,10 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H} +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#cmakedefine HAVE_DECL_SETINFORMATIONJOBOBJECT ${HAVE_DECL_SETINFORMATIONJOBOBJECT} + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} -- 1.7.1.GIT -------------- next part -------------- From 09c38b3b6cce54d0afdbe8db6e4fdb48dc0e303a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 12:59:30 +0900 Subject: [PATCH 07/15] Windows/Program.inc: Declare SetInformationJobObject() if decls not found in Windows.h. --- lib/Support/Windows/Program.inc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index 0b92c78..9fcbc8d 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -22,7 +22,8 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// -#ifdef __MINGW32__ +#if defined(HAVE_DECL_SETINFORMATIONJOBOBJECT) +#if !HAVE_DECL_SETINFORMATIONJOBOBJECT // Ancient mingw32's w32api might not have this declaration. extern "C" BOOL WINAPI SetInformationJobObject(HANDLE hJob, @@ -30,6 +31,7 @@ BOOL WINAPI SetInformationJobObject(HANDLE hJob, LPVOID lpJobObjectInfo, DWORD cbJobObjectInfoLength); #endif +#endif namespace { struct Win32ProcessInfo { -- 1.7.1.GIT -------------- next part -------------- From 3d56ccd8fd75869aebd0413f220b18747c3f2325 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:12:15 +0900 Subject: [PATCH 08/15] Autoconf may check symbols in libgcc.a for JIT on Mingw. --- autoconf/configure.ac | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index cc39ee4..225d0f6 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1398,6 +1398,28 @@ AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check symbols in libgcc.a for JIT on Mingw. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) + AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) + AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) + AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) + + AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) + AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) + AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) + AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) + AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) + AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) + AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) + AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) + AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) + AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) + + AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) + AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) +fi + dnl Check for variations in the Standard C++ library and STL. These macros are dnl provided by LLVM in the autoconf/m4 directory. AC_FUNC_ISNAN -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0009-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz Type: application/x-gzip Size: 2627 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/0ff31aeb/attachment-0004.gz -------------- next part -------------- From 33ebabb9345eb70761513af5cd3d0f5b2edfdd65 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 17:56:13 +0900 Subject: [PATCH 10/15] CMake may check symbols in libgcc.a for JIT on Mingw. --- cmake/config-ix.cmake | 20 +++++++++++++++ include/llvm/Config/config.h.cmake | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 68f52ca..7a4bc4b 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -127,6 +127,26 @@ check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) + + check_function_exists(_alloca HAVE__ALLOCA) + check_function_exists(__alloca HAVE___ALLOCA) + check_function_exists(__chkstk HAVE___CHKSTK) + check_function_exists(___chkstk HAVE____CHKSTK) + + check_function_exists(__ashldi3 HAVE___ASHLDI3) + check_function_exists(__ashrdi3 HAVE___ASHRDI3) + check_function_exists(__divdi3 HAVE___DIVDI3) + check_function_exists(__fixdfdi HAVE___FIXDFDI) + check_function_exists(__fixsfdi HAVE___FIXSFDI) + check_function_exists(__floatdidf HAVE___FLOATDIDF) + check_function_exists(__lshrdi3 HAVE___LSHRDI3) + check_function_exists(__moddi3 HAVE___MODDI3) + check_function_exists(__udivdi3 HAVE___UDIVDI3) + check_function_exists(__umoddi3 HAVE___UMODDI3) + + check_function_exists(__main HAVE___MAIN) + check_function_exists(__cmpdi2 HAVE___CMPDI2) + endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index ec9c3d0..af96713 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -470,9 +470,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} + +/* Have host's __alloca */ +#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} + +/* Have host's __ashldi3 */ +#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} + +/* Have host's __ashrdi3 */ +#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} + +/* Have host's __chkstk */ +#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} + +/* Have host's __cmpdi2 */ +#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} + +/* Have host's __divdi3 */ +#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} + +/* Have host's __fixsfdi */ +#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} + +/* Have host's __floatdidf */ +#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} + +/* Have host's __lshrdi3 */ +#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} + +/* Have host's __main */ +#cmakedefine HAVE___MAIN ${HAVE___MAIN} + +/* Have host's __moddi3 */ +#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} + +/* Have host's __udivdi3 */ +#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} + +/* Have host's __umoddi3 */ +#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} + +/* Have host's ___chkstk */ +#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION -- 1.7.1.GIT -------------- next part -------------- From 57913b045463a1f0e831bd03868bd4bd5378b517 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 11:27:12 +0900 Subject: [PATCH 11/15] Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc. --- lib/Support/Windows/DynamicLibrary.inc | 77 +++++++----------------------- lib/Support/Windows/explicit_symbols.inc | 66 +++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 lib/Support/Windows/explicit_symbols.inc diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5e10f77..2c14366 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -120,35 +120,14 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *filename, // Stack probing routines are in the support library (e.g. libgcc), but we don't // have dynamic linking on windows. Provide a hook. -#if defined(__MINGW32__) || defined (_MSC_VER) - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return (void*)&SYM - #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ - if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO - #define EXPLICIT_SYMBOL_DEF(SYM) \ - extern "C" { extern void *SYM; } - - #if defined(__MINGW32__) - EXPLICIT_SYMBOL_DEF(_alloca) - EXPLICIT_SYMBOL_DEF(__main) - EXPLICIT_SYMBOL_DEF(__ashldi3) - EXPLICIT_SYMBOL_DEF(__ashrdi3) - EXPLICIT_SYMBOL_DEF(__cmpdi2) - EXPLICIT_SYMBOL_DEF(__divdi3) - EXPLICIT_SYMBOL_DEF(__fixdfdi) - EXPLICIT_SYMBOL_DEF(__fixsfdi) - EXPLICIT_SYMBOL_DEF(__fixunsdfdi) - EXPLICIT_SYMBOL_DEF(__fixunssfdi) - EXPLICIT_SYMBOL_DEF(__floatdidf) - EXPLICIT_SYMBOL_DEF(__floatdisf) - EXPLICIT_SYMBOL_DEF(__lshrdi3) - EXPLICIT_SYMBOL_DEF(__moddi3) - EXPLICIT_SYMBOL_DEF(__udivdi3) - EXPLICIT_SYMBOL_DEF(__umoddi3) - #elif defined(_MSC_VER) - EXPLICIT_SYMBOL_DEF(_alloca_probe) - #endif -#endif +#define EXPLICIT_SYMBOL(SYM) \ + extern "C" { extern void *SYM; } +#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) EXPLICIT_SYMBOL(SYMTO) + +#include "explicit_symbols.inc" + +#undef EXPLICIT_SYMBOL +#undef EXPLICIT_SYMBOL2 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). @@ -169,39 +148,17 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { } } -#if defined(__MINGW32__) - { - EXPLICIT_SYMBOL(_alloca); - EXPLICIT_SYMBOL(__main); - EXPLICIT_SYMBOL(__ashldi3); - EXPLICIT_SYMBOL(__ashrdi3); - EXPLICIT_SYMBOL(__cmpdi2); - EXPLICIT_SYMBOL(__divdi3); - EXPLICIT_SYMBOL(__fixdfdi); - EXPLICIT_SYMBOL(__fixsfdi); - EXPLICIT_SYMBOL(__fixunsdfdi); - EXPLICIT_SYMBOL(__fixunssfdi); - EXPLICIT_SYMBOL(__floatdidf); - EXPLICIT_SYMBOL(__floatdisf); - EXPLICIT_SYMBOL(__lshrdi3); - EXPLICIT_SYMBOL(__moddi3); - EXPLICIT_SYMBOL(__udivdi3); - EXPLICIT_SYMBOL(__umoddi3); - - EXPLICIT_SYMBOL2(alloca, _alloca); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF - } -#elif defined(_MSC_VER) + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return (void*)&SYM; + #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ + if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO; + { - EXPLICIT_SYMBOL2(alloca, _alloca_probe); - EXPLICIT_SYMBOL2(_alloca, _alloca_probe); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF + #include "explicit_symbols.inc" } -#endif + + #undef EXPLICIT_SYMBOL + #undef EXPLICIT_SYMBOL2 return 0; } diff --git a/lib/Support/Windows/explicit_symbols.inc b/lib/Support/Windows/explicit_symbols.inc new file mode 100644 index 0000000..84862d6 --- /dev/null +++ b/lib/Support/Windows/explicit_symbols.inc @@ -0,0 +1,66 @@ +/* in libgcc.a */ + +#ifdef HAVE__ALLOCA + EXPLICIT_SYMBOL(_alloca) + EXPLICIT_SYMBOL2(alloca, _alloca); +#endif +#ifdef HAVE___ALLOCA + EXPLICIT_SYMBOL(__alloca) +#endif +#ifdef HAVE___CHKSTK + EXPLICIT_SYMBOL(__chkstk) +#endif +#ifdef HAVE____CHKSTK + EXPLICIT_SYMBOL(___chkstk) +#endif +#ifdef HAVE___MAIN + EXPLICIT_SYMBOL(__main) // FIXME: Don't call it. +#endif + +#ifdef HAVE___ASHLDI3 + EXPLICIT_SYMBOL(__ashldi3) +#endif +#ifdef HAVE___ASHRDI3 + EXPLICIT_SYMBOL(__ashrdi3) +#endif +#ifdef HAVE___CMPDI2 // FIXME: unused + EXPLICIT_SYMBOL(__cmpdi2) +#endif +#ifdef HAVE___DIVDI3 + EXPLICIT_SYMBOL(__divdi3) +#endif +#ifdef HAVE___FIXDFDI + EXPLICIT_SYMBOL(__fixdfdi) +#endif +#ifdef HAVE___FIXSFDI + EXPLICIT_SYMBOL(__fixsfdi) +#endif +#ifdef HAVE___FIXUNSDFDI + EXPLICIT_SYMBOL(__fixunsdfdi) +#endif +#ifdef HAVE___FIXUNSSFDI + EXPLICIT_SYMBOL(__fixunssfdi) +#endif +#ifdef HAVE___FLOATDIDF + EXPLICIT_SYMBOL(__floatdidf) +#endif +#ifdef HAVE___FLOATDISF + EXPLICIT_SYMBOL(__floatdisf) +#endif +#ifdef HAVE___LSHRDI3 + EXPLICIT_SYMBOL(__lshrdi3) +#endif +#ifdef HAVE___MODDI3 + EXPLICIT_SYMBOL(__moddi3) +#endif +#ifdef HAVE___UDIVDI3 + EXPLICIT_SYMBOL(__udivdi3) +#endif +#ifdef HAVE___UMODDI3 + EXPLICIT_SYMBOL(__umoddi3) +#endif + +/* msvcrt */ +#if defined(_MSC_VER) + EXPLICIT_SYMBOL2(alloca, _alloca_probe); +#endif -- 1.7.1.GIT -------------- next part -------------- From c38b409680ac55e7ecd3152ed786dee7f681a299 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 18 Jan 2011 15:30:58 +0900 Subject: [PATCH 12/15] autoconf: Seek strerror_s() with AC_CHECK_DECLS. AC_CHECK_FUNCS seeks a symbol only in libs. We should check decl in string.h. With recent Mingw, *_s() stuff would be enabled by MINGW_HAS_SECURE_API. --- autoconf/configure.ac | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 225d0f6..72eae40 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1392,12 +1392,15 @@ AC_CHECK_FUNCS([powf fmodf strtof round ]) AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) -AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ]) +AC_CHECK_FUNCS([strerror strerror_r setenv ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check the declaration of strerror_s(). It is not provided by default on Mingw. +AC_CHECK_DECLS([strerror_s]) + dnl Check symbols in libgcc.a for JIT on Mingw. if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0013-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz Type: application/x-gzip Size: 1464 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/0ff31aeb/attachment-0005.gz From jay.foad at gmail.com Mon Jan 31 09:24:53 2011 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 31 Jan 2011 15:24:53 +0000 Subject: [llvm-commits] [PATCH] fix a FIXME in SwitchInst::removeCase() Message-ID: SwitchInst::removeCase() has this comment: // Move everything after this operand down. // // FIXME: we could just swap with the end of the list, then erase. However, // client might not expect this to happen. The code as it is thrashes the // use/def lists, which is kinda lame. I've looked at all calls to removeCase() in the LLVM tree, and I don't think any of them will care if the cases get reordered. So the attached patch implements the more efficient approach described in the comment, and removes the FIXME. Tested with "make check". OK to commit? Thanks, Jay. -------------- next part -------------- A non-text attachment was scrubbed... Name: removecase Type: application/octet-stream Size: 853 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/4a198c0a/attachment.obj From jan_sjodin at yahoo.com Mon Jan 31 09:32:55 2011 From: jan_sjodin at yahoo.com (Jan Sjodin) Date: Mon, 31 Jan 2011 07:32:55 -0800 (PST) Subject: [llvm-commits] JunkJIT (was MCJIT) Message-ID: <771061.25964.qm@web55608.mail.re4.yahoo.com> Ping. If this is something that you do not want, and you only want "real" MCJIT contributions, let me know. - Jan ----- Original Message ---- > From: Jan Sjodin > To: Daniel Dunbar > Cc: llvm-commits at cs.uiuc.edu > Sent: Thu, January 20, 2011 5:21:53 PM > Subject: JunkJIT (was MCJIT) > > This is the updated patch for the old MCJIT proposal. I changed MCJIT->JunkJIT > > and made the tests work again. I was thinking it might at least be useful to > replace the old JIT until the real MCJIT is in place. > > - Jan > From ofv at wanadoo.es Mon Jan 31 10:47:29 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Mon, 31 Jan 2011 17:47:29 +0100 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: (NAKAMURA Takumi's message of "Mon, 31 Jan 2011 21:18:18 +0900") References: Message-ID: <87zkqhggv2.fsf@wanadoo.es> Hello Takumi. NAKAMURA Takumi writes: [snip] Any changes to cmake's platform tests and to config.h.cmake file should be mirrored to the autoconf tests and config.h.in. The goal is that at some point into the future to generate identical config.h files by cmake and autoconf, which will simplify maintenance. > +/* Define to 1 if you have the declaration of `SetInformationJobObject', and > + to 0 if you don't. */ The above should read: /* Define to 1 if you have the declaration of `SetInformationJobObject'. */ Same for other macros you introduced into config.h.cmake. From bob.wilson at apple.com Mon Jan 31 11:10:45 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 31 Jan 2011 09:10:45 -0800 Subject: [llvm-commits] [llvm] r124570 - in /llvm/trunk/lib/Target/ARM: ARMConstantIslandPass.cpp ARMMachineFunctionInfo.h In-Reply-To: <20110130220739.6395C2A6C12D@llvm.org> References: <20110130220739.6395C2A6C12D@llvm.org> Message-ID: On Jan 30, 2011, at 2:07 PM, Anton Korobeynikov wrote: > Author: asl > Date: Sun Jan 30 16:07:39 2011 > New Revision: 124570 > > URL: http://llvm.org/viewvc/llvm-project?rev=124570&view=rev > Log: > Save a mapping between original and cloned constpool entries. What is this used for? From 6yearold at gmail.com Mon Jan 31 11:30:45 2011 From: 6yearold at gmail.com (arrowdodger) Date: Mon, 31 Jan 2011 20:30:45 +0300 Subject: [llvm-commits] [PATCH][CMake] More platform checks. Message-ID: Attached patch adds some platform checks to cmake/config-ix.cmake and fixes checking for dlopen/dlerror. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/1277ecf3/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cmake.patch Type: text/x-patch Size: 5565 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/1277ecf3/attachment.bin From asl at math.spbu.ru Mon Jan 31 11:31:51 2011 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 31 Jan 2011 20:31:51 +0300 Subject: [llvm-commits] [llvm] r124570 - in /llvm/trunk/lib/Target/ARM: ARMConstantIslandPass.cpp ARMMachineFunctionInfo.h In-Reply-To: References: <20110130220739.6395C2A6C12D@llvm.org> Message-ID: > What is this used for? It will be used inside arm ehabi unwinding information emission (I'm preparing the set of patches for review) Just to clarify the situation: right now constant island pass produces invalid MIs, because it encodes the information about the clones into invalid constpool indices and there is no way having such an index go to the original constpool entry (e.g. to derive size / alignment, etc.), the actual "connection" is done later at MC emission time via constpoll_entry instruction and magic label names, -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From richard at xmos.com Mon Jan 31 11:41:44 2011 From: richard at xmos.com (Richard Osborne) Date: Mon, 31 Jan 2011 17:41:44 -0000 Subject: [llvm-commits] [llvm] r124587 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll Message-ID: <20110131174144.D0AF82A6C12C@llvm.org> Author: friedgold Date: Mon Jan 31 11:41:44 2011 New Revision: 124587 URL: http://llvm.org/viewvc/llvm-project?rev=124587&view=rev Log: Fix bug where ReduceLoadWidth was creating illegal ZEXTLOAD instructions. Added: llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=124587&r1=124586&r2=124587&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jan 31 11:41:44 2011 @@ -4244,8 +4244,6 @@ if (Opc == ISD::SIGN_EXTEND_INREG) { ExtType = ISD::SEXTLOAD; ExtVT = cast(N->getOperand(1))->getVT(); - if (LegalOperations && !TLI.isLoadExtLegal(ISD::SEXTLOAD, ExtVT)) - return SDValue(); } else if (Opc == ISD::SRL) { // Another special-case: SRL is basically zero-extending a narrower value. ExtType = ISD::ZEXTLOAD; @@ -4255,6 +4253,8 @@ ExtVT = EVT::getIntegerVT(*DAG.getContext(), VT.getSizeInBits() - N01->getZExtValue()); } + if (LegalOperations && !TLI.isLoadExtLegal(ExtType, ExtVT)) + return SDValue(); unsigned EVTBits = ExtVT.getSizeInBits(); Added: llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll?rev=124587&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll (added) +++ llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll Mon Jan 31 11:41:44 2011 @@ -0,0 +1,10 @@ +; RUN: llc < %s -march=xcore +%struct.st = type <{ i8, i32, i8, i32, i8, i32 }> + + at x = external global %struct.st, align 4 + +define i32 @test_entry() nounwind { +entry: + %0 = load i32* getelementptr inbounds (%struct.st* @x, i32 0, i32 3), align 2 + ret i32 %0 +} From ofv at wanadoo.es Mon Jan 31 12:25:26 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 31 Jan 2011 18:25:26 -0000 Subject: [llvm-commits] [llvm] r124590 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake Message-ID: <20110131182526.0E90B2A6C12C@llvm.org> Author: ofv Date: Mon Jan 31 12:25:25 2011 New Revision: 124590 URL: http://llvm.org/viewvc/llvm-project?rev=124590&view=rev Log: Adds some platform checks to cmake/config-ix.cmake and fixes checking for dlopen/dlerror. Patch by arrowdodger! Modified: llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/Config/config.h.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=124590&r1=124589&r2=124590&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Mon Jan 31 12:25:25 2011 @@ -89,6 +89,7 @@ check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) check_function_exists(isatty HAVE_ISATTY) +check_symbol_exists(index strings.h HAVE_INDEX) check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH) check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H) check_symbol_exists(finite ieeefp.h HAVE_FINITE_IN_IEEEFP_H) @@ -97,6 +98,12 @@ check_symbol_exists(ceilf math.h HAVE_CEILF) check_symbol_exists(floorf math.h HAVE_FLOORF) check_symbol_exists(fmodf math.h HAVE_FMODF) +if( HAVE_SETJMP_H ) + check_symbol_exists(longjmp setjmp.h HAVE_LONGJMP) + check_symbol_exists(setjmp setjmp.h HAVE_SETJMP) + check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP) + check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) +endif() check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h @@ -106,9 +113,11 @@ check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP) check_symbol_exists(closedir "sys/types.h;dirent.h" HAVE_CLOSEDIR) check_symbol_exists(opendir "sys/types.h;dirent.h" HAVE_OPENDIR) +check_symbol_exists(readdir "sys/types.h;dirent.h" HAVE_READDIR) check_symbol_exists(getcwd unistd.h HAVE_GETCWD) check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) check_symbol_exists(getrlimit "sys/types.h;sys/time.h;sys/resource.h" HAVE_GETRLIMIT) +check_symbol_exists(rindex strings.h HAVE_RINDEX) check_symbol_exists(strchr string.h HAVE_STRCHR) check_symbol_exists(strcmp string.h HAVE_STRCMP) check_symbol_exists(strdup string.h HAVE_STRDUP) @@ -117,7 +126,18 @@ check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) endif() check_symbol_exists(sbrk unistd.h HAVE_SBRK) +check_symbol_exists(srand48 stdlib.h HAVE_RAND48_SRAND48) +if( HAVE_RAND48_SRAND48 ) + check_symbol_exists(lrand48 stdlib.h HAVE_RAND48_LRAND48) + if( HAVE_RAND48_LRAND48 ) + check_symbol_exists(drand48 stdlib.h HAVE_RAND48_DRAND48) + if( HAVE_RAND48_DRAND48 ) + set(HAVE_RAND48 1 CACHE INTERNAL "are srand48/lrand48/drand48 available?") + endif() + endif() +endif() check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) +check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ) check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) @@ -134,11 +154,15 @@ check_symbol_exists(argz_next argz.h HAVE_ARGZ_NEXT) check_symbol_exists(argz_stringify argz.h HAVE_ARGZ_STRINGIFY) endif() -if( HAVE_DLFCN_H AND HAVE_LIBDL ) - list(APPEND CMAKE_REQUIRED_LIBRARIES dl) +if( HAVE_DLFCN_H ) + if( HAVE_LIBDL ) + list(APPEND CMAKE_REQUIRED_LIBRARIES dl) + endif() check_symbol_exists(dlerror dlfcn.h HAVE_DLERROR) check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) + if( HAVE_LIBDL ) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl) + endif() endif() check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=124590&r1=124589&r2=124590&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Mon Jan 31 12:25:25 2011 @@ -169,7 +169,7 @@ #cmakedefine HAVE_GV ${HAVE_GV} /* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX +#cmakedefine HAVE_INDEX ${HAVE_INDEX} /* Define to 1 if the system has the type `int64_t'. */ #cmakedefine HAVE_INT64_T ${HAVE_INT64_T} @@ -224,7 +224,7 @@ #undef HAVE_LINK_R /* Define to 1 if you have the `longjmp' function. */ -#undef HAVE_LONGJMP +#cmakedefine HAVE_LONGJMP ${HAVE_LONGJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} @@ -309,16 +309,16 @@ #cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT} /* Define to 1 if srand48/lrand48/drand48 exist in */ -#undef HAVE_RAND48 +#cmakedefine HAVE_RAND48 ${HAVE_RAND48} /* Define to 1 if you have the `readdir' function. */ -#undef HAVE_READDIR +#cmakedefine HAVE_READDIR ${HAVE_READDIR} /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define to 1 if you have the `rindex' function. */ -#undef HAVE_RINDEX +#cmakedefine HAVE_RINDEX ${HAVE_RINDEX} /* Define to 1 if you have the `rintf' function. */ #undef HAVE_RINTF @@ -336,7 +336,7 @@ #cmakedefine HAVE_SETENV ${HAVE_SETENV} /* Define to 1 if you have the `setjmp' function. */ -#undef HAVE_SETJMP +#cmakedefine HAVE_SETJMP ${HAVE_SETJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H} @@ -348,13 +348,13 @@ #undef HAVE_SHL_LOAD /* Define to 1 if you have the `siglongjmp' function. */ -#undef HAVE_SIGLONGJMP +#cmakedefine HAVE_SIGLONGJMP ${HAVE_SIGLONGJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} /* Define to 1 if you have the `sigsetjmp' function. */ -#undef HAVE_SIGSETJMP +#cmakedefine HAVE_SIGSETJMP ${HAVE_SIGSETJMP} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} @@ -405,7 +405,7 @@ #cmakedefine HAVE_STRTOLL ${HAVE_STRTOLL} /* Define to 1 if you have the `strtoq' function. */ -#undef HAVE_STRTOQ +#cmakedefine HAVE_STRTOQ ${HAVE_STRTOQ} /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF From ofv at wanadoo.es Mon Jan 31 12:30:16 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Mon, 31 Jan 2011 19:30:16 +0100 Subject: [llvm-commits] [PATCH][CMake] More platform checks. References: Message-ID: <87k4hlgc3r.fsf@wanadoo.es> arrowdodger <6yearold at gmail.com> writes: > +check_symbol_exists(srand48 stdlib.h HAVE_RAND48) > +if( HAVE_RAND48 ) > + check_symbol_exists(lrand48 stdlib.h HAVE_RAND48) > + if( HAVE_RAND48 ) > + check_symbol_exists(drand48 stdlib.h HAVE_RAND48) > + endif() > +endif() This is wrong. The first check_symbol_exists puts HAVE_RAND48 on the cache when it succeeds, so the following check_symbol_exists that also use HAVE_RAND48 as the variable are ignored. You can see that with cmake's output: -- Looking for srand48 -- Looking for srand48 - found -- Looking for strtoq Note how there is check for lrand48 nor for drand48. Committed with a correction for the above issue. Thanks! From gkistanova at gmail.com Mon Jan 31 14:11:50 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Mon, 31 Jan 2011 20:11:50 -0000 Subject: [llvm-commits] [zorg] r124597 - in /zorg/trunk/buildbot/osuosl/master/config: builders.py slaves.py Message-ID: <20110131201150.31CA62A6C12C@llvm.org> Author: gkistanova Date: Mon Jan 31 14:11:49 2011 New Revision: 124597 URL: http://llvm.org/viewvc/llvm-project?rev=124597&view=rev Log: Added new buildbot builder for 3-stage automated build on x86_64-apple-darwin10 of LLVM mingw32 cross-toolchain for arm-eabi hardfloat. Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py zorg/trunk/buildbot/osuosl/master/config/slaves.py Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=124597&r1=124596&r2=124597&view=diff ============================================================================== --- zorg/trunk/buildbot/osuosl/master/config/builders.py (original) +++ zorg/trunk/buildbot/osuosl/master/config/builders.py Mon Jan 31 14:11:49 2011 @@ -447,6 +447,89 @@ 'description' : 'install llvm-gcc', 'haltOnFailure' : True },]), 'category' : 'llvm-gcc' }, + + {'name' : "llvm-gcc-build-x86_64-darwin10-x-mingw32-x-armeabi", + 'slavenames': [ "kistanova1" ], + 'builddir' : "llvm-gcc-build-x86_64-darwin10-x-mingw32-x-armeabi", + 'factory' : ScriptedBuilder.getScriptedBuildFactory( + source_code = [SVN(name='svn-llvm', + mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', + defaultBranch='trunk', + workdir="llvm.src"), + SVN(name='svn-llvm-gcc', + mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm-gcc-4.2/', + defaultBranch='trunk', + workdir="llvm-gcc.src"),], + launcher = 'llvm-gcc.src/extras/buildbot-launcher', + build_script = 'llvm-gcc.src/extras/build-darwin-x-mingw32-x-armeabi', + extra_args = [], + build_steps = [{'name' : 'clean', + 'description' : 'clean', + 'haltOnFailure' : True }, + {'name' : 'copy_cross_tools', + 'description' : 'copy cross_tools', + 'haltOnFailure' : True }, + {'name' : 'configure_llvm_1', + 'description' : 'configure llvm (stage 1)', + 'haltOnFailure' : True }, + {'name' : 'make_llvm_1', + 'description' : 'make llvm (stage 1)', + 'extra_args' : ['-j8'], # Extra step-specific properties + 'haltOnFailure' : True }, + {'name' : 'test_llvm_1', + 'description' : 'test llvm (stage 1)', + 'haltOnFailure' : False }, + {'name' : 'configure_llvmgcc_1', + 'description' : 'configure llvm-gcc (stage 1)', + 'haltOnFailure' : True }, + {'name' : 'make_llvmgcc_1', + 'description' : 'make llvm-gcc (stage 1)', # Note: one thread only here + 'haltOnFailure' : True }, + {'name' : 'install_llvmgcc_1', + 'description' : 'install llvm-gcc (stage 1)', + 'haltOnFailure' : True }, + {'name' : 'configure_llvm_2', + 'description' : 'configure llvm (stage 2)', + 'haltOnFailure' : True }, + {'name' : 'make_llvm_2', + 'description' : 'make llvm (stage 2)', + 'extra_args' : ['-j8'], + 'haltOnFailure' : True }, + {'name' : 'test_llvm_2', + 'description' : 'test llvm (stage 2)', + 'haltOnFailure' : False }, + {'name' : 'configure_llvmgcc_2', + 'description' : 'configure llvm-gcc (stage 2)', + 'haltOnFailure' : True }, + {'name' : 'make_llvmgcc_2', + 'description' : 'make llvm-gcc (stage 2)', + 'extra_args' : ['-j8'], + 'haltOnFailure' : True }, + {'name' : 'install_llvmgcc_2', + 'description' : 'install llvm-gcc (stage 2)', + 'haltOnFailure' : True }, + {'name' : 'configure_llvm_3', + 'description' : 'configure llvm (stage 3)', + 'haltOnFailure' : True }, + {'name' : 'make_llvm_3', + 'description' : 'make llvm (stage 3)', + 'extra_args' : ['-j8'], + 'haltOnFailure' : True }, + {'name' : 'install_llvm_3', + 'description' : 'install llvm (stage 3)', + 'haltOnFailure' : False }, + {'name' : 'configure_llvmgcc_3', + 'description' : 'configure llvm-gcc (stage 3)', + 'haltOnFailure' : True }, + {'name' : 'make_llvmgcc_3', + 'description' : 'make llvm-gcc (stage 3)', + 'extra_args' : ['-j8'], + 'haltOnFailure' : True }, + {'name' : 'install_llvmgcc_3', + 'description' : 'install llvm-gcc (stage 3)', + 'haltOnFailure' : True },]), + + 'category' : 'llvm-gcc' }, {'name' : "llvm-gcc-native-mingw32", 'slavenames': [ "kistanova2" ], Modified: zorg/trunk/buildbot/osuosl/master/config/slaves.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/slaves.py?rev=124597&r1=124596&r2=124597&view=diff ============================================================================== --- zorg/trunk/buildbot/osuosl/master/config/slaves.py (original) +++ zorg/trunk/buildbot/osuosl/master/config/slaves.py Mon Jan 31 14:11:49 2011 @@ -43,7 +43,7 @@ create_slave("ranby1"), # Quad Core Mac Pro running Leopard. - create_slave("kistanova1", properties={'jobs' : 1}, max_builds=3), + create_slave("kistanova1", properties={'jobs' : 1}, max_builds=4), # Win XP SP3. create_slave("kistanova2", properties={'jobs' : 1}, max_builds=1), From sabre at nondot.org Mon Jan 31 14:23:28 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 31 Jan 2011 20:23:28 -0000 Subject: [llvm-commits] [llvm] r124599 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110131202328.7096A2A6C12C@llvm.org> Author: lattner Date: Mon Jan 31 14:23:28 2011 New Revision: 124599 URL: http://llvm.org/viewvc/llvm-project?rev=124599&view=rev Log: add a note, progress unblocked by PR8575 being fixed. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=124599&r1=124598&r2=124599&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Jan 31 14:23:28 2011 @@ -2274,3 +2274,51 @@ avoids partial register stalls in some important cases. //===---------------------------------------------------------------------===// + +With PR8575 we're now generating better code for: + +static _Bool foo(int x) { return x == 1; } +static _Bool bar(int x) { return x == 2; } +static _Bool baz(int x) { return x == 3; } + +_Bool quux(int x) { + return foo(x) || bar(x) || baz(x); +} + +$ clang t.c -S -o - -O3 -mkernel -fomit-frame-pointer +_quux: ## @quux +## BB#0: ## %entry + decl %edi + cmpl $3, %edi + movb $1, %al + jb LBB0_2 +## BB#1: ## %lor.rhs + xorb %al, %al +LBB0_2: ## %lor.end + movzbl %al, %eax + andl $1, %eax + ret + +But this should use a "setcc" instead of materializing a 0/1 value +the hard way. This looks like #1: simplifycfg should transform the +switch into a sub+icmp+branch, and an instcombine hack to replace +the PHI with a zext of the branch condition. Here's the IR today: + +define zeroext i1 @quux(i32 %x) nounwind readnone ssp noredzone { +entry: + switch i32 %x, label %lor.rhs [ + i32 1, label %lor.end + i32 2, label %lor.end + i32 3, label %lor.end + ] + +lor.rhs: ; preds = %entry + br label %lor.end + +lor.end: ; preds = %lor.rhs, %entry, %entry, %entry + %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ] + ret i1 %0 +} + +//===---------------------------------------------------------------------===// + From greened at obbligato.org Mon Jan 31 14:39:01 2011 From: greened at obbligato.org (David Greene) Date: Mon, 31 Jan 2011 20:39:01 -0000 Subject: [llvm-commits] [llvm] r124601 - /llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Message-ID: <20110131203901.B49BC2A6C12C@llvm.org> Author: greened Date: Mon Jan 31 14:39:01 2011 New Revision: 124601 URL: http://llvm.org/viewvc/llvm-project?rev=124601&view=rev Log: Fix vector sign extend to put the source and destination types in the correct places. Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td?rev=124601&r1=124600&r2=124601&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Mon Jan 31 14:39:01 2011 @@ -1167,10 +1167,10 @@ [(set rclass:$rDest, (sext R16C:$rSrc))]>; multiclass ExtendHalfwordWord { - def v4i32: XSHWVecInst; - + def v4i32: XSHWVecInst; + def r16: XSHWRegInst; - + def r32: XSHWInRegInst; def r64: XSHWInRegInst; From rdivacky at freebsd.org Mon Jan 31 14:56:49 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 31 Jan 2011 20:56:49 -0000 Subject: [llvm-commits] [llvm] r124603 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp Message-ID: <20110131205649.E6B0B2A6C12C@llvm.org> Author: rdivacky Date: Mon Jan 31 14:56:49 2011 New Revision: 124603 URL: http://llvm.org/viewvc/llvm-project?rev=124603&view=rev Log: Error on all .code* directives instead of just .code16 as they all lead to a silent miscompilation of code. Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=124603&r1=124602&r2=124603&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Jan 31 14:56:49 2011 @@ -1065,8 +1065,8 @@ if (IDVal == ".include") return ParseDirectiveInclude(); - if (IDVal == ".code16") - return TokError(".code16 not supported yet"); + if (IDVal.startswith(".code")) + return TokError(Twine(IDVal) + " not supported yet"); // Look up the handler in the handler table. std::pair Handler = From dpatel at apple.com Mon Jan 31 15:15:39 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:15:39 -0000 Subject: [llvm-commits] [llvm] r124604 - /llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Message-ID: <20110131211539.E767E2A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:15:39 2011 New Revision: 124604 URL: http://llvm.org/viewvc/llvm-project?rev=124604&view=rev Log: Focus on arguments for now. Modified: llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Modified: llvm/trunk/utils/CollectDebugInfoUsingLLDB.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/CollectDebugInfoUsingLLDB.py?rev=124604&r1=124603&r2=124604&view=diff ============================================================================== --- llvm/trunk/utils/CollectDebugInfoUsingLLDB.py (original) +++ llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Mon Jan 31 15:15:39 2011 @@ -172,8 +172,8 @@ line = frame.GetLineEntry().GetLine() vars = frame.GetVariables(1,0,0,0) print_vars ("#Argument ", vars, fname, line, file, frame, target, thread) - vars = frame.GetVariables(0,1,0,0) - print_vars ("#Variables ", vars, fname, line, file, frame, target, thread) + # vars = frame.GetVariables(0,1,0,0) + # print_vars ("#Variables ", vars, fname, line, file, frame, target, thread) process.Continue() file.close() From dpatel at apple.com Mon Jan 31 15:16:37 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:16:37 -0000 Subject: [llvm-commits] [llvm] r124605 - /llvm/trunk/utils/CompareDebugInfo.py Message-ID: <20110131211637.B30BA2A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:16:37 2011 New Revision: 124605 URL: http://llvm.org/viewvc/llvm-project?rev=124605&view=rev Log: Tidy up. Modified: llvm/trunk/utils/CompareDebugInfo.py Modified: llvm/trunk/utils/CompareDebugInfo.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/CompareDebugInfo.py?rev=124605&r1=124604&r2=124605&view=diff ============================================================================== --- llvm/trunk/utils/CompareDebugInfo.py (original) +++ llvm/trunk/utils/CompareDebugInfo.py Mon Jan 31 15:16:37 2011 @@ -3,18 +3,47 @@ import os import sys +DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.out" +OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.opt.out" +LOG_FILE="Output/" + sys.argv[1] + ".log" +NATIVE_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.out" +NATIVE_OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.opt.out" +NATIVE_LOG_FILE="Output/" + sys.argv[1] + ".native.log" +REPORT_FILE="Output/" + sys.argv[1] + ".dbg.report.html" + class BreakPoint: def __init__(self, bp_name): self.name = bp_name self.values = {} - self.var_values = {} + self.missing_args = [] + self.matching_args = [] + self.notmatching_args = [] + self.missing_bp = False + + def setMissing(self): + self.missing_bp = True + + def getArgCount(self): + return len(self.values) + + def getMissingArgCount(self): + if self.missing_bp == True: + return len(self.values) + return len(self.missing_args) + + def getMatchingArgCount(self): + if self.missing_bp == True: + return 0 + return len(self.matching_args) + + def getNotMatchingArgCount(self): + if self.missing_bp == True: + return 0 + return len(self.notmatching_args) def recordArgument(self, arg_name, value): self.values[arg_name] = value - def recordVariable(self, var_name, var_value): - self.var_values[var_name] = var_value - def __repr__(self): print self.name items = self.values.items() @@ -22,64 +51,132 @@ print items[i][0]," = ",items[i][1] return '' - def compare_args(self, other): - return cmp(self.values, other.values) - - def compare_vars(self, other): - return cmp(self.var_values, other.var_values) - - def __cmp__(self, other): - return cmp(self.values, other.values) + def compare_args(self, other, file): + myitems = self.values.items() + otheritems = other.values.items() + match = False + for i in range(len(myitems)): + if i >= len(otheritems): + match = True + self.missing_args.append(myitems[i][0]) + elif cmp(myitems[i][1], otheritems[i][1]): + match = True + self.notmatching_args.append(myitems[i][0]) + else: + self.matching_args.append(myitems[i][0]) + + self.print_list(self.matching_args, " Matching arguments ", file) + self.print_list(self.notmatching_args, " Not Matching arguments ", file) + self.print_list(self.missing_args, " Missing arguments ", file) + return match + + def print_list(self, items, txt, pfile): + if len(items) == 0: + return + pfile.write(self.name) + pfile.write(txt) + for e in items: + pfile.write(e) + pfile.write(' ') + pfile.write('\n') def read_input(filename, dict): f = open(filename, "r") lines = f.readlines() for l in range(len(lines)): c = lines[l].split() - if c[0] == "#Argument": + if c[0] == "#Breakpoint": bp = dict.get(c[2]) if bp is None: bp = BreakPoint(c[1]) dict[c[2]] = bp - bp.recordArgument(c[3], c[4]) - - if c[0] == "#Variables": + if c[0] == "#Argument": bp = dict.get(c[2]) if bp is None: bp = BreakPoint(c[1]) dict[c[2]] = bp - bp.recordVariable(c[3], c[4]) - - f.close() + bp.recordArgument(c[3], c[4]) return f1_breakpoints = {} -read_input(sys.argv[1], f1_breakpoints) +read_input(DBG_OUTPUT_FILE, f1_breakpoints) f1_items = f1_breakpoints.items() f2_breakpoints = {} -read_input(sys.argv[2], f2_breakpoints) +read_input(OPT_DBG_OUTPUT_FILE, f2_breakpoints) f2_items = f2_breakpoints.items() -arg_mismatch = 0 -var_mismatch = 0 +f = open(LOG_FILE, "w") +f.write("Log output\n") for f2bp in range(len(f2_items)): id = f2_items[f2bp][0] bp = f2_items[f2bp][1] bp1 = f1_breakpoints.get(id) if bp1 is None: - print "bp is missing" + bp.setMissing() else: - if bp1.compare_args(bp): - arg_mismatch = arg_mismatch + 1 - if bp1.compare_vars(bp): - var_mismatch = var_mismatch + 1 - -l2 = len(f2_items) -print "==========" -if l2 != 0: - print sys.argv[3]," Argument success rate is", (l2-arg_mismatch)*100/l2,"%" - print sys.argv[3]," Variable success rate is", (l2-var_mismatch)*100/l2,"%" -else: - print sys.argv[3]," success rate is 100%" -print "==========" + bp1.compare_args(bp,f) +f.close() + +nf1_breakpoints = {} +read_input(NATIVE_DBG_OUTPUT_FILE, nf1_breakpoints) +nf1_items = nf1_breakpoints.items() + +nf2_breakpoints = {} +read_input(NATIVE_OPT_DBG_OUTPUT_FILE, nf2_breakpoints) +nf2_items = nf2_breakpoints.items() + +nfl = open(NATIVE_LOG_FILE, "w") +for nf2bp in range(len(nf2_items)): + id = nf2_items[nf2bp][0] + bp = nf2_items[nf2bp][1] + bp1 = nf1_breakpoints.get(id) + if bp1 is None: + bp.setMissing() + else: + bp1.compare_args(bp,nfl) +nfl.close() + +f1_arg_count = 0 +f1_matching_arg_count = 0 +f1_notmatching_arg_count = 0 +f1_missing_arg_count = 0 +for idx in range(len(f1_items)): + bp = f1_items[idx][1] + f1_arg_count = f1_arg_count + bp.getArgCount() + f1_matching_arg_count = f1_matching_arg_count + bp.getMatchingArgCount() + f1_notmatching_arg_count = f1_notmatching_arg_count + bp.getNotMatchingArgCount() + f1_missing_arg_count = f1_missing_arg_count + bp.getMissingArgCount() + +nf1_arg_count = 0 +nf1_matching_arg_count = 0 +nf1_notmatching_arg_count = 0 +nf1_missing_arg_count = 0 +for idx in range(len(nf1_items)): + bp = nf1_items[idx][1] + nf1_arg_count = nf1_arg_count + bp.getArgCount() + nf1_matching_arg_count = nf1_matching_arg_count + bp.getMatchingArgCount() + nf1_notmatching_arg_count = nf1_notmatching_arg_count + bp.getNotMatchingArgCount() + nf1_missing_arg_count = nf1_missing_arg_count + bp.getMissingArgCount() + +rf = open(REPORT_FILE, "w") +rf.write("") +rf.write(str(sys.argv[1])) +rf.write("|") +rf.write(str(nf1_arg_count)) +rf.write("") +rf.write(str(nf1_matching_arg_count)) +rf.write("") +rf.write(str(nf1_notmatching_arg_count)) +rf.write("") +rf.write(str(nf1_missing_arg_count)) +rf.write("|") +rf.write(str(f1_arg_count)) +rf.write("") +rf.write(str(f1_matching_arg_count)) +rf.write("") +rf.write(str(f1_notmatching_arg_count)) +rf.write("") +rf.write(str(f1_missing_arg_count)) +rf.write("\n") +rf.close() From dpatel at apple.com Mon Jan 31 15:17:11 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:17:11 -0000 Subject: [llvm-commits] [test-suite] r124606 - /test-suite/trunk/Makefile.programs Message-ID: <20110131211711.66B7E2A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:17:11 2011 New Revision: 124606 URL: http://llvm.org/viewvc/llvm-project?rev=124606&view=rev Log: Add support to generate TEST=dbg report. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=124606&r1=124605&r2=124606&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Mon Jan 31 15:17:11 2011 @@ -990,6 +990,30 @@ report.dbgopt: report.dbgopt.header report.$(TEST).txtonly +report.dbg.html: $(REPORT_DEPENDENCIES) $(TestMakefile) + $(MAKE) $(FORCE_SERIAL_ARG) TEST=$(TEST) + @echo "

Quality of debug info in optimized builds at -O3

" > $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + @echo "" >> $@ + find . -name \*.$(TEST).report.html -exec cat {} \; >> $@ + @echo "
|GCC|LLVM
Name|Total
Arguments
Valid
Arguments
Missing
Arguments
Invalid
Arguments
|Total
Arguments
Valid
Arguments
Missing
Arguments
Invalid
Arguments
" >> $@ + endif clean:: From dpatel at apple.com Mon Jan 31 15:18:00 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:18:00 -0000 Subject: [llvm-commits] [test-suite] r124607 - /test-suite/trunk/TEST.dbg.Makefile Message-ID: <20110131211800.5F9282A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:18:00 2011 New Revision: 124607 URL: http://llvm.org/viewvc/llvm-project?rev=124607&view=rev Log: Adapt to updated CompareDebugInfo.py script. Skip few tests for now. Modified: test-suite/trunk/TEST.dbg.Makefile Modified: test-suite/trunk/TEST.dbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.dbg.Makefile?rev=124607&r1=124606&r2=124607&view=diff ============================================================================== --- test-suite/trunk/TEST.dbg.Makefile (original) +++ test-suite/trunk/TEST.dbg.Makefile Mon Jan 31 15:18:00 2011 @@ -36,11 +36,31 @@ $(LOPT) -print-breakpoints-for-testing $@.bc -o $@ $(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ -test.$(TEST).%: Output/%.bp Output/%.dbg Output/%.dbg.opt - echo $@ - echo $* - mv *.dSYM Output/. - $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.dbg Output/$*.bp Output/$*.dbg.out - $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.dbg.opt Output/$*.bp Output/$*.dbg.opt.out - $(LLVM_SRC_ROOT)/utils/CompareDebugInfo.py Output/$*.dbg.out Output/$*.dbg.opt.out $* +test.$(TEST).%: Output/%.bp Output/%.dbg Output/%.dbg.opt Output/%.native.dbg Output/%.native.dbg.opt + @-is_skip=0; \ + if test "$*" == "reversefile"; then \ + is_skip=1; \ + fi; \ + if test "$*" == "spellcheck"; then \ + is_skip=1; \ + fi; \ + if test "$*" == "sumcol"; then \ + is_skip=1; \ + fi; \ + if test "$*" == "wc"; then \ + is_skip=1; \ + fi; \ + if test "$*" == "wordfreq"; then \ + is_skip=1; \ + fi; \ + if test "$*" == "exptree"; then \ + is_skip=1; \ + fi; \ + if test $$is_skip == 0; then \ + $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.dbg Output/$*.bp Output/$*.dbg.out; \ + $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.dbg.opt Output/$*.bp Output/$*.dbg.opt.out; \ + $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.native.dbg Output/$*.bp Output/$*.native.dbg.out; \ + $(LLVM_SRC_ROOT)/utils/CollectDebugInfoUsingLLDB.py Output/$*.native.dbg.opt Output/$*.bp Output/$*.native.dbg.opt.out; \ + $(LLVM_SRC_ROOT)/utils/CompareDebugInfo.py $*; \ + fi From rdivacky at freebsd.org Mon Jan 31 15:19:43 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 31 Jan 2011 21:19:43 -0000 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp Message-ID: <20110131211943.AF2ED2A6C12C@llvm.org> Author: rdivacky Date: Mon Jan 31 15:19:43 2011 New Revision: 124608 URL: http://llvm.org/viewvc/llvm-project?rev=124608&view=rev Log: Enumerate .code16/32/64 instead of checking .code prefix. This unbreaks some ARM tests. Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=124608&r1=124607&r2=124608&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Jan 31 15:19:43 2011 @@ -1065,7 +1065,7 @@ if (IDVal == ".include") return ParseDirectiveInclude(); - if (IDVal.startswith(".code")) + if (IDVal == ".code16" || IDVal == ".code32" || IDVal == ".code64") return TokError(Twine(IDVal) + " not supported yet"); // Look up the handler in the handler table. From dpatel at apple.com Mon Jan 31 15:36:24 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:36:24 -0000 Subject: [llvm-commits] [llvm] r124610 - /llvm/trunk/tools/opt/opt.cpp Message-ID: <20110131213624.7FD9D2A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:36:24 2011 New Revision: 124610 URL: http://llvm.org/viewvc/llvm-project?rev=124610&view=rev Log: While printing "interesting" breakpoint locations for debug info quality test harness, focus only on entry block's terminator for now. Modified: llvm/trunk/tools/opt/opt.cpp Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=124610&r1=124609&r2=124610&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Mon Jan 31 15:36:24 2011 @@ -349,34 +349,19 @@ } virtual bool runOnFunction(Function &F) { - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { - BasicBlock::const_iterator BI = I->end(); - --BI; - do { - const Instruction *In = BI; - const DebugLoc DL = In->getDebugLoc(); - if (!DL.isUnknown()) { - DIScope S(DL.getScope(getGlobalContext())); - Out << S.getFilename() << " " << DL.getLine() << "\n"; - break; - } - --BI; - } while (BI != I->begin()); - break; - } BasicBlock &EntryBB = F.getEntryBlock(); - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { - BasicBlock *BB = I; - if (BB == &EntryBB) continue; - for (BasicBlock::iterator BI = I->begin(), BE = I->end(); BI != BE; ++BI) - if (CallInst *CI = dyn_cast(BI)) { - const DebugLoc DL = CI->getDebugLoc(); - if (!DL.isUnknown()) { - DIScope S(DL.getScope(getGlobalContext())); - Out << S.getFilename() << " " << DL.getLine() << "\n"; - } - } - } + BasicBlock::const_iterator BI = EntryBB.end(); + --BI; + do { + const Instruction *In = BI; + const DebugLoc DL = In->getDebugLoc(); + if (!DL.isUnknown()) { + DIScope S(DL.getScope(getGlobalContext())); + Out << S.getFilename() << " " << DL.getLine() << "\n"; + break; + } + --BI; + } while (BI != EntryBB.begin()); return false; } From dpatel at apple.com Mon Jan 31 15:38:14 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 31 Jan 2011 21:38:14 -0000 Subject: [llvm-commits] [llvm] r124611 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/MBlaze/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ Message-ID: <20110131213815.1C5AA2A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 15:38:14 2011 New Revision: 124611 URL: http://llvm.org/viewvc/llvm-project?rev=124611&view=rev Log: Keep track of incoming argument's location while emitting LiveIns. Added: llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Jan 31 15:38:14 2011 @@ -281,7 +281,7 @@ /// addLiveIn - Add the specified physical register as a live-in value and /// create a corresponding virtual register for it. - unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC); + unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC, DebugLoc DL); //===--------------------------------------------------------------------===// // BasicBlock accessor functions. Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon Jan 31 15:38:14 2011 @@ -17,6 +17,8 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/IndexedMap.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/Support/DebugLoc.h" #include namespace llvm { @@ -64,7 +66,10 @@ /// stored in the second element. std::vector > LiveIns; std::vector LiveOuts; - + + /// LiveInLocs - Keep track of location livein registers. + DenseMap LiveInLocs; + MachineRegisterInfo(const MachineRegisterInfo&); // DO NOT IMPLEMENT void operator=(const MachineRegisterInfo&); // DO NOT IMPLEMENT public: @@ -271,7 +276,12 @@ LiveIns.push_back(std::make_pair(Reg, vreg)); } void addLiveOut(unsigned Reg) { LiveOuts.push_back(Reg); } - + + /// addLiveInLoc - Keep track of location info for live in reg. + void addLiveInLoc(unsigned VReg, DebugLoc DL) { + LiveInLocs[VReg] = DL; + } + // Iteration support for live in/out sets. These sets are kept in sorted // order by their register number. typedef std::vector >::const_iterator Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Jan 31 15:38:14 2011 @@ -396,7 +396,8 @@ /// addLiveIn - Add the specified physical register as a live-in value and /// create a corresponding virtual register for it. unsigned MachineFunction::addLiveIn(unsigned PReg, - const TargetRegisterClass *RC) { + const TargetRegisterClass *RC, + DebugLoc DL) { MachineRegisterInfo &MRI = getRegInfo(); unsigned VReg = MRI.getLiveInVirtReg(PReg); if (VReg) { @@ -405,6 +406,7 @@ } VReg = MRI.createVirtualRegister(RC); MRI.addLiveIn(PReg, VReg); + MRI.addLiveInLoc(VReg, DL); return VReg; } Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Mon Jan 31 15:38:14 2011 @@ -210,8 +210,15 @@ LiveIns.erase(LiveIns.begin() + i); --i; --e; } else { + DebugLoc DL; + // If there is a location for this live in then use it. + DenseMap::iterator DLI = + LiveInLocs.find(LiveIns[i].second); + if (DLI != LiveInLocs.end()) + DL = DLI->second; + // Emit a copy. - BuildMI(*EntryMBB, EntryMBB->begin(), DebugLoc(), + BuildMI(*EntryMBB, EntryMBB->begin(), DL, TII.get(TargetOpcode::COPY), LiveIns[i].second) .addReg(LiveIns[i].first); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Mon Jan 31 15:38:14 2011 @@ -348,7 +348,7 @@ SDValue getControlRoot(); DebugLoc getCurDebugLoc() const { return CurDebugLoc; } - + void setCurDebugLoc(DebugLoc dl){ CurDebugLoc = dl; } unsigned getSDNodeOrder() const { return SDNodeOrder; } void CopyValueToVirtualRegister(const Value *V, unsigned Reg); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jan 31 15:38:14 2011 @@ -851,8 +851,17 @@ PrepareEHLandingPad(); // Lower any arguments needed in this block if this is the entry block. - if (LLVMBB == &Fn.getEntryBlock()) + if (LLVMBB == &Fn.getEntryBlock()) { + for (BasicBlock::const_iterator DBI = LLVMBB->begin(), DBE = LLVMBB->end(); + DBI != DBE; ++DBI) { + if (const DbgInfoIntrinsic *DI = dyn_cast(DBI)) { + const DebugLoc DL = DI->getDebugLoc(); + SDB->setCurDebugLoc(DL); + break; + } + } LowerArguments(LLVMBB); + } // Before doing SelectionDAG ISel, see if FastISel has been requested. if (FastIS) { Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -2212,7 +2212,7 @@ RC = ARM::GPRRegisterClass; // Transform the arguments stored in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); SDValue ArgValue = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32); SDValue ArgValue2; @@ -2226,7 +2226,7 @@ MachinePointerInfo::getFixedStack(FI), false, false, 0); } else { - Reg = MF.addLiveIn(NextVA.getLocReg(), RC); + Reg = MF.addLiveIn(NextVA.getLocReg(), RC, dl); ArgValue2 = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32); } @@ -2307,7 +2307,7 @@ llvm_unreachable("RegVT not supported by FORMAL_ARGUMENTS Lowering"); // Transform the arguments in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); } @@ -2384,7 +2384,7 @@ else RC = ARM::GPRRegisterClass; - unsigned VReg = MF.addLiveIn(GPRArgRegs[NumGPRs], RC); + unsigned VReg = MF.addLiveIn(GPRArgRegs[NumGPRs], RC, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -2839,7 +2839,7 @@ } // Return LR, which contains the return address. Mark it an implicit live-in. - unsigned Reg = MF.addLiveIn(ARM::LR, getRegClassFor(MVT::i32)); + unsigned Reg = MF.addLiveIn(ARM::LR, getRegClassFor(MVT::i32), dl); return DAG.getCopyFromReg(DAG.getEntryNode(), dl, Reg, VT); } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -1219,7 +1219,7 @@ FuncInfo->setVarArgsFrameIndex( MFI->CreateFixedObject(StackSlotSize, ArgOffset, true)); SDValue FIN = DAG.getFrameIndex(FuncInfo->getVarArgsFrameIndex(), PtrVT); - unsigned VReg = MF.addLiveIn(ArgRegs[ArgRegIdx], &SPU::R32CRegClass); + unsigned VReg = MF.addLiveIn(ArgRegs[ArgRegIdx], &SPU::R32CRegClass, dl); SDValue ArgVal = DAG.getRegister(VReg, MVT::v16i8); SDValue Store = DAG.getStore(Chain, dl, ArgVal, FIN, MachinePointerInfo(), false, false, 0); Modified: llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MBlaze/MBlazeISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -907,7 +907,7 @@ // Transform the arguments stored on // physical registers into virtual ones - unsigned Reg = MF.addLiveIn(ArgRegEnd, RC); + unsigned Reg = MF.addLiveIn(ArgRegEnd, RC, dl); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); // If this is an 8 or 16-bit value, it has been passed promoted @@ -973,7 +973,7 @@ for (; Start <= End; ++Start, ++StackLoc) { unsigned Reg = MBlazeRegisterInfo::getRegisterFromNumbering(Start); - unsigned LiveReg = MF.addLiveIn(Reg, RC); + unsigned LiveReg = MF.addLiveIn(Reg, RC, dl); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, LiveReg, MVT::i32); int FI = MFI->CreateFixedObject(4, 0, true); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -1597,7 +1597,7 @@ } // Transform the arguments stored in physical registers into virtual ones. - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, ValVT); InVals.push_back(ArgValue); @@ -1689,7 +1689,7 @@ // Get an existing live-in vreg, or add a new one. unsigned VReg = MF.getRegInfo().getLiveInVirtReg(GPArgRegs[GPRIndex]); if (!VReg) - VReg = MF.addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass); + VReg = MF.addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1708,7 +1708,7 @@ // Get an existing live-in vreg, or add a new one. unsigned VReg = MF.getRegInfo().getLiveInVirtReg(FPArgRegs[FPRIndex]); if (!VReg) - VReg = MF.addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass); + VReg = MF.addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::f64); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1872,7 +1872,7 @@ InVals.push_back(FIN); if (ObjSize==1 || ObjSize==2) { if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN, MachinePointerInfo(), @@ -1891,7 +1891,7 @@ // to memory. ArgVal will be address of the beginning of // the object. if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); int FI = MFI->CreateFixedObject(PtrByteSize, ArgOffset, true); SDValue FIN = DAG.getFrameIndex(FI, PtrVT); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); @@ -1914,7 +1914,7 @@ case MVT::i32: if (!isPPC64) { if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); ++GPR_idx; } else { @@ -1928,7 +1928,7 @@ // FALLTHROUGH case MVT::i64: // PPC64 if (GPR_idx != Num_GPR_Regs) { - unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass); + unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass, dl); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64); if (ObjectVT == MVT::i32) { @@ -1966,9 +1966,9 @@ unsigned VReg; if (ObjectVT == MVT::f32) - VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F4RCRegClass); + VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F4RCRegClass, dl); else - VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F8RCRegClass); + VReg = MF.addLiveIn(FPR[FPR_idx], &PPC::F8RCRegClass, dl); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, ObjectVT); ++FPR_idx; @@ -1986,7 +1986,7 @@ // Note that vector arguments in registers don't reserve stack space, // except in varargs functions. if (VR_idx != Num_VR_Regs) { - unsigned VReg = MF.addLiveIn(VR[VR_idx], &PPC::VRRCRegClass); + unsigned VReg = MF.addLiveIn(VR[VR_idx], &PPC::VRRCRegClass, dl); ArgVal = DAG.getCopyFromReg(Chain, dl, VReg, ObjectVT); if (isVarArg) { while ((ArgOffset % 16) != 0) { @@ -2064,9 +2064,9 @@ unsigned VReg; if (isPPC64) - VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass); + VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass, dl); else - VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass); + VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -194,7 +194,7 @@ false, false, 0); } else { unsigned loReg = MF.addLiveIn(NextVA.getLocReg(), - &SP::IntRegsRegClass); + &SP::IntRegsRegClass, dl); LoVal = DAG.getCopyFromReg(Chain, dl, loReg, MVT::i32); } SDValue WholeValue = Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124611&r1=124610&r2=124611&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jan 31 15:38:14 2011 @@ -1576,7 +1576,7 @@ else llvm_unreachable("Unknown argument type!"); - unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); + unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC, dl); ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, RegVT); // If this is an 8 or 16-bit value, it is really passed promoted to 32 @@ -1708,7 +1708,7 @@ SDValue FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(), RSFIN, DAG.getIntPtrConstant(Offset)); unsigned VReg = MF.addLiveIn(GPR64ArgRegs[NumIntRegs], - X86::GR64RegisterClass); + X86::GR64RegisterClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64); SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, @@ -1724,7 +1724,7 @@ SmallVector SaveXMMOps; SaveXMMOps.push_back(Chain); - unsigned AL = MF.addLiveIn(X86::AL, X86::GR8RegisterClass); + unsigned AL = MF.addLiveIn(X86::AL, X86::GR8RegisterClass, dl); SDValue ALVal = DAG.getCopyFromReg(DAG.getEntryNode(), dl, AL, MVT::i8); SaveXMMOps.push_back(ALVal); @@ -1735,7 +1735,7 @@ for (; NumXMMRegs != TotalNumXMMRegs; ++NumXMMRegs) { unsigned VReg = MF.addLiveIn(XMMArgRegs64Bit[NumXMMRegs], - X86::VR128RegisterClass); + X86::VR128RegisterClass, dl); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::v4f32); SaveXMMOps.push_back(Val); } Added: llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll?rev=124611&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-live-in-location.ll Mon Jan 31 15:38:14 2011 @@ -0,0 +1,84 @@ +; RUN: llc < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + + at str = internal constant [3 x i8] c"Hi\00" + +define void @foo() nounwind ssp { +entry: + %puts = tail call i32 @puts(i8* getelementptr inbounds ([3 x i8]* @str, i64 0, i64 0)) + ret void, !dbg !17 +} + +; CHECK: arg.c:5:14 + +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind ssp { +entry: + tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !9), !dbg !19 + tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !10), !dbg !20 + %cmp = icmp sgt i32 %argc, 1, !dbg !21 + br i1 %cmp, label %cond.end, label %for.body.lr.ph, !dbg !21 + +cond.end: ; preds = %entry + %arrayidx = getelementptr inbounds i8** %argv, i64 1, !dbg !21 + %tmp2 = load i8** %arrayidx, align 8, !dbg !21, !tbaa !22 + %call = tail call i32 (...)* @atoi(i8* %tmp2) nounwind, !dbg !21 + tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !16), !dbg !21 + tail call void @llvm.dbg.value(metadata !25, i64 0, metadata !14), !dbg !26 + %cmp57 = icmp sgt i32 %call, 0, !dbg !26 + br i1 %cmp57, label %for.body.lr.ph, label %for.end, !dbg !26 + +for.body.lr.ph: ; preds = %entry, %cond.end + %cond10 = phi i32 [ %call, %cond.end ], [ 300, %entry ] + br label %for.body + +for.body: ; preds = %for.body, %for.body.lr.ph + %i.08 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] + %puts.i = tail call i32 @puts(i8* getelementptr inbounds ([3 x i8]* @str, i64 0, i64 0)) nounwind + %inc = add nsw i32 %i.08, 1, !dbg !27 + %exitcond = icmp eq i32 %inc, %cond10 + br i1 %exitcond, label %for.end, label %for.body, !dbg !26 + +for.end: ; preds = %for.body, %cond.end + ret i32 0, !dbg !29 +} + +declare i32 @atoi(...) + +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +declare i32 @puts(i8* nocapture) nounwind + +!llvm.dbg.sp = !{!0, !5} +!llvm.dbg.lv.main = !{!9, !10, !14, !16} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foo} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"arg.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 124504)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{null} +!5 = metadata !{i32 589870, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"", metadata !1, i32 6, metadata !6, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32, i8**)* @main} ; [ DW_TAG_subprogram ] +!6 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!7 = metadata !{metadata !8} +!8 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!9 = metadata !{i32 590081, metadata !5, metadata !"argc", metadata !1, i32 5, metadata !8, i32 0} ; [ DW_TAG_arg_variable ] +!10 = metadata !{i32 590081, metadata !5, metadata !"argv", metadata !1, i32 5, metadata !11, i32 0} ; [ DW_TAG_arg_variable ] +!11 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !12} ; [ DW_TAG_pointer_type ] +!12 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !13} ; [ DW_TAG_pointer_type ] +!13 = metadata !{i32 589860, metadata !2, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] +!14 = metadata !{i32 590080, metadata !15, metadata !"i", metadata !1, i32 7, metadata !8, i32 0} ; [ DW_TAG_auto_variable ] +!15 = metadata !{i32 589835, metadata !5, i32 6, i32 1, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] +!16 = metadata !{i32 590080, metadata !15, metadata !"iterations", metadata !1, i32 8, metadata !8, i32 0} ; [ DW_TAG_auto_variable ] +!17 = metadata !{i32 4, i32 1, metadata !18, null} +!18 = metadata !{i32 589835, metadata !0, i32 2, i32 12, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] +!19 = metadata !{i32 5, i32 14, metadata !5, null} +!20 = metadata !{i32 5, i32 26, metadata !5, null} +!21 = metadata !{i32 8, i32 51, metadata !15, null} +!22 = metadata !{metadata !"any pointer", metadata !23} +!23 = metadata !{metadata !"omnipotent char", metadata !24} +!24 = metadata !{metadata !"Simple C/C++ TBAA", null} +!25 = metadata !{i32 0} +!26 = metadata !{i32 9, i32 2, metadata !15, null} +!27 = metadata !{i32 9, i32 30, metadata !28, null} +!28 = metadata !{i32 589835, metadata !15, i32 9, i32 2, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] +!29 = metadata !{i32 12, i32 9, metadata !15, null} From clattner at apple.com Mon Jan 31 15:52:22 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 31 Jan 2011 13:52:22 -0800 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp In-Reply-To: <20110131211943.AF2ED2A6C12C@llvm.org> References: <20110131211943.AF2ED2A6C12C@llvm.org> Message-ID: On Jan 31, 2011, at 1:19 PM, Roman Divacky wrote: > Author: rdivacky > Date: Mon Jan 31 15:19:43 2011 > New Revision: 124608 > > URL: http://llvm.org/viewvc/llvm-project?rev=124608&view=rev > Log: > > Enumerate .code16/32/64 instead of checking .code prefix. This > unbreaks some ARM tests. .code32 should be accepted when already in 32-bit mode, similarly for .code64. -Chris From clattner at apple.com Mon Jan 31 16:44:12 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 31 Jan 2011 14:44:12 -0800 Subject: [llvm-commits] [PATCH] fix a FIXME in SwitchInst::removeCase() In-Reply-To: References: Message-ID: <4E577331-4EF3-4411-A7C0-AEB6F083B5EB@apple.com> On Jan 31, 2011, at 7:24 AM, Jay Foad wrote: > SwitchInst::removeCase() has this comment: > > // Move everything after this operand down. > // > // FIXME: we could just swap with the end of the list, then erase. However, > // client might not expect this to happen. The code as it is thrashes the > // use/def lists, which is kinda lame. > > I've looked at all calls to removeCase() in the LLVM tree, and I don't > think any of them will care if the cases get reordered. So the > attached patch implements the more efficient approach described in the > comment, and removes the FIXME. > > Tested with "make check". OK to commit? Looks good to me, please add a comment to the header file indicating that this can happen. Thanks Jay! -Chris From anton at korobeynikov.info Mon Jan 31 16:51:49 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 1 Feb 2011 01:51:49 +0300 Subject: [llvm-commits] First draft of ARM EHABI support In-Reply-To: References: Message-ID: Hello Everyone, This is the updated series of patches which aims to emit necessary ARM EHABI stuff at least in textual form. The differences wrt previous patch is mostly support for Thumb/Thumb2 (though thumb looks pretty ugly). Any comments? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Shorten-AsmPrinterFlags-filed-to-accomodate-for-futu.patch Type: application/octet-stream Size: 1617 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0009.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Add-FrameSetup-MI-flags.patch Type: application/octet-stream Size: 7226 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0010.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-Some-first-rudimentary-support-for-ARM-EHABI-print-e.patch Type: application/octet-stream Size: 14166 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0011.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-Provide-hooks-to-set-MI-flags-in-MachineInstrBuilder.patch Type: application/octet-stream Size: 1088 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0012.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-Preliminary-support-for-ARM-frame-save-directives-em.patch Type: application/octet-stream Size: 29804 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0013.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-Handle-MI-flags-inside-Thumb2SizeReduction-pass.patch Type: application/octet-stream Size: 1563 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0014.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0007-Add-unwind-information-emission-for-thumb-stuff.patch Type: application/octet-stream Size: 3056 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0015.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0008-Implement-frame-unwinding-information-emission-for-T.patch Type: application/octet-stream Size: 18117 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0016.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: 0009-In-Thumb1-mode-the-constant-might-be-materialized-vi.patch Type: application/octet-stream Size: 2267 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/1dc132f6/attachment-0017.obj From geek4civic at gmail.com Mon Jan 31 18:28:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 1 Feb 2011 09:28:59 +0900 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: <87zkqhggv2.fsf@wanadoo.es> References: <87zkqhggv2.fsf@wanadoo.es> Message-ID: Oscar, I am afraid of any misunderstanding. I am sorry, I mistook to compress ./configure and config.h.in together as "Regenerated". I attach 3 generated config.h.in(s). * 0005-include-llvm-Config-config.h.in-Regenerate.patch.txt - Corresponds to; * 0004-autoconf-define-HAVE_DECL_SETINFORMATIONJOBOBJEC.patch.txt * 0005-Regenerate-configure-and-config.h.in.patch.txt.gz * 0010-include-llvm-Config-config.h.in-Regenerate.patch.txt - Corresponds to; * 0008-Autoconf-may-check-symbols-in-libgcc.a-for-JIT-o.patch.txt * 0009-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz * 0015-include-llvm-Config-config.h.in-Regenerate.patch.txt - Corresponds to; * 0012-autoconf-Seek-strerror_s-with-AC_CHECK_DECLS.patch.txt * 0013-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz 2011/2/1 ?scar Fuentes : >> +/* Define to 1 if you have the declaration of `SetInformationJobObject', and >> + ? to 0 if you don't. */ > > The above should read: > > /* Define to 1 if you have the declaration of `SetInformationJobObject'. */ > > Same for other macros you introduced into config.h.cmake. They are copypasto from config.h.in. Autoconf's AC_CHECK_DECL has behavior, IIRC, - defined as 1 if the decl was found - defined as 0 if the decl was not found - undefined if the test was not executed I will re-investigate behavior of CMake's check_{function|symbol}_exists. Thank you, ...Takumi -------------- next part -------------- From dab81dc13b2c0d91d5ca06f01530baaa73f1824f Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:09:41 +0900 Subject: [PATCH 05/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index b38ee62..66fd5d2 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -78,6 +78,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#undef HAVE_DECL_SETINFORMATIONJOBOBJECT + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H -- 1.7.1.GIT -------------- next part -------------- From 73ee829f14eed71758afc6343dd2dd1ef5d0ca54 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:10:50 +0900 Subject: [PATCH 10/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 48 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 66fd5d2..2688795 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -474,9 +474,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#undef HAVE__ALLOCA + +/* Have host's __alloca */ +#undef HAVE___ALLOCA + +/* Have host's __ashldi3 */ +#undef HAVE___ASHLDI3 + +/* Have host's __ashrdi3 */ +#undef HAVE___ASHRDI3 + +/* Have host's __chkstk */ +#undef HAVE___CHKSTK + +/* Have host's __cmpdi2 */ +#undef HAVE___CMPDI2 + +/* Have host's __divdi3 */ +#undef HAVE___DIVDI3 + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#undef HAVE___FIXDFDI + +/* Have host's __fixsfdi */ +#undef HAVE___FIXSFDI + +/* Have host's __floatdidf */ +#undef HAVE___FLOATDIDF + +/* Have host's __lshrdi3 */ +#undef HAVE___LSHRDI3 + +/* Have host's __main */ +#undef HAVE___MAIN + +/* Have host's __moddi3 */ +#undef HAVE___MODDI3 + +/* Have host's __udivdi3 */ +#undef HAVE___UDIVDI3 + +/* Have host's __umoddi3 */ +#undef HAVE___UMODDI3 + +/* Have host's ___chkstk */ +#undef HAVE____CHKSTK + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION -- 1.7.1.GIT -------------- next part -------------- From ffa6deabe4490424e414724587b490a446dde186 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:12:36 +0900 Subject: [PATCH 15/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 2688795..1f83d99 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -82,6 +82,10 @@ to 0 if you don't. */ #undef HAVE_DECL_SETINFORMATIONJOBOBJECT +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -388,9 +392,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R -/* Define to 1 if you have the `strerror_s' function. */ -#undef HAVE_STRERROR_S - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H -- 1.7.1.GIT From echristo at apple.com Mon Jan 31 18:35:40 2011 From: echristo at apple.com (Eric Christopher) Date: Mon, 31 Jan 2011 16:35:40 -0800 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: References: <87zkqhggv2.fsf@wanadoo.es> Message-ID: <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> On Jan 31, 2011, at 4:28 PM, NAKAMURA Takumi wrote: > Oscar, I am afraid of any misunderstanding. > I am sorry, I mistook to compress ./configure and config.h.in together > as "Regenerated". > > I attach 3 generated config.h.in(s). > > * 0005-include-llvm-Config-config.h.in-Regenerate.patch.txt > - Corresponds to; > * 0004-autoconf-define-HAVE_DECL_SETINFORMATIONJOBOBJEC.patch.txt > * 0005-Regenerate-configure-and-config.h.in.patch.txt.gz > > * 0010-include-llvm-Config-config.h.in-Regenerate.patch.txt > - Corresponds to; > * 0008-Autoconf-may-check-symbols-in-libgcc.a-for-JIT-o.patch.txt > * 0009-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz > > * 0015-include-llvm-Config-config.h.in-Regenerate.patch.txt > - Corresponds to; > * 0012-autoconf-Seek-strerror_s-with-AC_CHECK_DECLS.patch.txt > * 0013-Regenerate-configure-and-include-llvm-Config-con.patch.txt.gz > > These diffs look a little odd. What's going on here? -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/e918990d/attachment.html From rafael.espindola at gmail.com Mon Jan 31 18:41:51 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 01 Feb 2011 00:41:51 -0000 Subject: [llvm-commits] [llvm] r124634 - /llvm/trunk/tools/lto/LTOModule.cpp Message-ID: <20110201004151.E6C9B2A6C12C@llvm.org> Author: rafael Date: Mon Jan 31 18:41:51 2011 New Revision: 124634 URL: http://llvm.org/viewvc/llvm-project?rev=124634&view=rev Log: Don't tell the linker about available_externally definitions. If we do, it will complain about duplicated definitions. Modified: llvm/trunk/tools/lto/LTOModule.cpp Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=124634&r1=124633&r2=124634&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Mon Jan 31 18:41:51 2011 @@ -304,6 +304,10 @@ if (def->getName().startswith("llvm.")) return; + // ignore available_externally + if (def->hasAvailableExternallyLinkage()) + return; + // string is owned by _defines const char *symbolName = ::strdup(mangler.getNameWithPrefix(def).c_str()); From dpatel at apple.com Mon Jan 31 18:47:16 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Feb 2011 00:47:16 -0000 Subject: [llvm-commits] [llvm] r124635 - /llvm/trunk/test/FrontendC++/2006-11-30-NoCompileUnit.cpp Message-ID: <20110201004716.EA7062A6C12C@llvm.org> Author: dpatel Date: Mon Jan 31 18:47:16 2011 New Revision: 124635 URL: http://llvm.org/viewvc/llvm-project?rev=124635&view=rev Log: Remove stale test that has never worked, afaik. Removed: llvm/trunk/test/FrontendC++/2006-11-30-NoCompileUnit.cpp Removed: llvm/trunk/test/FrontendC++/2006-11-30-NoCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-30-NoCompileUnit.cpp?rev=124634&view=auto ============================================================================== --- llvm/trunk/test/FrontendC++/2006-11-30-NoCompileUnit.cpp (original) +++ llvm/trunk/test/FrontendC++/2006-11-30-NoCompileUnit.cpp (removed) @@ -1,60 +0,0 @@ -// This is a regression test on debug info to make sure we don't hit a compile -// unit size issue with gdb. -// RUN: %llvmgcc -S -O0 -g %s -o - | \ -// RUN: llc --disable-fp-elim -o NoCompileUnit.s -// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o -// RUN: %link NoCompileUnit.o -o NoCompileUnit.exe -// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 -// RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \ -// RUN: tee NoCompileUnit.out | not grep {"low == high"} -// XFAIL: alpha,arm -// XFAIL: * -// See PR2454 - - -class MamaDebugTest { -private: - int N; - -protected: - MamaDebugTest(int n) : N(n) {} - - int getN() const { return N; } - -}; - -class BabyDebugTest : public MamaDebugTest { -private: - -public: - BabyDebugTest(int n) : MamaDebugTest(n) {} - - static int doh; - - int doit() { - int N = getN(); - int Table[N]; - - int sum = 0; - - for (int i = 0; i < N; ++i) { - int j = i; - Table[i] = j; - } - for (int i = 0; i < N; ++i) { - int j = Table[i]; - sum += j; - } - - return sum; - } - -}; - -int BabyDebugTest::doh; - - -int main(int argc, const char *argv[]) { - BabyDebugTest BDT(20); - return BDT.doit(); -} From evan.cheng at apple.com Mon Jan 31 19:14:13 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Feb 2011 01:14:13 -0000 Subject: [llvm-commits] [llvm] r124639 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp lib/Target/X86/X86AsmBackend.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86Subtarget.h lib/Target/X86/X86TargetMachine.cpp Message-ID: <20110201011414.028EA2A6C12C@llvm.org> Author: evancheng Date: Mon Jan 31 19:14:13 2011 New Revision: 124639 URL: http://llvm.org/viewvc/llvm-project?rev=124639&view=rev Log: Patches to build EFI with Clang/LLVM. By Carl Norum. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp llvm/trunk/lib/Target/X86/X86AsmBackend.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/X86FrameLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Mon Jan 31 19:14:13 2011 @@ -101,7 +101,8 @@ GNU, GNUEABI, - EABI + EABI, + MachO }; private: Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Jan 31 19:14:13 2011 @@ -122,6 +122,7 @@ case GNU: return "gnu"; case GNUEABI: return "gnueabi"; case EABI: return "eabi"; + case MachO: return "macho"; } return ""; @@ -350,6 +351,8 @@ return GNUEABI; else if (EnvironmentName.startswith("gnu")) return GNU; + else if (EnvironmentName.startswith("macho")) + return MachO; else return UnknownEnvironment; } Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Mon Jan 31 19:14:13 2011 @@ -414,7 +414,10 @@ case Triple::MinGW32: case Triple::Cygwin: case Triple::Win32: - return new WindowsX86AsmBackend(T, false); + if (Triple(TT).getEnvironment() == Triple::MachO) + return new DarwinX86_32AsmBackend(T); + else + return new WindowsX86AsmBackend(T, false); default: return new ELFX86_32AsmBackend(T, Triple(TT).getOS()); } @@ -428,7 +431,10 @@ case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: - return new WindowsX86AsmBackend(T, true); + if (Triple(TT).getEnvironment() == Triple::MachO) + return new DarwinX86_64AsmBackend(T); + else + return new WindowsX86AsmBackend(T, true); default: return new ELFX86_64AsmBackend(T, Triple(TT).getOS()); } Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Mon Jan 31 19:14:13 2011 @@ -53,7 +53,7 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) { SetupMachineFunction(MF); - if (Subtarget->isTargetCOFF()) { + if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho()) { bool Intrn = MF.getFunction()->hasInternalLinkage(); OutStreamer.BeginCOFFSymbolDef(CurrentFnSym); OutStreamer.EmitCOFFSymbolStorageClass(Intrn ? COFF::IMAGE_SYM_CLASS_STATIC @@ -474,13 +474,13 @@ } void X86AsmPrinter::EmitStartOfAsmFile(Module &M) { - if (Subtarget->isTargetDarwin()) + if (Subtarget->isTargetEnvMacho()) OutStreamer.SwitchSection(getObjFileLowering().getTextSection()); } void X86AsmPrinter::EmitEndOfAsmFile(Module &M) { - if (Subtarget->isTargetDarwin()) { + if (Subtarget->isTargetEnvMacho()) { // All darwin targets use mach-o. MachineModuleInfoMachO &MMIMacho = MMI->getObjFileInfo(); @@ -581,7 +581,7 @@ OutStreamer.EmitSymbolAttribute(S, MCSA_Global); } - if (Subtarget->isTargetCOFF()) { + if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho()) { X86COFFMachineModuleInfo &COFFMMI = MMI->getObjFileInfo(); Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Mon Jan 31 19:14:13 2011 @@ -556,7 +556,9 @@ // responsible for adjusting the stack pointer. Touching the stack at 4K // increments is necessary to ensure that the guard pages used by the OS // virtual memory manager are allocated in correct sequence. - if (NumBytes >= 4096 && (STI.isTargetCygMing() || STI.isTargetWin32())) { + if (NumBytes >= 4096 && + (STI.isTargetCygMing() || STI.isTargetWin32()) && + !STI.isTargetEnvMacho()) { // Check whether EAX is livein for this function. bool isEAXAlive = isEAXLiveIn(MF); @@ -592,7 +594,9 @@ StackPtr, false, NumBytes - 4); MBB.insert(MBBI, MI); } - } else if (NumBytes >= 4096 && STI.isTargetWin64()) { + } else if (NumBytes >= 4096 && + STI.isTargetWin64() && + !STI.isTargetEnvMacho()) { // Sanity check that EAX is not livein for this function. It should // should not be, so throw an assert. assert(!isEAXLiveIn(MF) && "EAX is livein in the Win64 case!"); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jan 31 19:14:13 2011 @@ -61,21 +61,21 @@ SDValue V2); static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { - - bool is64Bit = TM.getSubtarget().is64Bit(); - - if (TM.getSubtarget().isTargetDarwin()) { + const X86Subtarget *Subtarget = &TM.getSubtarget(); + bool is64Bit = Subtarget->is64Bit(); + + if (Subtarget->isTargetEnvMacho()) { if (is64Bit) return new X8664_MachoTargetObjectFile(); return new TargetLoweringObjectFileMachO(); } - if (TM.getSubtarget().isTargetELF() ){ + if (Subtarget->isTargetELF()) { if (is64Bit) return new X8664_ELFTargetObjectFile(TM); return new X8632_ELFTargetObjectFile(TM); } - if (TM.getSubtarget().isTargetCOFF()) + if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho()) return new TargetLoweringObjectFileCOFF(); llvm_unreachable("unknown subtarget type"); } Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Mon Jan 31 19:14:13 2011 @@ -192,6 +192,10 @@ return Is64Bit && (isTargetMingw() || isTargetWindows()); } + bool isTargetEnvMacho() const { + return isTargetDarwin() || (TargetTriple.getEnvironment() == Triple::MachO); + } + bool isTargetWin32() const { return !Is64Bit && (isTargetMingw() || isTargetWindows()); } Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=124639&r1=124638&r2=124639&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Jan 31 19:14:13 2011 @@ -33,7 +33,10 @@ case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: - return new X86MCAsmInfoCOFF(TheTriple); + if (TheTriple.getEnvironment() == Triple::MachO) + return new X86MCAsmInfoDarwin(TheTriple); + else + return new X86MCAsmInfoCOFF(TheTriple); default: return new X86ELFMCAsmInfo(TheTriple); } @@ -53,7 +56,10 @@ case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: - return createWinCOFFStreamer(Ctx, TAB, *_Emitter, _OS, RelaxAll); + if (TheTriple.getEnvironment() == Triple::MachO) + return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); + else + return createWinCOFFStreamer(Ctx, TAB, *_Emitter, _OS, RelaxAll); default: return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll, NoExecStack); } From evan.cheng at apple.com Mon Jan 31 19:17:55 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 31 Jan 2011 17:17:55 -0800 Subject: [llvm-commits] Patches to build EFI with clang/llvm In-Reply-To: <971349F2-AF8D-490F-8DE2-C7DCCA6E7B57@apple.com> References: <9D168FAF-67BF-414A-A0B4-D06D146A620B@apple.com> <7A34E85B-57A9-4AFC-B81D-1F2A70662DC9@apple.com> <971349F2-AF8D-490F-8DE2-C7DCCA6E7B57@apple.com> Message-ID: <2202A6EC-C3FA-4FDF-9F4E-77841A962282@apple.com> Thanks. Committed: r124639. Evan On Jan 29, 2011, at 11:44 AM, Carl Norum wrote: > > On Jan 28, 2011, at 10:58 PM, Evan Cheng wrote: >> One more nitpick. Please rename isTargetMacho to something like isTargetEnvMacho(). isTargetDarwin() etc. are used to test OS type while Macho is an environment type. > > No problem. Patch attached. > > -- Carl > > From evan.cheng at apple.com Mon Jan 31 19:16:18 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Feb 2011 01:16:18 -0000 Subject: [llvm-commits] [llvm] r124640 - /llvm/trunk/test/MC/ARM/prefetch.ll Message-ID: <20110201011618.BFC382A6C12C@llvm.org> Author: evancheng Date: Mon Jan 31 19:16:18 2011 New Revision: 124640 URL: http://llvm.org/viewvc/llvm-project?rev=124640&view=rev Log: Fix test for non-darwin targets. Modified: llvm/trunk/test/MC/ARM/prefetch.ll Modified: llvm/trunk/test/MC/ARM/prefetch.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/prefetch.ll?rev=124640&r1=124639&r2=124640&view=diff ============================================================================== --- llvm/trunk/test/MC/ARM/prefetch.ll (original) +++ llvm/trunk/test/MC/ARM/prefetch.ll Mon Jan 31 19:16:18 2011 @@ -1,5 +1,5 @@ -; RUN: llc < %s -march=arm -mattr=+v7a,+mp -show-mc-encoding | FileCheck %s -check-prefix=ARM -; RUN: llc < %s -march=thumb -mattr=+v7a -show-mc-encoding | FileCheck %s -check-prefix=T2 +; RUN: llc < %s -mtriple=armv7-apple-darwin -mattr=+v7a,+mp -show-mc-encoding | FileCheck %s -check-prefix=ARM +; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+v7a -show-mc-encoding | FileCheck %s -check-prefix=T2 ; rdar://8924681 define void @t1(i8* %ptr) nounwind { From echristo at apple.com Mon Jan 31 19:16:32 2011 From: echristo at apple.com (Eric Christopher) Date: Tue, 01 Feb 2011 01:16:32 -0000 Subject: [llvm-commits] [llvm] r124641 - in /llvm/trunk: include/llvm/Analysis/InlineCost.h lib/Analysis/InlineCost.cpp Message-ID: <20110201011632.C1C122A6C12C@llvm.org> Author: echristo Date: Mon Jan 31 19:16:32 2011 New Revision: 124641 URL: http://llvm.org/viewvc/llvm-project?rev=124641&view=rev Log: Reapply 124275 since the Dragonegg failure was unreproducible. Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h llvm/trunk/lib/Analysis/InlineCost.cpp Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/InlineCost.h?rev=124641&r1=124640&r2=124641&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/InlineCost.h (original) +++ llvm/trunk/include/llvm/Analysis/InlineCost.h Mon Jan 31 19:16:32 2011 @@ -96,10 +96,9 @@ public: unsigned ConstantWeight; unsigned AllocaWeight; - unsigned ConstantBonus; - ArgInfo(unsigned CWeight, unsigned AWeight, unsigned CBonus) - : ConstantWeight(CWeight), AllocaWeight(AWeight), ConstantBonus(CBonus) + ArgInfo(unsigned CWeight, unsigned AWeight) + : ConstantWeight(CWeight), AllocaWeight(AWeight) {} }; @@ -125,6 +124,7 @@ // the ValueMap will update itself when this happens. ValueMap CachedFunctionInfo; + unsigned CountBonusForConstant(Value *V); public: /// getInlineCost - The heuristic used to determine if we should inline the Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=124641&r1=124640&r2=124641&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Mon Jan 31 19:16:32 2011 @@ -142,64 +142,6 @@ NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB; } -// CountBonusForConstant - Figure out an approximation for how much per-call -// performance boost we can expect if the specified value is constant. -unsigned CodeMetrics::CountBonusForConstant(Value *V) { - unsigned Bonus = 0; - bool indirectCallBonus = false; - for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ - User *U = *UI; - if (CallInst *CI = dyn_cast(U)) { - // Turning an indirect call into a direct call is a BIG win - if (CI->getCalledValue() == V) - indirectCallBonus = true; - } - else if (InvokeInst *II = dyn_cast(U)) { - // Turning an indirect call into a direct call is a BIG win - if (II->getCalledValue() == V) - indirectCallBonus = true; - } - // FIXME: Eliminating conditional branches and switches should - // also yield a per-call performance boost. - else { - // Figure out the bonuses that wll accrue due to simple constant - // propagation. - Instruction &Inst = cast(*U); - - // We can't constant propagate instructions which have effects or - // read memory. - // - // FIXME: It would be nice to capture the fact that a load from a - // pointer-to-constant-global is actually a *really* good thing to zap. - // Unfortunately, we don't know the pointer that may get propagated here, - // so we can't make this decision. - if (Inst.mayReadFromMemory() || Inst.mayHaveSideEffects() || - isa(Inst)) - continue; - - bool AllOperandsConstant = true; - for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) - if (!isa(Inst.getOperand(i)) && Inst.getOperand(i) != V) { - AllOperandsConstant = false; - break; - } - - if (AllOperandsConstant) - Bonus += CountBonusForConstant(&Inst); - } - } - - // FIXME: The only reason we're applying the bonus once is while it's great - // to devirtualize calls the magnitude of the bonus x number of call sites - // can lead to a huge code explosion when we prefer to inline 1000 instruction - // functions that have 10 call sites. This should be made a function of the - // estimated inline penalty/benefit + the indirect call bonus. - if (indirectCallBonus) Bonus += InlineConstants::IndirectCallBonus; - - return Bonus; -} - - // CountCodeReductionForConstant - Figure out an approximation for how many // instructions will be constant folded if the specified value is constant. // @@ -309,17 +251,14 @@ ArgumentWeights.reserve(F->arg_size()); for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) ArgumentWeights.push_back(ArgInfo(Metrics.CountCodeReductionForConstant(I), - Metrics.CountCodeReductionForAlloca(I), - Metrics.CountBonusForConstant(I))); + Metrics.CountCodeReductionForAlloca(I))); } /// NeverInline - returns true if the function should never be inlined into /// any caller -bool InlineCostAnalyzer::FunctionInfo::NeverInline() -{ +bool InlineCostAnalyzer::FunctionInfo::NeverInline() { return (Metrics.callsSetJmp || Metrics.isRecursive || Metrics.containsIndirectBr); - } // getSpecializationBonus - The heuristic used to determine the per-call // performance boost for using a specialization of Callee with argument @@ -343,8 +282,14 @@ if (CalleeFI->Metrics.NumBlocks == 0) CalleeFI->analyzeFunction(Callee); - for (unsigned i = 0, s = SpecializedArgNos.size(); i < s; ++i ) - Bonus += CalleeFI->ArgumentWeights[SpecializedArgNos[i]].ConstantBonus; + unsigned ArgNo = 0; + unsigned i = 0; + for (Function::arg_iterator I = Callee->arg_begin(), E = Callee->arg_end(); + I != E; ++I, ++ArgNo) + if (ArgNo == SpecializedArgNos[i]) { + ++i; + Bonus += CountBonusForConstant(I); + } // Calls usually take a long time, so they make the specialization gain // smaller. @@ -353,6 +298,62 @@ return Bonus; } +// CountBonusForConstant - Figure out an approximation for how much per-call +// performance boost we can expect if the specified value is constant. +unsigned InlineCostAnalyzer::CountBonusForConstant(Value *V) { + unsigned Bonus = 0; + bool indirectCallBonus = false; + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ + User *U = *UI; + if (CallInst *CI = dyn_cast(U)) { + // Turning an indirect call into a direct call is a BIG win + if (CI->getCalledValue() == V) + indirectCallBonus = true; + } + else if (InvokeInst *II = dyn_cast(U)) { + // Turning an indirect call into a direct call is a BIG win + if (II->getCalledValue() == V) + indirectCallBonus = true; + } + // FIXME: Eliminating conditional branches and switches should + // also yield a per-call performance boost. + else { + // Figure out the bonuses that wll accrue due to simple constant + // propagation. + Instruction &Inst = cast(*U); + + // We can't constant propagate instructions which have effects or + // read memory. + // + // FIXME: It would be nice to capture the fact that a load from a + // pointer-to-constant-global is actually a *really* good thing to zap. + // Unfortunately, we don't know the pointer that may get propagated here, + // so we can't make this decision. + if (Inst.mayReadFromMemory() || Inst.mayHaveSideEffects() || + isa(Inst)) + continue; + + bool AllOperandsConstant = true; + for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) + if (!isa(Inst.getOperand(i)) && Inst.getOperand(i) != V) { + AllOperandsConstant = false; + break; + } + + if (AllOperandsConstant) + Bonus += CountBonusForConstant(&Inst); + } + } + + // FIXME: The only reason we're applying the bonus once is while it's great + // to devirtualize calls the magnitude of the bonus x number of call sites + // can lead to a huge code explosion when we prefer to inline 1000 instruction + // functions that have 10 call sites. This should be made a function of the + // estimated inline penalty/benefit + the indirect call bonus. + if (indirectCallBonus) Bonus += InlineConstants::IndirectCallBonus; + + return Bonus; +} // getInlineCost - The heuristic used to determine if we should inline the // function call or not. @@ -427,31 +428,33 @@ // passed into the function. // unsigned ArgNo = 0; - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); - I != E; ++I, ++ArgNo) { - // Each argument passed in has a cost at both the caller and the callee - // sides. Measurements show that each argument costs about the same as an - // instruction. - InlineCost -= InlineConstants::InstrCost; + CallSite::arg_iterator I = CS.arg_begin(); + for (Function::arg_iterator FI = Callee->arg_begin(), FE = Callee->arg_end(); + FI != FE; ++I, ++FI, ++ArgNo) { // If an alloca is passed in, inlining this function is likely to allow // significant future optimization possibilities (like scalar promotion, and // scalarization), so encourage the inlining of the function. // - if (isa(I)) { - if (ArgNo < CalleeFI->ArgumentWeights.size()) - InlineCost -= CalleeFI->ArgumentWeights[ArgNo].AllocaWeight; - - // If this is a constant being passed into the function, use the argument - // weights calculated for the callee to determine how much will be folded - // away with this information. - } else if (isa(I)) { - if (ArgNo < CalleeFI->ArgumentWeights.size()) - InlineCost -= (CalleeFI->ArgumentWeights[ArgNo].ConstantWeight + - CalleeFI->ArgumentWeights[ArgNo].ConstantBonus); + if (isa(I)) + InlineCost -= CalleeFI->ArgumentWeights[ArgNo].AllocaWeight; + + // If this is a constant being passed into the function, use the argument + // weights calculated for the callee to determine how much will be folded + // away with this information. + else if (isa(I)) { + InlineCost -= CalleeFI->ArgumentWeights[ArgNo].ConstantWeight; + + // Compute any constant bonus due to inlining we want to give here. + InlineCost -= CountBonusForConstant(FI); } } + // Each argument passed in has a cost at both the caller and the callee + // sides. Measurements show that each argument costs about the same as an + // instruction. + InlineCost -= (CS.arg_size() * InlineConstants::InstrCost); + // If there is only one call of the function, and it has internal linkage, // make it almost guaranteed to be inlined. // From carl.norum at apple.com Mon Jan 31 19:25:31 2011 From: carl.norum at apple.com (Carl Norum) Date: Mon, 31 Jan 2011 17:25:31 -0800 Subject: [llvm-commits] Patches to build EFI with clang/llvm In-Reply-To: <2202A6EC-C3FA-4FDF-9F4E-77841A962282@apple.com> References: <9D168FAF-67BF-414A-A0B4-D06D146A620B@apple.com> <7A34E85B-57A9-4AFC-B81D-1F2A70662DC9@apple.com> <971349F2-AF8D-490F-8DE2-C7DCCA6E7B57@apple.com> <2202A6EC-C3FA-4FDF-9F4E-77841A962282@apple.com> Message-ID: On Jan 31, 2011, at 5:17 PM, Evan Cheng wrote: > Thanks. Committed: r124639. Thanks - that's half the battle complete! I'm hoping to get the clang patches accepted soon, too.. that will get us able to use clang/llvm without having to maintain our own patches here. Thanks for your help! -- Carl From ofv at wanadoo.es Mon Jan 31 19:43:12 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Tue, 01 Feb 2011 02:43:12 +0100 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> (Eric Christopher's message of "Mon, 31 Jan 2011 16:35:40 -0800") References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> Message-ID: <87aaigh6mn.fsf@wanadoo.es> Eric Christopher writes: > These diffs look a little odd. What's going on here? Takumi is using git-format-patch for posting the diffs. The e-mail headers comes from it. No problem with that, as the diffs are just for review. From echristo at apple.com Mon Jan 31 19:45:13 2011 From: echristo at apple.com (Eric Christopher) Date: Mon, 31 Jan 2011 17:45:13 -0800 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: <87aaigh6mn.fsf@wanadoo.es> References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> Message-ID: On Jan 31, 2011, at 5:43 PM, ?scar Fuentes wrote: > Eric Christopher writes: > >> These diffs look a little odd. What's going on here? > > Takumi is using git-format-patch for posting the diffs. The e-mail > headers comes from it. No problem with that, as the diffs are just for > review. Enh, I meant what he was accomplishing with them. I probably missed the earlier part of the conversation on these since I'd thought it was cmake only. I'm lazy and have left that to you :) -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/46224c63/attachment.html From evan.cheng at apple.com Mon Jan 31 19:50:50 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Feb 2011 01:50:50 -0000 Subject: [llvm-commits] [llvm] r124645 - /llvm/trunk/lib/MC/MachObjectWriter.cpp Message-ID: <20110201015050.1D29D2A6C12C@llvm.org> Author: evancheng Date: Mon Jan 31 19:50:49 2011 New Revision: 124645 URL: http://llvm.org/viewvc/llvm-project?rev=124645&view=rev Log: Fix bogus assert condition noticed by Csaba Raduly. Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=124645&r1=124644&r2=124645&view=diff ============================================================================== --- llvm/trunk/lib/MC/MachObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/MachObjectWriter.cpp Mon Jan 31 19:50:49 2011 @@ -185,8 +185,8 @@ if (is64Bit()) Write32(0); // reserved - assert(OS.tell() - Start == is64Bit() ? - macho::Header64Size : macho::Header32Size); + assert(OS.tell() - Start == + (is64Bit() ? macho::Header64Size : macho::Header32Size)); } /// WriteSegmentLoadCommand - Write a segment load command. From ofv at wanadoo.es Mon Jan 31 20:04:10 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Tue, 01 Feb 2011 03:04:10 +0100 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: (Eric Christopher's message of "Mon, 31 Jan 2011 17:45:13 -0800") References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> Message-ID: <8762t4h5np.fsf@wanadoo.es> Eric Christopher writes: >>> These diffs look a little odd. What's going on here? >> >> Takumi is using git-format-patch for posting the diffs. The e-mail >> headers comes from it. No problem with that, as the diffs are just for >> review. > > Enh, I meant what he was accomplishing with them. I probably missed the > earlier part of the conversation on these since I'd thought it was > cmake only. I'm lazy and have left that to you :) The changes affect both cmake and autoconf. The last post from Takumi contained improved versions of the autoconf part. See the first message of the thread. From geek4civic at gmail.com Mon Jan 31 21:05:18 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 1 Feb 2011 12:05:18 +0900 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: <8762t4h5np.fsf@wanadoo.es> References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> <8762t4h5np.fsf@wanadoo.es> Message-ID: Eric and Oscar, I reformatted my patchset and attached, thank you. ...Takumi -- original message(updated) -- Now I can build clang and llvm on Windows x64 with both mingw-w64-g++ and w64-clang. Here, some patches are, to build. Please take a look into them. I have checked on x86_64-centos5, mingw32(and msys), msvs10, mingw-w64-g++ and stage3-mingw64-clang(with my patches). ps. please see also; http://llvm.org/bugs/show_bug.cgi?id=9100 ...Takumi * 0001-Windows-Windows.h-mingw64-might-have-_WIN32_WINN.patch.txt [PR8848] I will honor predefined _WN32_WINNT on x64 compilers. * 0002-Windows-DynamicLibrary.inc-ELM_Callback-fix.patch.txt [PR8848] I split conditions. It would be easier to read, I suppose. * 0003-lib-Target-X86-X86JITInfo.cpp-Add-Win64-stuff.patch.txt It would be essential to run JIT on x64 with mingw64. * 0004-autoconf-define-HAVE_DECL_SETINFORMATIONJOBOBJEC.patch.txt * 0005-include-llvm-Config-config.h.in-Regenerate.patch.txt * 0006-Regenerate-configure.patch.txt.gz * 0007-CMake-define-HAVE_DECL_SETINFORMATIONJOBOBJECT-f.patch.txt * 0008-Windows-Program.inc-Declare-SetInformationJobObj.patch.txt Ancient mingw32 might not have the declaration of SetInformationJobObject(). Autoconf and CMake can find the decl in windows.h(winbase.h). FIXME: w/o _WIN32_WINNT := 0x0500, SetInformationJobObject() could not be found on my w32api/mingw. I will improve it later. (I need to inspect the decl with -D_WIN32_WINNT=0x0500) * 0009-Autoconf-may-check-symbols-in-libgcc.a-for-JIT-o.patch.txt * 0010-include-llvm-Config-config.h.in-Regenerate.patch.txt * 0011-Regenerate-configure.patch.txt.gz * 0012-CMake-may-check-symbols-in-libgcc.a-for-JIT-on-M.patch.txt * 0013-Windows-DynamicLibrary.inc-Split-explicit-symbol.patch.txt I know it would be gross, but I think it practical. Autoconf and CMake seeks symbols for JIT. FIXME: __cmpdi2 and __main would never be referred to by anyone, I guess. FIXME: Is there good way to extract symbols for JIT from lib/CodeGen/SelectionDAG/TargetLowering.cpp? * 0014-autoconf-Seek-strerror_s-with-AC_CHECK_DECLS.patch.txt * 0015-include-llvm-Config-config.h.in-Regenerate.patch.txt * 0016-Regenerate-configure.patch.txt.gz * 0017-CMake-Use-HAVE_DECL_STRERROR_S.patch.txt * 0018-lib-Support-Errno.cpp-Use-HAVE_DECL_STRERROR_S.patch.txt On mingw64, strerror_s() is defined in libs but not defined int string.h by default. AC_CHECK_DECL can inspect the declaration. I wish it would work even if strerror_s() were defined by default! FIXME: Shall we inspect and define MINGW_HAS_SECURE_API? -------------- next part -------------- From 1c30d43a3d574b431b2fa3a46eb2c64f862516a4 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:33:35 +0900 Subject: [PATCH 01/18] Windows/Windows.h: mingw64 might have _WIN32_WINNT. --- lib/Support/Windows/Windows.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/Support/Windows/Windows.h b/lib/Support/Windows/Windows.h index 6e0b585..8eaaf31 100644 --- a/lib/Support/Windows/Windows.h +++ b/lib/Support/Windows/Windows.h @@ -17,9 +17,15 @@ //===----------------------------------------------------------------------===// // Require at least Windows 2000 API. +#ifdef _WIN32_WINNT +#if _WIN32_WINNT < 0x0500 +#error "We assume at least Windows 2000 API." +#endif +#else #define _WIN32_WINNT 0x0500 #define _WIN32_IE 0x0500 // MinGW at it again. #define WIN32_LEAN_AND_MEAN +#endif #include "llvm/Config/config.h" // Get build system configuration settings #include -- 1.7.1.GIT -------------- next part -------------- From 07adf470b0061c6005d54c5bbab38b247350934b Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:32:50 +0900 Subject: [PATCH 02/18] Windows/DynamicLibrary.inc: ELM_Callback fix --- lib/Support/Windows/DynamicLibrary.inc | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5fad37a..5e10f77 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -55,7 +55,17 @@ extern "C" { // Use new callback if: // - Newer Visual Studio (comes with newer SDK). // - Visual Studio 2005 with Windows SDK 6.0+ -#if !defined(_MSC_VER) || _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) +#if defined(_MSC_VER) + #if _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) + #define OLD_ELM_CALLBACK_DECL 1 + #endif +#elif defined(__MINGW64__) + // Use new callback. +#elif defined(__MINGW32__) + #define OLD_ELM_CALLBACK_DECL 1 +#endif + +#ifdef OLD_ELM_CALLBACK_DECL static BOOL CALLBACK ELM_Callback(PSTR ModuleName, ModuleBaseType ModuleBase, ULONG ModuleSize, -- 1.7.1.GIT -------------- next part -------------- From bc9672a27d5b6561afda8f38faa1f5a9b3141448 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 19 Dec 2010 15:20:08 +0900 Subject: [PATCH 03/18] lib/Target/X86/X86JITInfo.cpp: Add Win64 stuff. --- lib/Target/X86/X86JITInfo.cpp | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp index 759de77..127738d 100644 --- a/lib/Target/X86/X86JITInfo.cpp +++ b/lib/Target/X86/X86JITInfo.cpp @@ -127,9 +127,17 @@ extern "C" { "movaps %xmm6, 96(%rsp)\n" "movaps %xmm7, 112(%rsp)\n" // JIT callee +#ifdef _WIN64 + "subq $32, %rsp\n" + "movq %rbp, %rcx\n" // Pass prev frame and return address + "movq 8(%rbp), %rdx\n" + "call " ASMPREFIX "X86CompilationCallback2\n" + "addq $32, %rsp\n" +#else "movq %rbp, %rdi\n" // Pass prev frame and return address "movq 8(%rbp), %rsi\n" "call " ASMPREFIX "X86CompilationCallback2\n" +#endif // Restore all XMM arg registers "movaps 112(%rsp), %xmm7\n" "movaps 96(%rsp), %xmm6\n" -- 1.7.1.GIT -------------- next part -------------- From 9c376f6d99042d17ef3ba3eff0e3942cef83e1ce Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 12:57:55 +0900 Subject: [PATCH 04/18] autoconf: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- autoconf/configure.ac | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 0cc3d3e..cc39ee4 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1220,6 +1220,7 @@ AC_CHECK_LIB(m,sin) if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(imagehlp, main) AC_CHECK_LIB(psapi, main) + AC_CHECK_DECLS([SetInformationJobObject],,,[#include ]) fi dnl dlopen() is required for plugin support. -- 1.7.1.GIT -------------- next part -------------- From 331e0d61610f0c2abe198641c1c106122a6d4914 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:09:41 +0900 Subject: [PATCH 05/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index b38ee62..66fd5d2 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -78,6 +78,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#undef HAVE_DECL_SETINFORMATIONJOBOBJECT + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 1078 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/e3989f36/attachment-0003.gz -------------- next part -------------- From c06ded882884995371f83f6b7348cc905cadc30d Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:07:38 +0900 Subject: [PATCH 07/18] CMake: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- cmake/config-ix.cmake | 1 + include/llvm/Config/config.h.cmake | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 4cb68df..7ee5c94 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -146,6 +146,7 @@ check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) + check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index c94abb6..95d9efa 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -80,6 +80,10 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H} +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#cmakedefine HAVE_DECL_SETINFORMATIONJOBOBJECT ${HAVE_DECL_SETINFORMATIONJOBOBJECT} + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} -- 1.7.1.GIT -------------- next part -------------- From ed6057397d374fe70526514695857f3bee2a9085 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 12:59:30 +0900 Subject: [PATCH 08/18] Windows/Program.inc: Declare SetInformationJobObject() if decls not found in Windows.h. --- lib/Support/Windows/Program.inc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index 0b92c78..9fcbc8d 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -22,7 +22,8 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// -#ifdef __MINGW32__ +#if defined(HAVE_DECL_SETINFORMATIONJOBOBJECT) +#if !HAVE_DECL_SETINFORMATIONJOBOBJECT // Ancient mingw32's w32api might not have this declaration. extern "C" BOOL WINAPI SetInformationJobObject(HANDLE hJob, @@ -30,6 +31,7 @@ BOOL WINAPI SetInformationJobObject(HANDLE hJob, LPVOID lpJobObjectInfo, DWORD cbJobObjectInfoLength); #endif +#endif namespace { struct Win32ProcessInfo { -- 1.7.1.GIT -------------- next part -------------- From ef868e190baa5494f342edb045c50c72bea5bc52 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:12:15 +0900 Subject: [PATCH 09/18] Autoconf may check symbols in libgcc.a for JIT on Mingw. --- autoconf/configure.ac | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index cc39ee4..225d0f6 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1398,6 +1398,28 @@ AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check symbols in libgcc.a for JIT on Mingw. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) + AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) + AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) + AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) + + AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) + AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) + AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) + AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) + AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) + AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) + AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) + AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) + AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) + AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) + + AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) + AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) +fi + dnl Check for variations in the Standard C++ library and STL. These macros are dnl provided by LLVM in the autoconf/m4 directory. AC_FUNC_ISNAN -- 1.7.1.GIT -------------- next part -------------- From ad1b51932da3bee63fe27bf03511fb1a1cce602a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:10:50 +0900 Subject: [PATCH 10/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 48 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 66fd5d2..2688795 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -474,9 +474,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#undef HAVE__ALLOCA + +/* Have host's __alloca */ +#undef HAVE___ALLOCA + +/* Have host's __ashldi3 */ +#undef HAVE___ASHLDI3 + +/* Have host's __ashrdi3 */ +#undef HAVE___ASHRDI3 + +/* Have host's __chkstk */ +#undef HAVE___CHKSTK + +/* Have host's __cmpdi2 */ +#undef HAVE___CMPDI2 + +/* Have host's __divdi3 */ +#undef HAVE___DIVDI3 + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#undef HAVE___FIXDFDI + +/* Have host's __fixsfdi */ +#undef HAVE___FIXSFDI + +/* Have host's __floatdidf */ +#undef HAVE___FLOATDIDF + +/* Have host's __lshrdi3 */ +#undef HAVE___LSHRDI3 + +/* Have host's __main */ +#undef HAVE___MAIN + +/* Have host's __moddi3 */ +#undef HAVE___MODDI3 + +/* Have host's __udivdi3 */ +#undef HAVE___UDIVDI3 + +/* Have host's __umoddi3 */ +#undef HAVE___UMODDI3 + +/* Have host's ___chkstk */ +#undef HAVE____CHKSTK + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0011-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 2172 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/e3989f36/attachment-0004.gz -------------- next part -------------- From e2ec7b6b4ca393adee063ce7990e8271c1fac0c2 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 17:56:13 +0900 Subject: [PATCH 12/18] CMake may check symbols in libgcc.a for JIT on Mingw. --- cmake/config-ix.cmake | 20 +++++++++++++++ include/llvm/Config/config.h.cmake | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 7ee5c94..b0d236c 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -147,6 +147,26 @@ check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) + + check_function_exists(_alloca HAVE__ALLOCA) + check_function_exists(__alloca HAVE___ALLOCA) + check_function_exists(__chkstk HAVE___CHKSTK) + check_function_exists(___chkstk HAVE____CHKSTK) + + check_function_exists(__ashldi3 HAVE___ASHLDI3) + check_function_exists(__ashrdi3 HAVE___ASHRDI3) + check_function_exists(__divdi3 HAVE___DIVDI3) + check_function_exists(__fixdfdi HAVE___FIXDFDI) + check_function_exists(__fixsfdi HAVE___FIXSFDI) + check_function_exists(__floatdidf HAVE___FLOATDIDF) + check_function_exists(__lshrdi3 HAVE___LSHRDI3) + check_function_exists(__moddi3 HAVE___MODDI3) + check_function_exists(__udivdi3 HAVE___UDIVDI3) + check_function_exists(__umoddi3 HAVE___UMODDI3) + + check_function_exists(__main HAVE___MAIN) + check_function_exists(__cmpdi2 HAVE___CMPDI2) + endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 95d9efa..375c97f 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -470,9 +470,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} + +/* Have host's __alloca */ +#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} + +/* Have host's __ashldi3 */ +#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} + +/* Have host's __ashrdi3 */ +#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} + +/* Have host's __chkstk */ +#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} + +/* Have host's __cmpdi2 */ +#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} + +/* Have host's __divdi3 */ +#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} + +/* Have host's __fixsfdi */ +#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} + +/* Have host's __floatdidf */ +#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} + +/* Have host's __lshrdi3 */ +#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} + +/* Have host's __main */ +#cmakedefine HAVE___MAIN ${HAVE___MAIN} + +/* Have host's __moddi3 */ +#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} + +/* Have host's __udivdi3 */ +#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} + +/* Have host's __umoddi3 */ +#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} + +/* Have host's ___chkstk */ +#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION -- 1.7.1.GIT -------------- next part -------------- From 0ae2080d8027c9a9c37d36f2dbe2534168aebfb3 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 11:27:12 +0900 Subject: [PATCH 13/18] Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc. --- lib/Support/Windows/DynamicLibrary.inc | 77 +++++++----------------------- lib/Support/Windows/explicit_symbols.inc | 66 +++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 lib/Support/Windows/explicit_symbols.inc diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5e10f77..2c14366 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -120,35 +120,14 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *filename, // Stack probing routines are in the support library (e.g. libgcc), but we don't // have dynamic linking on windows. Provide a hook. -#if defined(__MINGW32__) || defined (_MSC_VER) - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return (void*)&SYM - #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ - if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO - #define EXPLICIT_SYMBOL_DEF(SYM) \ - extern "C" { extern void *SYM; } - - #if defined(__MINGW32__) - EXPLICIT_SYMBOL_DEF(_alloca) - EXPLICIT_SYMBOL_DEF(__main) - EXPLICIT_SYMBOL_DEF(__ashldi3) - EXPLICIT_SYMBOL_DEF(__ashrdi3) - EXPLICIT_SYMBOL_DEF(__cmpdi2) - EXPLICIT_SYMBOL_DEF(__divdi3) - EXPLICIT_SYMBOL_DEF(__fixdfdi) - EXPLICIT_SYMBOL_DEF(__fixsfdi) - EXPLICIT_SYMBOL_DEF(__fixunsdfdi) - EXPLICIT_SYMBOL_DEF(__fixunssfdi) - EXPLICIT_SYMBOL_DEF(__floatdidf) - EXPLICIT_SYMBOL_DEF(__floatdisf) - EXPLICIT_SYMBOL_DEF(__lshrdi3) - EXPLICIT_SYMBOL_DEF(__moddi3) - EXPLICIT_SYMBOL_DEF(__udivdi3) - EXPLICIT_SYMBOL_DEF(__umoddi3) - #elif defined(_MSC_VER) - EXPLICIT_SYMBOL_DEF(_alloca_probe) - #endif -#endif +#define EXPLICIT_SYMBOL(SYM) \ + extern "C" { extern void *SYM; } +#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) EXPLICIT_SYMBOL(SYMTO) + +#include "explicit_symbols.inc" + +#undef EXPLICIT_SYMBOL +#undef EXPLICIT_SYMBOL2 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). @@ -169,39 +148,17 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { } } -#if defined(__MINGW32__) - { - EXPLICIT_SYMBOL(_alloca); - EXPLICIT_SYMBOL(__main); - EXPLICIT_SYMBOL(__ashldi3); - EXPLICIT_SYMBOL(__ashrdi3); - EXPLICIT_SYMBOL(__cmpdi2); - EXPLICIT_SYMBOL(__divdi3); - EXPLICIT_SYMBOL(__fixdfdi); - EXPLICIT_SYMBOL(__fixsfdi); - EXPLICIT_SYMBOL(__fixunsdfdi); - EXPLICIT_SYMBOL(__fixunssfdi); - EXPLICIT_SYMBOL(__floatdidf); - EXPLICIT_SYMBOL(__floatdisf); - EXPLICIT_SYMBOL(__lshrdi3); - EXPLICIT_SYMBOL(__moddi3); - EXPLICIT_SYMBOL(__udivdi3); - EXPLICIT_SYMBOL(__umoddi3); - - EXPLICIT_SYMBOL2(alloca, _alloca); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF - } -#elif defined(_MSC_VER) + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return (void*)&SYM; + #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ + if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO; + { - EXPLICIT_SYMBOL2(alloca, _alloca_probe); - EXPLICIT_SYMBOL2(_alloca, _alloca_probe); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF + #include "explicit_symbols.inc" } -#endif + + #undef EXPLICIT_SYMBOL + #undef EXPLICIT_SYMBOL2 return 0; } diff --git a/lib/Support/Windows/explicit_symbols.inc b/lib/Support/Windows/explicit_symbols.inc new file mode 100644 index 0000000..84862d6 --- /dev/null +++ b/lib/Support/Windows/explicit_symbols.inc @@ -0,0 +1,66 @@ +/* in libgcc.a */ + +#ifdef HAVE__ALLOCA + EXPLICIT_SYMBOL(_alloca) + EXPLICIT_SYMBOL2(alloca, _alloca); +#endif +#ifdef HAVE___ALLOCA + EXPLICIT_SYMBOL(__alloca) +#endif +#ifdef HAVE___CHKSTK + EXPLICIT_SYMBOL(__chkstk) +#endif +#ifdef HAVE____CHKSTK + EXPLICIT_SYMBOL(___chkstk) +#endif +#ifdef HAVE___MAIN + EXPLICIT_SYMBOL(__main) // FIXME: Don't call it. +#endif + +#ifdef HAVE___ASHLDI3 + EXPLICIT_SYMBOL(__ashldi3) +#endif +#ifdef HAVE___ASHRDI3 + EXPLICIT_SYMBOL(__ashrdi3) +#endif +#ifdef HAVE___CMPDI2 // FIXME: unused + EXPLICIT_SYMBOL(__cmpdi2) +#endif +#ifdef HAVE___DIVDI3 + EXPLICIT_SYMBOL(__divdi3) +#endif +#ifdef HAVE___FIXDFDI + EXPLICIT_SYMBOL(__fixdfdi) +#endif +#ifdef HAVE___FIXSFDI + EXPLICIT_SYMBOL(__fixsfdi) +#endif +#ifdef HAVE___FIXUNSDFDI + EXPLICIT_SYMBOL(__fixunsdfdi) +#endif +#ifdef HAVE___FIXUNSSFDI + EXPLICIT_SYMBOL(__fixunssfdi) +#endif +#ifdef HAVE___FLOATDIDF + EXPLICIT_SYMBOL(__floatdidf) +#endif +#ifdef HAVE___FLOATDISF + EXPLICIT_SYMBOL(__floatdisf) +#endif +#ifdef HAVE___LSHRDI3 + EXPLICIT_SYMBOL(__lshrdi3) +#endif +#ifdef HAVE___MODDI3 + EXPLICIT_SYMBOL(__moddi3) +#endif +#ifdef HAVE___UDIVDI3 + EXPLICIT_SYMBOL(__udivdi3) +#endif +#ifdef HAVE___UMODDI3 + EXPLICIT_SYMBOL(__umoddi3) +#endif + +/* msvcrt */ +#if defined(_MSC_VER) + EXPLICIT_SYMBOL2(alloca, _alloca_probe); +#endif -- 1.7.1.GIT -------------- next part -------------- From 74928d67ec4254ff6fba641b10fb670bae90e9e8 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 18 Jan 2011 15:30:58 +0900 Subject: [PATCH 14/18] autoconf: Seek strerror_s() with AC_CHECK_DECLS. AC_CHECK_FUNCS seeks a symbol only in libs. We should check decl in string.h. With recent Mingw, *_s() stuff would be enabled by MINGW_HAS_SECURE_API. --- autoconf/configure.ac | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 225d0f6..72eae40 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1392,12 +1392,15 @@ AC_CHECK_FUNCS([powf fmodf strtof round ]) AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) -AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ]) +AC_CHECK_FUNCS([strerror strerror_r setenv ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check the declaration of strerror_s(). It is not provided by default on Mingw. +AC_CHECK_DECLS([strerror_s]) + dnl Check symbols in libgcc.a for JIT on Mingw. if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) -- 1.7.1.GIT -------------- next part -------------- From bdc98817fe819c3de86254ab325b14b2b221e5d6 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:12:36 +0900 Subject: [PATCH 15/18] include/llvm/Config/config.h.in: Regenerate. --- include/llvm/Config/config.h.in | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 2688795..1f83d99 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -82,6 +82,10 @@ to 0 if you don't. */ #undef HAVE_DECL_SETINFORMATIONJOBOBJECT +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -388,9 +392,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R -/* Define to 1 if you have the `strerror_s' function. */ -#undef HAVE_STRERROR_S - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0016-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 1159 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/e3989f36/attachment-0005.gz -------------- next part -------------- From 226570dae3459e3c2e0d1cab20f103db9965974e Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 18 Jan 2011 15:30:58 +0900 Subject: [PATCH 17/18] CMake: Use HAVE_DECL_STRERROR_S. --- cmake/config-ix.cmake | 2 +- include/llvm/Config/config.h.cmake | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index b0d236c..2ce0b04 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -140,7 +140,7 @@ check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ) check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) -check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) +check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S) check_symbol_exists(memcpy string.h HAVE_MEMCPY) check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 375c97f..0157ec4 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -84,6 +84,10 @@ to 0 if you don't. */ #cmakedefine HAVE_DECL_SETINFORMATIONJOBOBJECT ${HAVE_DECL_SETINFORMATIONJOBOBJECT} +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_STRERROR_S ${HAVE_DECL_STRERROR_S} + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} @@ -390,9 +394,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} -/* Define to 1 if you have the `strerror_s' function. */ -#cmakedefine HAVE_STRERROR_S ${HAVE_STRERROR_S} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} -- 1.7.1.GIT -------------- next part -------------- From 915d1e6394701f88a40dc87afcbba92a843086b5 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:32:27 +0900 Subject: [PATCH 18/18] lib/Support/Errno.cpp: Use HAVE_DECL_STRERROR_S. --- lib/Support/Errno.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Support/Errno.cpp b/lib/Support/Errno.cpp index 312d91e..c2a0f71 100644 --- a/lib/Support/Errno.cpp +++ b/lib/Support/Errno.cpp @@ -50,7 +50,7 @@ std::string StrError(int errnum) { # else strerror_r(errnum,buffer,MaxErrStrLen-1); # endif -#elif defined(HAVE_STRERROR_S) // Windows. +#elif HAVE_DECL_STRERROR_S // MSVCRT.DLL does not provide one. if (errnum) strerror_s(buffer, errnum); #elif defined(HAVE_STRERROR) -- 1.7.1.GIT From vmle at ucdavis.edu Mon Jan 31 17:05:35 2011 From: vmle at ucdavis.edu (Vu Le) Date: Mon, 31 Jan 2011 15:05:35 -0800 Subject: [llvm-commits] [PATCH] Add SeSeRegionInfo transform pass Message-ID: Hi Tobias and Andreas, I'm looking at Andreas' SeseRegionInfo.cpp I think after we split the entry and exit node, we have to update the DominatorTree since Region is based on it. I applied the patch and came up with the problem described below. Suppose I have a region like this. BB1 is the Entry and BB3 is the exit \ / BB1 / \ | BB2 \ / BB3 We have to split the entry BB1, since BB1 does not have a single entry edge. The result looks like this. \ / BB1 | BB1.new / \ | BB2 \ / BB3 The new entry node is BB1.new. BB1 is split into BB1->BB1.new. We then use DT->splitBlock(BB1.new) to update the DominatorTree. (This is similar to CodeExtractor::severSplitPHINode) But that is where we have problems. DominatorTree::splitBlock(NewBB) make an assumption that NewBB has only one successor. But in our case, BB1.new has 2 successors, BB2 and BB3. I do think that is not a valid assumption. Tell me what you guys think, and I'll fix this. Thanks a lot. Vu > On 01/14/2011 07:06 AM, Andreas Simbuerger wrote: > > Hi, > > > > this patch adds a small transform pass that converts a refined region > > into a simple region by adding the required edges at the region entry / > > > exit. > > Thanks Andreas, > > > Basically it should update the RegionInfo analysis correctly, but > > sometimes it fails to do so. > > This requires some work on the RegionInfo::splitBlock methods. > > > I'll try to figure it out and send a patch for that at a later time. > > > > Test cases will follow in a separate patch. > > Here my review. Let's commit it as soon as splitBlock() is enhanced and > > we have got some test cases. > > > 0001-Add-SeSeRegionInfo-transform-pass.patch > > > > > > From cf305190c65a72505408d663b0e4bf01bb7afa74 Mon Sep 17 00:00:00 2001 > > From: Andreas Simbuerger> > > > Date: Fri, 14 Jan 2011 10:01:19 +0100 > > Subject: [PATCH] Add SeSeRegionInfo transform pass. > > As this is a transformation pass, I believe calling it "Info" is > misleading. What about "SimplifyRegions" or "SimpleRegions"? > > > This adds a single entry / single exit edge transformation pass. > > The RegionInfo analysis constructs a region tree that contains > > of 2 types of regions: > > * Refined regions > > * Simple regions > > > > > While simple regions only have two transitions inside > > (1 entry, 1 exit), refined regions don't have that property. > > However, refined regions can be transformed into simple regions > > by merging multiple edges into a new split BasicBlock and forming > > > a new edge. > > --- > > include/llvm/InitializePasses.h | 1 + > > include/llvm/LinkAllPasses.h | 1 + > > include/llvm/Transforms/Scalar.h | 6 + > > lib/Transforms/Scalar/CMakeLists.txt | 1 + > > > lib/Transforms/Scalar/Scalar.cpp | 1 + > > lib/Transforms/Scalar/SeSeRegionInfo.cpp | 167 ++++++++++++++++++++++++++++++ > > 6 files changed, 177 insertions(+), 0 deletions(-) > > create mode 100644 lib/Transforms/Scalar/SeSeRegionInfo.cpp > > > > > diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h > > index d86b199..a50db8d 100644 > > --- a/include/llvm/InitializePasses.h > > +++ b/include/llvm/InitializePasses.h > > > @@ -197,6 +197,7 @@ void initializeSROA_DFPass(PassRegistry&); > > void initializeSROA_SSAUpPass(PassRegistry&); > > void initializeScalarEvolutionAliasAnalysisPass(PassRegistry&); > > void initializeScalarEvolutionPass(PassRegistry&); > > > +void initializeSeSeRegionInfoPass(PassRegistry&); > > void initializeSimpleInlinerPass(PassRegistry&); > > void initializeSimpleRegisterCoalescingPass(PassRegistry&); > > void initializeSimplifyHalfPowrLibCallsPass(PassRegistry&); > > > diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h > > index 7dd8ebd..bb7a68a 100644 > > --- a/include/llvm/LinkAllPasses.h > > +++ b/include/llvm/LinkAllPasses.h > > @@ -115,6 +115,7 @@ namespace { > > > (void) llvm::createRegionViewerPass(); > > (void) llvm::createSCCPPass(); > > (void) llvm::createScalarReplAggregatesPass(); > > + (void) llvm::createSeSeRegionInfoPass(); > > > (void) llvm::createSimplifyLibCallsPass(); > > (void) llvm::createSimplifyHalfPowrLibCallsPass(); > > (void) llvm::createSingleLoopExtractorPass(); > > diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h > > > index 9a87eab..6c63eb8 100644 > > --- a/include/llvm/Transforms/Scalar.h > > +++ b/include/llvm/Transforms/Scalar.h > > @@ -349,6 +349,12 @@ Pass *createCorrelatedValuePropagationPass(); > > FunctionPass *createInstructionSimplifierPass(); > > > extern char&InstructionSimplifierID; > > > > +//===----------------------------------------------------------------------===// > > +// > > +// SeSeRegionInfo - Convert refined regions to simple regions. > > > +// > > +Pass *createSeSeRegionInfoPass(); > > + > > } // End llvm namespace > > > > #endif > > diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt > > > index 106fb8f..836c22c 100644 > > --- a/lib/Transforms/Scalar/CMakeLists.txt > > +++ b/lib/Transforms/Scalar/CMakeLists.txt > > @@ -26,6 +26,7 @@ add_llvm_library(LLVMScalarOpts > > SCCP.cpp > > Scalar.cpp > > > ScalarReplAggregates.cpp > > + SeSeRegionInfo.cpp > > SimplifyCFGPass.cpp > > SimplifyHalfPowrLibCalls.cpp > > SimplifyLibCalls.cpp > > diff --git a/lib/Transforms/Scalar/Scalar.cpp b/lib/Transforms/Scalar/Scalar.cpp > > > index 1d0ca7d..7ab83b9 100644 > > --- a/lib/Transforms/Scalar/Scalar.cpp > > +++ b/lib/Transforms/Scalar/Scalar.cpp > > @@ -53,6 +53,7 @@ void llvm::initializeScalarOpts(PassRegistry&Registry) { > > initializeRegToMemPass(Registry); > > > initializeSCCPPass(Registry); > > initializeIPSCCPPass(Registry); > > + initializeSeSeRegionInfoPass(Registry); > > initializeSROA_DFPass(Registry); > > initializeSROA_SSAUpPass(Registry); > > > initializeCFGSimplifyPassPass(Registry); > > diff --git a/lib/Transforms/Scalar/SeSeRegionInfo.cpp b/lib/Transforms/Scalar/SeSeRegionInfo.cpp > > new file mode 100644 > > index 0000000..6005e64 > > --- /dev/null > > > +++ b/lib/Transforms/Scalar/SeSeRegionInfo.cpp > > @@ -0,0 +1,167 @@ > > +//===- SeSeRegionInfo.cpp -------------------------------------------------===// > > +// > > +// The LLVM Compiler Infrastructure > > > +// > > +// This file is distributed under the University of Illinois Open Source > > +// License. See LICENSE.TXT for details. > > +// > > +//===----------------------------------------------------------------------===// > > > +// > > +// This file converts refined regions detected by the RegionInfo analysis > > +// into simple regions. > > +// > > +//===----------------------------------------------------------------------===// > > > + > > +#include "llvm/Instructions.h" > > +#include "llvm/ADT/Statistic.h" > > +#include "llvm/Analysis/RegionPass.h" > > +#include "llvm/Analysis/RegionInfo.h" > > > +#include "llvm/Transforms/Utils/BasicBlockUtils.h" > > + > > +#define DEBUG_TYPE "sese-regions" > > + > > +using namespace llvm; > > + > > +STATISTIC(NumEntries, "The # of created entry edges"); > > > +STATISTIC(NumExits, "The # of created exit edges"); > > + > > +namespace { > > + class SeSeRegionInfo : public RegionPass { > > + bool modified; > > + Region *CR; > > + BasicBlock *createSingleEntryEdge(Region *R); > > > + BasicBlock *createSingleExitEdge(Region *R); > > + public: > > + static char ID; > > + explicit SeSeRegionInfo() : RegionPass(ID) { > > + initializeSeSeRegionInfoPass(*PassRegistry::getPassRegistry()); > > > + } > > + > > + virtual void print(raw_ostream&O, const Module *M) const; > > + > > + virtual bool runOnRegion(Region *R, RGPassManager&RGM); > > + virtual void getAnalysisUsage(AnalysisUsage&AU) const; > > > + }; > > +} > > + > > +INITIALIZE_PASS(SeSeRegionInfo, "sese-regions", > I believe sese is difficult to understand. Can we use simple-regions for > this? > > > + "Transform refined regions into simple regions", false, false) > > > + > > +char SeSeRegionInfo::ID = 0; > > +namespace llvm { > > + Pass *createSeSeRegionInfoPass() { > > + return new SeSeRegionInfo(); > > + } > > +} > > + > > +void SeSeRegionInfo::print(raw_ostream&O, const Module *M) const { > > > + BasicBlock *enteringBlock; > > + BasicBlock *exitingBlock; > > + > > + if (modified) { > > + enteringBlock = CR->getEnteringBlock(); > > + exitingBlock = CR->getExitingBlock(); > > > + > > + O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n"; > > + if (enteringBlock) > > + O<< " Entry: ]" > > +<< enteringBlock->getNameStr() > > > +<< " => " > > +<< enteringBlock->getNameStr()<< "]\n"; > > + if (exitingBlock) > > + O<< " Exit: [" > > +<< exitingBlock->getNameStr() > > > +<< " => " > > +<< exitingBlock->getNameStr()<< "[\n"; > > + > > + O<< "\n"; > > + } > > +} > > + > > +void SeSeRegionInfo::getAnalysisUsage(AnalysisUsage&AU) const { > > > + AU.setPreservesAll(); > Is this correct? > > > > > + AU.addRequired(); > > +} > > + > > +// createSingleEntryEdge - Split the entry BasicBlock of the given > > +// region after the last PHINode to form a single entry edge. > > +// This does not update RegionInfo analysis. > > > +BasicBlock *SeSeRegionInfo::createSingleEntryEdge(Region *R) { > > + BasicBlock *BB = R->getEntry(); > > + BasicBlock::iterator SplitIt = BB->begin(); > > + > > + while (isa(SplitIt)) > > > + ++SplitIt; > > + > > + BasicBlock *newBB = SplitBlock(BB, SplitIt, this); > > > + > > + for (BasicBlock::iterator PI = BB->begin(); isa(PI); ++PI) { > > + PHINode *PN = cast(PI); > > + PHINode *NPN = > > + PHINode::Create(PN->getType(), PN->getName()+".ph", newBB->begin()); > > > + > > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) { > > + if (R->contains(*PI)) { > > + Value *V = PN->removeIncomingValue(*PI, false); > > + NPN->addIncoming(V, *PI); > > > + } > > + } > You can get rid of a set of parenthesis. > > > + PN->replaceAllUsesWith(NPN); > > + NPN->addIncoming(PN,BB); > > + } > > + > > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) > > > + if (R->contains(*PI)) > > + (*PI)->getTerminator()->replaceUsesOfWith(BB, newBB); > > + > > + return newBB; > > +} > > + > > +// createSingleExitEdge - Split the exit BasicBlock of the given region > > > +// to form a single exit edge. > > +// This does not update RegionInfo analysis. > > +BasicBlock *SeSeRegionInfo::createSingleExitEdge(Region *R) { > > + BasicBlock *BB = R->getExit(); > > + > > + SmallVector Preds; > > > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) > > + if (R->contains(*PI)) > > + Preds.push_back(*PI); > > + > > + return SplitBlockPredecessors(BB, Preds.data(), Preds.size(), ".region", this); > > > +} > > + > > +bool SeSeRegionInfo::runOnRegion(Region *R, RGPassManager&RGM) { > > + RegionInfo *RI =&getAnalysis(); > > + modified = false; > > + > > + CR = R; > > > + if (!R->isTopLevelRegion()) { > > + BasicBlock *nBB; > > + BasicBlock *oBB; > Can you use more descriptive variable names? > > > + > > + BasicBlock *enteringBlock = R->getEnteringBlock(); > > > + if (!enteringBlock) { > You can probably move the R->getEnteringBlock() into the if condition. > enteringBlock is not used anywhere else. > > > + oBB = R->getEntry(); > > + nBB = createSingleEntryEdge(R); > > > + > > + RI->splitBlock(nBB, oBB); > > + > > + modified |= true; > > + ++NumEntries; > > + } > > + > > + BasicBlock *exitingBlock = R->getExitingBlock(); > > + if (!exitingBlock) { > > Dito. > > > + oBB = R->getExit(); > > + nBB = createSingleExitEdge(R); > > + > > + RI->splitBlock(nBB, oBB); > > + > > + modified |= true; > > + ++NumExits; > > > + } > > + } > > + > > + return modified; > > +} > > -- 1.7.1 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110131/fd651dab/attachment.html From ofv at wanadoo.es Mon Jan 31 21:42:57 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Tue, 01 Feb 2011 04:42:57 +0100 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: (NAKAMURA Takumi's message of "Tue, 1 Feb 2011 12:05:18 +0900") References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> <8762t4h5np.fsf@wanadoo.es> Message-ID: <87wrlkfmim.fsf@wanadoo.es> NAKAMURA Takumi writes: > Eric and Oscar, > > I reformatted my patchset and attached, thank you. You still have: +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if + don't. */ +#cmakedefine HAVE_DECL_STRERROR_S ${HAVE_DECL_STRERROR_S} instead of +/* Define to 1 if you have the declaration of `strerror_s' */ The autoconf part tests for _alloca, __chkstk, etc when the target system is MinGW, while on the cmake part the checks are performed when LLVM_ON_WIN32 is true, which in practice means MinGW and VC++. I guess that those functions are used while compiling with VC++. As far as I'm concerned, once you fix the comment on config.h.cmake mentioned above the patch is ready for svn. From rafael.espindola at gmail.com Mon Jan 31 23:33:52 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 01 Feb 2011 05:33:52 -0000 Subject: [llvm-commits] [llvm] r124650 - in /llvm/trunk: lib/Linker/LinkModules.cpp test/Linker/available_externally_a.ll test/Linker/available_externally_b.ll Message-ID: <20110201053352.39AC02A6C12C@llvm.org> Author: rafael Date: Mon Jan 31 23:33:52 2011 New Revision: 124650 URL: http://llvm.org/viewvc/llvm-project?rev=124650&view=rev Log: Correctly merge available_externally and regular definitions when they have different visibilities. Added: llvm/trunk/test/Linker/available_externally_a.ll llvm/trunk/test/Linker/available_externally_b.ll Modified: llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=124650&r1=124649&r2=124650&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Jan 31 23:33:52 2011 @@ -434,8 +434,10 @@ } // Check visibility - if (Dest && Src->getVisibility() != Dest->getVisibility()) - if (!Src->isDeclaration() && !Dest->isDeclaration()) + if (Dest && Src->getVisibility() != Dest->getVisibility() && + !Src->isDeclaration() && !Dest->isDeclaration() && + !Src->hasAvailableExternallyLinkage() && + !Dest->hasAvailableExternallyLinkage()) return Error(Err, "Linking globals named '" + Src->getName() + "': symbols have different visibilities!"); return false; Added: llvm/trunk/test/Linker/available_externally_a.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/available_externally_a.ll?rev=124650&view=auto ============================================================================== --- llvm/trunk/test/Linker/available_externally_a.ll (added) +++ llvm/trunk/test/Linker/available_externally_a.ll Mon Jan 31 23:33:52 2011 @@ -0,0 +1,5 @@ +; RUN: llvm-link %s %p/available_externally_b.ll -S -o - | FileCheck %s + + at foo = available_externally unnamed_addr constant i32 0 + +; CHECK: @foo = hidden unnamed_addr constant i32 0 Added: llvm/trunk/test/Linker/available_externally_b.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/available_externally_b.ll?rev=124650&view=auto ============================================================================== --- llvm/trunk/test/Linker/available_externally_b.ll (added) +++ llvm/trunk/test/Linker/available_externally_b.ll Mon Jan 31 23:33:52 2011 @@ -0,0 +1,4 @@ +; This file is for use with available_externally_a.ll +; RUN: true + + at foo = hidden unnamed_addr constant i32 0 From carl.norum at apple.com Tue Feb 1 01:38:42 2011 From: carl.norum at apple.com (Carl Norum) Date: Tue, 01 Feb 2011 07:38:42 -0000 Subject: [llvm-commits] [llvm] r124652 - /llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Message-ID: <20110201073842.66B6A2A6C12C@llvm.org> Author: carl Date: Tue Feb 1 01:38:42 2011 New Revision: 124652 URL: http://llvm.org/viewvc/llvm-project?rev=124652&view=rev Log: Test commit - fix a double 'should' in a comment. Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=124652&r1=124651&r2=124652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Tue Feb 1 01:38:42 2011 @@ -598,7 +598,7 @@ STI.isTargetWin64() && !STI.isTargetEnvMacho()) { // Sanity check that EAX is not livein for this function. It should - // should not be, so throw an assert. + // not be, so throw an assert. assert(!isEAXLiveIn(MF) && "EAX is livein in the Win64 case!"); // Handle the 64-bit Windows ABI case where we need to call __chkstk. From baldrick at free.fr Tue Feb 1 02:39:12 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Feb 2011 08:39:12 -0000 Subject: [llvm-commits] [llvm] r124655 - in /llvm/trunk: include/llvm/Constants.h include/llvm/Support/PatternMatch.h lib/Analysis/InstructionSimplify.cpp lib/VMCore/Constants.cpp test/Transforms/InstSimplify/2011-02-01-Vector.ll Message-ID: <20110201083912.E94312A6C12D@llvm.org> Author: baldrick Date: Tue Feb 1 02:39:12 2011 New Revision: 124655 URL: http://llvm.org/viewvc/llvm-project?rev=124655&view=rev Log: Have m_One also match constant vectors for which every element is 1. Added: llvm/trunk/test/Transforms/InstSimplify/2011-02-01-Vector.ll Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/lib/Analysis/InstructionSimplify.cpp llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=124655&r1=124654&r2=124655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Tue Feb 1 02:39:12 2011 @@ -500,7 +500,7 @@ /// getSplatValue - If this is a splat constant, meaning that all of the /// elements have the same value, return that value. Otherwise return NULL. - Constant *getSplatValue(); + Constant *getSplatValue() const; virtual void destroyConstant(); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=124655&r1=124654&r2=124655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Tue Feb 1 02:39:12 2011 @@ -90,13 +90,16 @@ struct one_ty { template bool match(ITy *V) { - if (const ConstantInt *C = dyn_cast(V)) - return C->isOne(); + if (const ConstantInt *CI = dyn_cast(V)) + return CI->isOne(); + if (const ConstantVector *CV = dyn_cast(V)) + if (ConstantInt *CI = cast_or_null(CV->getSplatValue())) + return CI->isOne(); return false; } }; -/// m_One() - Match an integer 1. +/// m_One() - Match an integer 1 or a vector with all elements equal to 1. inline one_ty m_One() { return one_ty(); } struct all_ones_ty { Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124655&r1=124654&r2=124655&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Tue Feb 1 02:39:12 2011 @@ -785,12 +785,6 @@ // X / 1 -> X if (match(Op1, m_One())) return Op0; - // Vector case. TODO: Have m_One match vectors. - if (ConstantVector *Op1V = dyn_cast(Op1)) { - if (ConstantInt *X = cast_or_null(Op1V->getSplatValue())) - if (X->isOne()) - return Op0; - } if (Op0->getType()->isIntegerTy(1)) // It can't be division by zero, hence it must be division by one. Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=124655&r1=124654&r2=124655&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Feb 1 02:39:12 2011 @@ -1033,7 +1033,7 @@ /// getSplatValue - If this is a splat constant, where all of the /// elements have the same value, return that value. Otherwise return null. -Constant *ConstantVector::getSplatValue() { +Constant *ConstantVector::getSplatValue() const { // Check out first element. Constant *Elt = getOperand(0); // Then make sure all remaining elements point to the same value. Added: llvm/trunk/test/Transforms/InstSimplify/2011-02-01-Vector.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/2011-02-01-Vector.ll?rev=124655&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstSimplify/2011-02-01-Vector.ll (added) +++ llvm/trunk/test/Transforms/InstSimplify/2011-02-01-Vector.ll Tue Feb 1 02:39:12 2011 @@ -0,0 +1,8 @@ +; RUN: opt < %s -instsimplify -S | FileCheck %s + +define <2 x i32> @sdiv(<2 x i32> %x) { +; CHECK: @sdiv + %div = sdiv <2 x i32> %x, + ret <2 x i32> %div +; CHECK: ret <2 x i32> %x +} From rdivacky at freebsd.org Tue Feb 1 02:45:18 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Tue, 1 Feb 2011 09:45:18 +0100 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp In-Reply-To: References: <20110131211943.AF2ED2A6C12C@llvm.org> Message-ID: <20110201084518.GA67675@freebsd.org> On Mon, Jan 31, 2011 at 01:52:22PM -0800, Chris Lattner wrote: > > On Jan 31, 2011, at 1:19 PM, Roman Divacky wrote: > > > Author: rdivacky > > Date: Mon Jan 31 15:19:43 2011 > > New Revision: 124608 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=124608&view=rev > > Log: > > > > Enumerate .code16/32/64 instead of checking .code prefix. This > > unbreaks some ARM tests. > > .code32 should be accepted when already in 32-bit mode, similarly for .code64. yes, but usually you specify one of that directives when you want to switch to a non default mode or you already did and you want to switch back. the parsing will stop on the first switch so the second one wont be reached. I hope support for .code{16,32,64} will be contributed soon so this will go away completely :) roman From baldrick at free.fr Tue Feb 1 02:50:33 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Feb 2011 08:50:33 -0000 Subject: [llvm-commits] [llvm] r124656 - in /llvm/trunk: include/llvm/Support/PatternMatch.h lib/Analysis/ValueTracking.cpp Message-ID: <20110201085033.65F832A6C12D@llvm.org> Author: baldrick Date: Tue Feb 1 02:50:33 2011 New Revision: 124656 URL: http://llvm.org/viewvc/llvm-project?rev=124656&view=rev Log: Add a m_SignBit pattern for convenience. Modified: llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=124656&r1=124655&r2=124656&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Tue Feb 1 02:50:33 2011 @@ -116,6 +116,21 @@ /// m_AllOnes() - Match an integer or vector with all bits set to true. inline all_ones_ty m_AllOnes() { return all_ones_ty(); } +struct signbit_ty { + template + bool match(ITy *V) { + if (const ConstantInt *CI = dyn_cast(V)) + return CI->getValue().isSignBit(); + if (const ConstantVector *CV = dyn_cast(V)) + if (ConstantInt *CI = cast_or_null(CV->getSplatValue())) + return CI->getValue().isSignBit(); + return false; + } +}; + +/// m_SignBit() - Match an integer or vector with only the sign bit(s) set. +inline signbit_ty m_SignBit() { return signbit_ty(); } + template struct bind_ty { Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=124656&r1=124655&r2=124656&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Feb 1 02:50:33 2011 @@ -666,9 +666,7 @@ // (signbit) >>l X is clearly a power of two if the one is not shifted off the // bottom. If it is shifted off the bottom then the result is undefined. - ConstantInt *CI; - if (match(V, m_LShr(m_ConstantInt(CI), m_Value())) && - CI->getValue().isSignBit()) + if (match(V, m_LShr(m_SignBit(), m_Value()))) return true; // The remaining tests are all recursive, so bail out if we hit the limit. From baldrick at free.fr Tue Feb 1 03:06:21 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Feb 2011 09:06:21 -0000 Subject: [llvm-commits] [llvm] r124657 - in /llvm/trunk: include/llvm/Support/PatternMatch.h lib/Analysis/InstructionSimplify.cpp Message-ID: <20110201090621.3594E2A6C12D@llvm.org> Author: baldrick Date: Tue Feb 1 03:06:20 2011 New Revision: 124657 URL: http://llvm.org/viewvc/llvm-project?rev=124657&view=rev Log: Add a m_Undef pattern for convenience. This is so that code that uses pattern matching can also pattern match undef, creating a more uniform style. Modified: llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/lib/Analysis/InstructionSimplify.cpp Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=124657&r1=124656&r2=124657&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Tue Feb 1 03:06:20 2011 @@ -75,6 +75,16 @@ return constantint_ty(); } +struct undef_ty { + template + bool match(ITy *V) { + return isa(V); + } +}; + +/// m_Undef() - Match an arbitrary undef constant. +inline undef_ty m_Undef() { return undef_ty(); } + struct zero_ty { template bool match(ITy *V) { Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124657&r1=124656&r2=124657&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Tue Feb 1 03:06:20 2011 @@ -510,7 +510,7 @@ } // X + undef -> undef - if (isa(Op1)) + if (match(Op1, m_Undef())) return Op1; // X + 0 -> X @@ -576,7 +576,7 @@ // X - undef -> undef // undef - X -> undef - if (isa(Op0) || isa(Op1)) + if (match(Op0, m_Undef()) || match(Op1, m_Undef())) return UndefValue::get(Op0->getType()); // X - 0 -> X @@ -699,7 +699,7 @@ } // X * undef -> 0 - if (isa(Op1)) + if (match(Op1, m_Undef())) return Constant::getNullValue(Op0->getType()); // X * 0 -> 0 @@ -771,11 +771,11 @@ bool isSigned = Opcode == Instruction::SDiv; // X / undef -> undef - if (isa(Op1)) + if (match(Op1, m_Undef())) return Op1; // undef / X -> 0 - if (isa(Op0)) + if (match(Op0, m_Undef())) return Constant::getNullValue(Op0->getType()); // 0 / X -> 0, we don't need to preserve faults! @@ -859,14 +859,14 @@ return ::SimplifyUDivInst(Op0, Op1, TD, DT, RecursionLimit); } -static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD, - const DominatorTree *DT, unsigned MaxRecurse) { +static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *, + const DominatorTree *, unsigned) { // undef / X -> undef (the undef could be a snan). - if (isa(Op0)) + if (match(Op0, m_Undef())) return Op0; // X / undef -> undef - if (isa(Op1)) + if (match(Op1, m_Undef())) return Op1; return 0; @@ -898,7 +898,7 @@ return Op0; // X shift by undef -> undef because it may shift by the bitwidth. - if (isa(Op1)) + if (match(Op1, m_Undef())) return Op1; // Shifting by the bitwidth or more is undefined. @@ -930,7 +930,7 @@ return V; // undef << X -> 0 - if (isa(Op0)) + if (match(Op0, m_Undef())) return Constant::getNullValue(Op0->getType()); return 0; @@ -949,7 +949,7 @@ return V; // undef >>l X -> 0 - if (isa(Op0)) + if (match(Op0, m_Undef())) return Constant::getNullValue(Op0->getType()); return 0; @@ -972,7 +972,7 @@ return Op0; // undef >>a X -> all ones - if (isa(Op0)) + if (match(Op0, m_Undef())) return Constant::getAllOnesValue(Op0->getType()); return 0; @@ -999,7 +999,7 @@ } // X & undef -> 0 - if (isa(Op1)) + if (match(Op1, m_Undef())) return Constant::getNullValue(Op0->getType()); // X & X = X @@ -1088,7 +1088,7 @@ } // X | undef -> -1 - if (isa(Op1)) + if (match(Op1, m_Undef())) return Constant::getAllOnesValue(Op0->getType()); // X | X = X @@ -1172,7 +1172,7 @@ } // A ^ undef -> undef - if (isa(Op1)) + if (match(Op1, m_Undef())) return Op1; // A ^ 0 = A From jay.foad at gmail.com Tue Feb 1 03:22:34 2011 From: jay.foad at gmail.com (Jay Foad) Date: Tue, 01 Feb 2011 09:22:34 -0000 Subject: [llvm-commits] [llvm] r124659 - in /llvm/trunk: include/llvm/Instructions.h lib/VMCore/Instructions.cpp Message-ID: <20110201092234.830CF2A6C12D@llvm.org> Author: foad Date: Tue Feb 1 03:22:34 2011 New Revision: 124659 URL: http://llvm.org/viewvc/llvm-project?rev=124659&view=rev Log: Make SwitchInst::removeCase() more efficient. Modified: llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=124659&r1=124658&r2=124659&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Tue Feb 1 03:22:34 2011 @@ -2247,7 +2247,8 @@ /// removeCase - This method removes the specified successor from the switch /// instruction. Note that this cannot be used to remove the default - /// destination (successor #0). + /// destination (successor #0). Also note that this operation may reorder the + /// remaining cases at index idx and above. /// void removeCase(unsigned idx); Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=124659&r1=124658&r2=124659&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Feb 1 03:22:34 2011 @@ -3009,14 +3009,10 @@ unsigned NumOps = getNumOperands(); Use *OL = OperandList; - // Move everything after this operand down. - // - // FIXME: we could just swap with the end of the list, then erase. However, - // client might not expect this to happen. The code as it is thrashes the - // use/def lists, which is kinda lame. - for (unsigned i = (idx+1)*2; i != NumOps; i += 2) { - OL[i-2] = OL[i]; - OL[i-2+1] = OL[i+1]; + // Overwrite this case with the end of the list. + if ((idx + 1) * 2 != NumOps) { + OL[idx * 2] = OL[NumOps - 2]; + OL[idx * 2 + 1] = OL[NumOps - 1]; } // Nuke the last value. From rafael.espindola at gmail.com Tue Feb 1 07:33:21 2011 From: rafael.espindola at gmail.com (=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?=) Date: Tue, 01 Feb 2011 08:33:21 -0500 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp In-Reply-To: <20110201084518.GA67675@freebsd.org> References: <20110131211943.AF2ED2A6C12C@llvm.org> <20110201084518.GA67675@freebsd.org> Message-ID: <4D480BA1.5080707@gmail.com> > I hope support for .code{16,32,64} will be contributed soon so this will > go away completely :) This is one bug I think will take some time to fix. If I am not mistaken, the correct way to solve it is to avoid the MC -> Codegen dependencies. It might also be possible to solve it with some hack like having two codegens and switching between them. > roman Cheers, Rafael From dpatel at apple.com Tue Feb 1 11:22:12 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Feb 2011 17:22:12 -0000 Subject: [llvm-commits] [llvm] r124664 - /llvm/trunk/docs/SourceLevelDebugging.html Message-ID: <20110201172212.8FE3B2A6C12C@llvm.org> Author: dpatel Date: Tue Feb 1 11:22:12 2011 New Revision: 124664 URL: http://llvm.org/viewvc/llvm-project?rev=124664&view=rev Log: Remove stale references of obsolete @llvm.dbg.variable. Modified: llvm/trunk/docs/SourceLevelDebugging.html Modified: llvm/trunk/docs/SourceLevelDebugging.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/SourceLevelDebugging.html?rev=124664&r1=124663&r2=124664&view=diff ============================================================================== --- llvm/trunk/docs/SourceLevelDebugging.html (original) +++ llvm/trunk/docs/SourceLevelDebugging.html Tue Feb 1 11:22:12 2011 @@ -796,10 +796,7 @@

This intrinsic provides information about a local element (ex. variable.) The first argument is metadata holding alloca for the variable.. The - second argument is - the %llvm.dbg.variable containing - the description of the variable.

- + second argument is metadata containing description of the variable.

@@ -815,10 +812,8 @@

This intrinsic provides information when a user source variable is set to a new value. The first argument is the new value (wrapped as metadata). The second argument is the offset in the user source variable where the new value - is written. The third argument is - the %llvm.dbg.variable containing - the description of the user source variable.

- + is written. The third argument is metadata containing description of the + user source variable.

From carl.norum at apple.com Tue Feb 1 11:26:17 2011 From: carl.norum at apple.com (Carl Norum) Date: Tue, 1 Feb 2011 09:26:17 -0800 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp In-Reply-To: <4D480BA1.5080707@gmail.com> References: <20110131211943.AF2ED2A6C12C@llvm.org> <20110201084518.GA67675@freebsd.org> <4D480BA1.5080707@gmail.com> Message-ID: <63075FAB-2816-41F7-AEAD-66A29B9D275B@apple.com> On Feb 1, 2011, at 5:33 AM, Rafael ?vila de Esp?ndola wrote: >> I hope support for .code{16,32,64} will be contributed soon so this will >> go away completely :) > > This is one bug I think will take some time to fix. If I am not > mistaken, the correct way to solve it is to avoid the MC -> Codegen > dependencies. It might also be possible to solve it with some hack like > having two codegens and switching between them. I, too, would love to have these directives working. They're the only major outstanding bug that prevents us from using llvm as the assembler for EFI. For now, gcc is doing fine, but consolidating everything with one tool is the ultimate goal. In the short term I have to go work on bringing up some new machines, but I'll try to look at this problem sometime in the future (that is, if by the time I get to it it hasn't already been done...) -- Carl From aggarwa4 at illinois.edu Tue Feb 1 11:41:46 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Tue, 01 Feb 2011 17:41:46 -0000 Subject: [llvm-commits] [poolalloc] r124665 - in /poolalloc/trunk/lib/DSA: DataStructureStats.cpp Steensgaard.cpp Message-ID: <20110201174146.302092A6C12C@llvm.org> Author: aggarwa4 Date: Tue Feb 1 11:41:46 2011 New Revision: 124665 URL: http://llvm.org/viewvc/llvm-project?rev=124665&view=rev Log: Steensgaard: Just some cleanup. This code is not maintained. DataStructureStats: Cleanup. Make sure we count the nodes correctly and only in one category. Modified: poolalloc/trunk/lib/DSA/DataStructureStats.cpp poolalloc/trunk/lib/DSA/Steensgaard.cpp Modified: poolalloc/trunk/lib/DSA/DataStructureStats.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureStats.cpp?rev=124665&r1=124664&r2=124665&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructureStats.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructureStats.cpp Tue Feb 1 11:41:46 2011 @@ -27,7 +27,6 @@ namespace { STATISTIC (TotalNumCallees, "Total number of callee functions at all indirect call sites"); STATISTIC (NumIndirectCalls, "Total number of indirect call sites in the program"); - // STATISTIC (NumPoolNodes, "Number of allocation nodes that could be pool allocated"); // Typed/Untyped memory accesses: If DSA can infer that the types the loads // and stores are accessing are correct (ie, the node has not been collapsed), @@ -102,6 +101,7 @@ void DSGraphStats::countCallees(const Function& F) { + //FIXME:Use callgraph unsigned numIndirectCalls = 0, totalNumCallees = 0; for (DSGraph::fc_iterator I = TDGraph->fc_begin(), E = TDGraph->fc_end(); @@ -155,16 +155,17 @@ DSNode* N = NH.getNode(); if (N->isNodeCompletelyFolded()) return true; - if ( N->isIncompleteNode()){ - ++NumIncompleteAccesses; - return true; - } if ( N->isExternalNode()){ ++NumExternalAccesses; return true; } + if ( N->isIncompleteNode()){ + ++NumIncompleteAccesses; + return true; + } if (N->isUnknownNode()){ ++NumUnknownAccesses; + return true; } // it is a complete node, now check how many types are present int count = 0; Modified: poolalloc/trunk/lib/DSA/Steensgaard.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Steensgaard.cpp?rev=124665&r1=124664&r2=124665&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Steensgaard.cpp (original) +++ poolalloc/trunk/lib/DSA/Steensgaard.cpp Tue Feb 1 11:41:46 2011 @@ -28,7 +28,8 @@ void SteensgaardDataStructures::releaseMemory() { - delete ResultGraph; ResultGraph = 0; + delete ResultGraph; + ResultGraph = 0; DataStructures::releaseMemory(); } @@ -73,8 +74,8 @@ } ResultGraph->removeTriviallyDeadNodes(); - - // FIXME: Must recalculate and use the Incomplete markers!! + ResultGraph->maskIncompleteMarkers(); + ResultGraph->markIncompleteNodes(DSGraph::MarkFormalArgs | DSGraph::IgnoreGlobals); // Now that we have all of the graphs inlined, we can go about eliminating // call nodes... @@ -125,7 +126,6 @@ // Update the "incomplete" markers on the nodes, ignoring unknownness due to // incoming arguments... ResultGraph->maskIncompleteMarkers(); - ResultGraph->markIncompleteNodes(DSGraph::MarkFormalArgs | DSGraph::IgnoreGlobals); // Remove any nodes that are dead after all of the merging we have done... @@ -141,16 +141,10 @@ formGlobalECs(); // Clone the global nodes into this graph. - ReachabilityCloner RC(ResultGraph, GlobalsGraph, - DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); - for (DSScalarMap::global_iterator I = GlobalsGraph->getScalarMap().global_begin(), - E = GlobalsGraph->getScalarMap().global_end(); I != E; ++I) - if (isa(*I)) - RC.getClonedNH(GlobalsGraph->getNodeForValue(*I)); - + cloneGlobalsInto(ResultGraph, DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); - print(errs(), &M); + DEBUG(print(errs(), &M)); return false; } From gkistanova at gmail.com Tue Feb 1 12:34:33 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Tue, 01 Feb 2011 18:34:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r124669 - /llvm-gcc-4.2/trunk/extras/build-4-mingw32 Message-ID: <20110201183433.193F12A6C12C@llvm.org> Author: gkistanova Date: Tue Feb 1 12:34:32 2011 New Revision: 124669 URL: http://llvm.org/viewvc/llvm-project?rev=124669&view=rev Log: Some code and environment cleaning. Modified: llvm-gcc-4.2/trunk/extras/build-4-mingw32 Modified: llvm-gcc-4.2/trunk/extras/build-4-mingw32 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/build-4-mingw32?rev=124669&r1=124668&r2=124669&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/build-4-mingw32 (original) +++ llvm-gcc-4.2/trunk/extras/build-4-mingw32 Tue Feb 1 12:34:32 2011 @@ -35,6 +35,9 @@ unset CFLAGS unset CXXFLAGS +export PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin +export PATH=$PATH:/mingw_build_tools/install_with_gcc/bin + BUILD_ROOT=$PWD # Where build happens. PRIVATE_INSTALL=${BUILD_ROOT}/${INSTALL} # Where the result will be installed. @@ -46,7 +49,6 @@ do_clean=no # Clean up the build directory. do_configure_llvm=no # Configure LLVM. do_make_llvm=no # Make LLVM. -do_test_llvm=no # Test LLVM. do_configure_llvmgcc=no # Configure LLVM-GCC. do_make_llvmgcc=no # Make LLVM-GCC. do_install_llvmgcc=no # Install LLVM-GCC. @@ -63,7 +65,6 @@ clean | \ configure_llvm | \ make_llvm | \ - test_llvm | \ configure_llvmgcc | \ make_llvmgcc | \ install_llvmgcc | \ @@ -83,7 +84,6 @@ do_clean=yes do_configure_llvm=yes do_make_llvm=yes - do_test_llvm=yes do_configure_llvmgcc=yes do_make_llvmgcc=yes do_install_llvmgcc=yes @@ -132,17 +132,6 @@ fi #------------------------------------------------------------------------------ -# Step: Test LLVM. -#------------------------------------------------------------------------------ -if [ "$do_test_llvm" == "yes" ] ; then - - cd ${BUILD_ROOT}/${LLVM_obj} - make check-lit VERBOSE=1 \ - $@ # Extra args if any, like -j16 for example. - -fi - -#------------------------------------------------------------------------------ # Step: Configure LLVM-GCC. #------------------------------------------------------------------------------ if [ "$do_configure_llvmgcc" == "yes" ] ; then From vmle at ucdavis.edu Tue Feb 1 13:03:23 2011 From: vmle at ucdavis.edu (Vu Le) Date: Tue, 1 Feb 2011 11:03:23 -0800 Subject: [llvm-commits] Patch for simplifying regions Message-ID: Hi Tobias, Andreas, This is my patch for regionsimplify pass. I rename the file to RegionSimplify, change the pass name to -regionsimplify to conform with those of Loop. I also update the RegionInfo and DominatorTree whenever we split the entry or exit. Please give me the feedbacks. Thanks. Vu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/72f02b71/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: region-simplify.patch Type: text/x-patch Size: 9846 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/72f02b71/attachment.bin From greened at obbligato.org Tue Feb 1 13:12:32 2011 From: greened at obbligato.org (David Greene) Date: Tue, 01 Feb 2011 19:12:32 -0000 Subject: [llvm-commits] [llvm] r124672 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Message-ID: <20110201191232.E7F842A6C12C@llvm.org> Author: greened Date: Tue Feb 1 13:12:32 2011 New Revision: 124672 URL: http://llvm.org/viewvc/llvm-project?rev=124672&view=rev Log: [AVX] Implement EnforceSmallerThan for mixed int/fp type lists. This makes type checking for extract_subvector and insert_subvector more robust and will allow stricter typechecking of more patterns in the future. This change handles int and fp as disjoint sets so that it will enforce integer types to be smaller than the largest integer type and fp types to be smaller than the largest fp type. There is no attempt to check type sizes across the int/fp sets. Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=124672&r1=124671&r2=124672&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Feb 1 13:12:32 2011 @@ -344,52 +344,155 @@ if (!hasVectorTypes()) MadeChange |= EnforceScalar(TP); - // This code does not currently handle nodes which have multiple types, - // where some types are integer, and some are fp. Assert that this is not - // the case. - assert(!(hasIntegerTypes() && hasFloatingPointTypes()) && - !(Other.hasIntegerTypes() && Other.hasFloatingPointTypes()) && - "SDTCisOpSmallerThanOp does not handle mixed int/fp types!"); + if (TypeVec.size() == 1 && Other.TypeVec.size() == 1) { + // If we are down to concrete types, this code does not currently + // handle nodes which have multiple types, where some types are + // integer, and some are fp. Assert that this is not the case. + assert(!(hasIntegerTypes() && hasFloatingPointTypes()) && + !(Other.hasIntegerTypes() && Other.hasFloatingPointTypes()) && + "SDTCisOpSmallerThanOp does not handle mixed int/fp types!"); + + // Otherwise, if these are both vector types, either this vector + // must have a larger bitsize than the other, or this element type + // must be larger than the other. + EVT Type(TypeVec[0]); + EVT OtherType(Other.TypeVec[0]); + + if (hasVectorTypes() && Other.hasVectorTypes()) { + if (Type.getSizeInBits() >= OtherType.getSizeInBits()) + if (Type.getVectorElementType().getSizeInBits() + >= OtherType.getVectorElementType().getSizeInBits()) + TP.error("Type inference contradiction found, '" + + getName() + "' element type not smaller than '" + + Other.getName() +"'!"); + } + else + // For scalar types, the bitsize of this type must be larger + // than that of the other. + if (Type.getSizeInBits() >= OtherType.getSizeInBits()) + TP.error("Type inference contradiction found, '" + + getName() + "' is not smaller than '" + + Other.getName() +"'!"); + + } + + + // Handle int and fp as disjoint sets. This won't work for patterns + // that have mixed fp/int types but those are likely rare and would + // not have been accepted by this code previously. // Okay, find the smallest type from the current set and remove it from the // largest set. - MVT::SimpleValueType Smallest = TypeVec[0]; + MVT::SimpleValueType SmallestInt; + for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) + if (isInteger(TypeVec[i])) { + SmallestInt = TypeVec[i]; + break; + } + for (unsigned i = 1, e = TypeVec.size(); i != e; ++i) + if (isInteger(TypeVec[i]) && TypeVec[i] < SmallestInt) + SmallestInt = TypeVec[i]; + + MVT::SimpleValueType SmallestFP; + for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) + if (isFloatingPoint(TypeVec[i])) { + SmallestFP = TypeVec[i]; + break; + } for (unsigned i = 1, e = TypeVec.size(); i != e; ++i) - if (TypeVec[i] < Smallest) - Smallest = TypeVec[i]; + if (isFloatingPoint(TypeVec[i]) && TypeVec[i] < SmallestFP) + SmallestFP = TypeVec[i]; + + int OtherIntSize = 0; + int OtherFPSize = 0; + for (SmallVector::iterator TVI = + Other.TypeVec.begin(); + TVI != Other.TypeVec.end(); + /* NULL */) { + if (isInteger(*TVI)) { + ++OtherIntSize; + if (*TVI == SmallestInt) { + TVI = Other.TypeVec.erase(TVI); + --OtherIntSize; + MadeChange = true; + continue; + } + } + else if (isFloatingPoint(*TVI)) { + ++OtherFPSize; + if (*TVI == SmallestFP) { + TVI = Other.TypeVec.erase(TVI); + --OtherFPSize; + MadeChange = true; + continue; + } + } + ++TVI; + } // If this is the only type in the large set, the constraint can never be // satisfied. - if (Other.TypeVec.size() == 1 && Other.TypeVec[0] == Smallest) + if ((Other.hasIntegerTypes() && OtherIntSize == 0) + || (Other.hasFloatingPointTypes() && OtherFPSize == 0)) TP.error("Type inference contradiction found, '" + Other.getName() + "' has nothing larger than '" + getName() +"'!"); - SmallVector::iterator TVI = - std::find(Other.TypeVec.begin(), Other.TypeVec.end(), Smallest); - if (TVI != Other.TypeVec.end()) { - Other.TypeVec.erase(TVI); - MadeChange = true; - } - // Okay, find the largest type in the Other set and remove it from the // current set. - MVT::SimpleValueType Largest = Other.TypeVec[0]; + MVT::SimpleValueType LargestInt = Other.TypeVec[0]; + for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) + if (isInteger(Other.TypeVec[i])) { + LargestInt = Other.TypeVec[i]; + break; + } + for (unsigned i = 1, e = Other.TypeVec.size(); i != e; ++i) + if (isInteger(Other.TypeVec[i]) && Other.TypeVec[i] > LargestInt) + LargestInt = Other.TypeVec[i]; + + MVT::SimpleValueType LargestFP; + for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) + if (isFloatingPoint(Other.TypeVec[i])) { + LargestFP = Other.TypeVec[i]; + break; + } for (unsigned i = 1, e = Other.TypeVec.size(); i != e; ++i) - if (Other.TypeVec[i] > Largest) - Largest = Other.TypeVec[i]; + if (isFloatingPoint(Other.TypeVec[i]) && Other.TypeVec[i] > LargestFP) + LargestFP = Other.TypeVec[i]; + + int IntSize = 0; + int FPSize = 0; + for (SmallVector::iterator TVI = + TypeVec.begin(); + TVI != TypeVec.end(); + /* NULL */) { + if (isInteger(*TVI)) { + ++IntSize; + if (*TVI == LargestInt) { + TVI = TypeVec.erase(TVI); + --IntSize; + MadeChange = true; + continue; + } + } + else if (isFloatingPoint(*TVI)) { + ++FPSize; + if (*TVI == LargestFP) { + TVI = TypeVec.erase(TVI); + --FPSize; + MadeChange = true; + continue; + } + } + ++TVI; + } // If this is the only type in the small set, the constraint can never be // satisfied. - if (TypeVec.size() == 1 && TypeVec[0] == Largest) + if ((hasIntegerTypes() && IntSize == 0) + || (hasFloatingPointTypes() && FPSize == 0)) TP.error("Type inference contradiction found, '" + getName() + "' has nothing smaller than '" + Other.getName()+"'!"); - TVI = std::find(TypeVec.begin(), TypeVec.end(), Largest); - if (TVI != TypeVec.end()) { - TypeVec.erase(TVI); - MadeChange = true; - } - return MadeChange; } From wendling at apple.com Tue Feb 1 13:16:10 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 1 Feb 2011 11:16:10 -0800 Subject: [llvm-commits] [llvm] r124350 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <20110127023927.CE2C72A6C12C@llvm.org> References: <20110127023927.CE2C72A6C12C@llvm.org> Message-ID: On Jan 26, 2011, at 6:39 PM, Matt Beaumont-Gay wrote: > Author: matthewbg > Date: Wed Jan 26 20:39:27 2011 > New Revision: 124350 > > URL: http://llvm.org/viewvc/llvm-project?rev=124350&view=rev > Log: > Try harder to not have unused variables. > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=124350&r1=124349&r2=124350&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 26 20:39:27 2011 > @@ -2875,6 +2875,7 @@ > "Extract subvector must be from larger vector to smaller vector!"); > > if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { > + (void)CSD; Why not use "isa<>" here and "cast<>" in the assert? -bw > assert((VT.getVectorNumElements() + CSD->getZExtValue() > <= N1.getValueType().getVectorNumElements()) > && "Extract subvector overflow!"); > @@ -3093,6 +3094,7 @@ > assert(N2.getValueType().getSimpleVT() <= N1.getValueType().getSimpleVT() && > "Insert subvector must be from smaller vector to larger vector!"); > if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { > + (void)CSD; > assert((N2.getValueType().getVectorNumElements() + CSD->getZExtValue() > <= VT.getVectorNumElements()) > && "Insert subvector overflow!"); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From asl at math.spbu.ru Tue Feb 1 14:08:28 2011 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 01 Feb 2011 20:08:28 -0000 Subject: [llvm-commits] [llvm] r124677 - /llvm/trunk/docs/GettingStarted.html Message-ID: <20110201200828.AB56B2A6C12C@llvm.org> Author: asl Date: Tue Feb 1 14:08:28 2011 New Revision: 124677 URL: http://llvm.org/viewvc/llvm-project?rev=124677&view=rev Log: Document the LLVM GIT mirror Modified: llvm/trunk/docs/GettingStarted.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=124677&r1=124676&r2=124677&view=diff ============================================================================== --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Tue Feb 1 14:08:28 2011 @@ -28,6 +28,7 @@
  • Setting Up Your Environment
  • Unpacking the LLVM Archives
  • Checkout LLVM from Subversion
  • +
  • LLVM GIT mirror
  • Install the GCC Front End
  • Local LLVM Configuration
  • Compiling the LLVM Suite Source Code
  • @@ -778,6 +779,25 @@ + +
    + +

    GIT mirrors are available for a number of LLVM subprojects. These mirrors + sync automatically with each Subversion commit and contain all necessary + git-svn marks (so, you can recreate git-svn metadata locally). Note that right + now mirrors reflect only trunk for each project. You can do the + read-only GIT clone of LLVM via: +

    +% git clone http://llvm.org/git/llvm.git
    +
    +

    + +
    + + + From asl at math.spbu.ru Tue Feb 1 14:22:53 2011 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 01 Feb 2011 20:22:53 -0000 Subject: [llvm-commits] [llvm] r124679 - in /llvm/trunk/lib/Target/SystemZ: SystemZAsmPrinter.cpp SystemZInstrInfo.td SystemZOperands.td Message-ID: <20110201202253.F10192A6C12C@llvm.org> Author: asl Date: Tue Feb 1 14:22:53 2011 New Revision: 124679 URL: http://llvm.org/viewvc/llvm-project?rev=124679&view=rev Log: Fix imm printing for logical instructions. Patch by Brian G. Lucas! Modified: llvm/trunk/lib/Target/SystemZ/SystemZAsmPrinter.cpp llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td llvm/trunk/lib/Target/SystemZ/SystemZOperands.td Modified: llvm/trunk/lib/Target/SystemZ/SystemZAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZAsmPrinter.cpp?rev=124679&r1=124678&r2=124679&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZAsmPrinter.cpp Tue Feb 1 14:22:53 2011 @@ -55,9 +55,15 @@ void printS16ImmOperand(const MachineInstr *MI, int OpNum, raw_ostream &O) { O << (int16_t)MI->getOperand(OpNum).getImm(); } + void printU16ImmOperand(const MachineInstr *MI, int OpNum, raw_ostream &O) { + O << (uint16_t)MI->getOperand(OpNum).getImm(); + } void printS32ImmOperand(const MachineInstr *MI, int OpNum, raw_ostream &O) { O << (int32_t)MI->getOperand(OpNum).getImm(); } + void printU32ImmOperand(const MachineInstr *MI, int OpNum, raw_ostream &O) { + O << (uint32_t)MI->getOperand(OpNum).getImm(); + } void printInstruction(const MachineInstr *MI, raw_ostream &O); static const char *getRegisterName(unsigned RegNo); Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td?rev=124679&r1=124678&r2=124679&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.td Tue Feb 1 14:22:53 2011 @@ -229,19 +229,19 @@ [(set GR64:$dst, immSExt16:$src)]>; def MOV64rill16 : RII<0xFA5, - (outs GR64:$dst), (ins i64imm:$src), + (outs GR64:$dst), (ins u16imm:$src), "llill\t{$dst, $src}", [(set GR64:$dst, i64ll16:$src)]>; def MOV64rilh16 : RII<0xEA5, - (outs GR64:$dst), (ins i64imm:$src), + (outs GR64:$dst), (ins u16imm:$src), "llilh\t{$dst, $src}", [(set GR64:$dst, i64lh16:$src)]>; def MOV64rihl16 : RII<0xDA5, - (outs GR64:$dst), (ins i64imm:$src), + (outs GR64:$dst), (ins u16imm:$src), "llihl\t{$dst, $src}", [(set GR64:$dst, i64hl16:$src)]>; def MOV64rihh16 : RII<0xCA5, - (outs GR64:$dst), (ins i64imm:$src), + (outs GR64:$dst), (ins u16imm:$src), "llihh\t{$dst, $src}", [(set GR64:$dst, i64hh16:$src)]>; @@ -250,10 +250,10 @@ "lgfi\t{$dst, $src}", [(set GR64:$dst, immSExt32:$src)]>; def MOV64rilo32 : RILI<0xFC0, - (outs GR64:$dst), (ins i64imm:$src), + (outs GR64:$dst), (ins u32imm:$src), "llilf\t{$dst, $src}", [(set GR64:$dst, i64lo32:$src)]>; -def MOV64rihi32 : RILI<0xEC0, (outs GR64:$dst), (ins i64imm:$src), +def MOV64rihi32 : RILI<0xEC0, (outs GR64:$dst), (ins u32imm:$src), "llihf\t{$dst, $src}", [(set GR64:$dst, i64hi32:$src)]>; } @@ -642,42 +642,42 @@ (implicit PSW)]>; def AND32rill16 : RII<0xA57, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u16imm:$src2), "nill\t{$dst, $src2}", [(set GR32:$dst, (and GR32:$src1, i32ll16c:$src2))]>; def AND64rill16 : RII<0xA57, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "nill\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64ll16c:$src2))]>; def AND32rilh16 : RII<0xA56, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u16imm:$src2), "nilh\t{$dst, $src2}", [(set GR32:$dst, (and GR32:$src1, i32lh16c:$src2))]>; def AND64rilh16 : RII<0xA56, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "nilh\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64lh16c:$src2))]>; def AND64rihl16 : RII<0xA55, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "nihl\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64hl16c:$src2))]>; def AND64rihh16 : RII<0xA54, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "nihh\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64hh16c:$src2))]>; def AND32ri : RILI<0xC0B, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u32imm:$src2), "nilf\t{$dst, $src2}", [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>; def AND64rilo32 : RILI<0xC0B, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u32imm:$src2), "nilf\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64lo32c:$src2))]>; def AND64rihi32 : RILI<0xC0A, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u32imm:$src2), "nihf\t{$dst, $src2}", [(set GR64:$dst, (and GR64:$src1, i64hi32c:$src2))]>; @@ -707,41 +707,41 @@ // FIXME: Provide proper encoding! def OR32ri16 : RII<0xA5B, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u32imm:$src2), "oill\t{$dst, $src2}", [(set GR32:$dst, (or GR32:$src1, i32ll16:$src2))]>; def OR32ri16h : RII<0xA5A, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u32imm:$src2), "oilh\t{$dst, $src2}", [(set GR32:$dst, (or GR32:$src1, i32lh16:$src2))]>; def OR32ri : RILI<0xC0D, - (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), + (outs GR32:$dst), (ins GR32:$src1, u32imm:$src2), "oilf\t{$dst, $src2}", [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>; def OR64rill16 : RII<0xA5B, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "oill\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64ll16:$src2))]>; def OR64rilh16 : RII<0xA5A, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "oilh\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64lh16:$src2))]>; def OR64rihl16 : RII<0xA59, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "oihl\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64hl16:$src2))]>; def OR64rihh16 : RII<0xA58, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u16imm:$src2), "oihh\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64hh16:$src2))]>; def OR64rilo32 : RILI<0xC0D, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u32imm:$src2), "oilf\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64lo32:$src2))]>; def OR64rihi32 : RILI<0xC0C, - (outs GR64:$dst), (ins GR64:$src1, i64imm:$src2), + (outs GR64:$dst), (ins GR64:$src1, u32imm:$src2), "oihf\t{$dst, $src2}", [(set GR64:$dst, (or GR64:$src1, i64hi32:$src2))]>; Modified: llvm/trunk/lib/Target/SystemZ/SystemZOperands.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZOperands.td?rev=124679&r1=124678&r2=124679&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZOperands.td (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZOperands.td Tue Feb 1 14:22:53 2011 @@ -246,6 +246,14 @@ def s16imm64 : Operand { let PrintMethod = "printS16ImmOperand"; } +// Unsigned i16 +def u16imm : Operand { + let PrintMethod = "printU16ImmOperand"; +} +def u16imm64 : Operand { + let PrintMethod = "printU16ImmOperand"; +} + // Signed i20 def s20imm : Operand { let PrintMethod = "printS20ImmOperand"; @@ -260,6 +268,13 @@ def s32imm64 : Operand { let PrintMethod = "printS32ImmOperand"; } +// Unsigned i32 +def u32imm : Operand { + let PrintMethod = "printU32ImmOperand"; +} +def u32imm64 : Operand { + let PrintMethod = "printU32ImmOperand"; +} def imm_pcrel : Operand { let PrintMethod = "printPCRelImmOperand"; From gkistanova at gmail.com Tue Feb 1 15:35:27 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Tue, 01 Feb 2011 21:35:27 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r124686 - /llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 Message-ID: <20110201213527.C67F12A6C12C@llvm.org> Author: gkistanova Date: Tue Feb 1 15:35:27 2011 New Revision: 124686 URL: http://llvm.org/viewvc/llvm-project?rev=124686&view=rev Log: Some build script code cleaning and environment change for one of slave builders. Modified: llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 Modified: llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/build-x-4-mingw32?rev=124686&r1=124685&r2=124686&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 (original) +++ llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 Tue Feb 1 15:35:27 2011 @@ -38,6 +38,9 @@ BUILD_ROOT=$PWD # Where build happens. PRIVATE_INSTALL=${BUILD_ROOT}/${INSTALL} # Where the result will be installed. +export PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin +export PATH=$PATH:/mingw_build_tools/install_with_gcc/bin + #------------------------------------------------------------------------------ # Define build steps, parse and validate input parameters #------------------------------------------------------------------------------ @@ -48,7 +51,6 @@ do_configure_llvm=no # Configure LLVM. do_make_llvm=no # Make LLVM. do_test_llvm=no # Test LLVM. -do_cross_tools=no # Copy cross-tools. Deprecated. Use copy_cross_tools instead. do_configure_llvmgcc=no # Configure LLVM-GCC. do_make_llvmgcc=no # Make LLVM-GCC. do_install_llvmgcc=no # Install LLVM-GCC. @@ -67,13 +69,12 @@ configure_llvm | \ make_llvm | \ test_llvm | \ - cross_tools | \ configure_llvmgcc | \ make_llvmgcc | \ install_llvmgcc | \ all) eval do_$1=yes # Set the flag for the requested step . - shift # Remove it since is is ours and already precessed. + shift # Remove it since it is ours and already precessed. ;; *) @@ -94,11 +95,6 @@ do_install_llvmgcc=yes fi -# Handle deprecated steps. -if [ "$do_cross_tools" == "yes" ] ; then - do_copy_cross_tools=yes -fi - #------------------------------------------------------------------------------ # Step: Clean up. #------------------------------------------------------------------------------ @@ -118,7 +114,7 @@ # We need a local copy of binutils, system libraries and headers, # since we will be installing there. - cp -RL /cross-tools/ ${PRIVATE_INSTALL} + cp -RL /mingw_build_tools/install_with_gcc/ ${PRIVATE_INSTALL} fi From dpatel at apple.com Tue Feb 1 15:47:35 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Feb 2011 21:47:35 -0000 Subject: [llvm-commits] [llvm] r124687 - /llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Message-ID: <20110201214735.7E0092A6C12C@llvm.org> Author: dpatel Date: Tue Feb 1 15:47:35 2011 New Revision: 124687 URL: http://llvm.org/viewvc/llvm-project?rev=124687&view=rev Log: Update to match changes in lldb interface. Modified: llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Modified: llvm/trunk/utils/CollectDebugInfoUsingLLDB.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/CollectDebugInfoUsingLLDB.py?rev=124687&r1=124686&r2=124687&view=diff ============================================================================== --- llvm/trunk/utils/CollectDebugInfoUsingLLDB.py (original) +++ llvm/trunk/utils/CollectDebugInfoUsingLLDB.py Tue Feb 1 15:47:35 2011 @@ -154,7 +154,8 @@ # Launch the process. Since we specified synchronous mode, we won't return # from this function until we hit the breakpoint at main - process = target.LaunchProcess ([''], [''], "/dev/stdout", 0, False) + sberror = lldb.SBError() + process = target.Launch (None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, sberror) # Make sure the launch went ok while stopped_at_breakpoint(process): thread = process.GetThreadAtIndex (0) From grosser at fim.uni-passau.de Tue Feb 1 16:02:36 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Tue, 01 Feb 2011 17:02:36 -0500 Subject: [llvm-commits] Patch for simplifying regions In-Reply-To: References: Message-ID: <4D4882FC.8060102@fim.uni-passau.de> On 02/01/2011 02:03 PM, Vu Le wrote: > Hi Tobias, Andreas, > This is my patch for regionsimplify pass. > I rename the file to RegionSimplify, change the pass name to > -regionsimplify to conform with those of Loop. > > I also update the RegionInfo and DominatorTree whenever we split the > entry or exit. > Please give me the feedbacks. > Thanks. > Vu Hi Vu, thanks for submitting this patch. I added my comments inline. > region-simplify.patch > > > diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h > index 2a17c38..a3c1eaa 100644 > --- a/include/llvm/InitializePasses.h > +++ b/include/llvm/InitializePasses.h > @@ -192,6 +192,7 @@ void initializeRegionInfoPass(PassRegistry&); > void initializeRegionOnlyPrinterPass(PassRegistry&); > void initializeRegionOnlyViewerPass(PassRegistry&); > void initializeRegionPrinterPass(PassRegistry&); > +void initializeRegionSimplifyPass(PassRegistry&); > void initializeRegionViewerPass(PassRegistry&); > void initializeRegisterCoalescerAnalysisGroup(PassRegistry&); > void initializeRenderMachineFunctionPass(PassRegistry&); > diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h > index 69e1bd9..ea1faec 100644 > --- a/include/llvm/LinkAllPasses.h > +++ b/include/llvm/LinkAllPasses.h > @@ -114,7 +114,8 @@ namespace { > (void) llvm::createRegionInfoPass(); > (void) llvm::createRegionOnlyPrinterPass(); > (void) llvm::createRegionOnlyViewerPass(); > - (void) llvm::createRegionPrinterPass(); > + (void) llvm::createRegionPrinterPass(); Any need to change this line? > + (void) llvm::createRegionSimplifyPass(); > (void) llvm::createRegionViewerPass(); > (void) llvm::createSCCPPass(); > (void) llvm::createScalarReplAggregatesPass(); > diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h > index 6f2a38e..e3ca06a 100644 > --- a/include/llvm/Transforms/Scalar.h > +++ b/include/llvm/Transforms/Scalar.h > @@ -349,6 +349,12 @@ Pass *createCorrelatedValuePropagationPass(); > FunctionPass *createInstructionSimplifierPass(); > extern char&InstructionSimplifierID; > > +//===----------------------------------------------------------------------===// > +// > +// RegionSimplify - Simplify refined regions, if possible. > +// > +Pass *createRegionSimplifyPass(); > + > } // End llvm namespace > > #endif > diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt > index 106fb8f..53fcf69 100644 > --- a/lib/Transforms/Scalar/CMakeLists.txt > +++ b/lib/Transforms/Scalar/CMakeLists.txt > @@ -23,6 +23,7 @@ add_llvm_library(LLVMScalarOpts > MemCpyOptimizer.cpp > Reassociate.cpp > Reg2Mem.cpp > + RegionSimplify.cpp > SCCP.cpp > Scalar.cpp > ScalarReplAggregates.cpp > diff --git a/lib/Transforms/Scalar/RegionSimplify.cpp b/lib/Transforms/Scalar/RegionSimplify.cpp > new file mode 100644 > index 0000000..c0b2770 > --- /dev/null > +++ b/lib/Transforms/Scalar/RegionSimplify.cpp > @@ -0,0 +1,208 @@ > +//===- SeSeRegionInfo.cpp -------------------------------------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file converts refined regions detected by the RegionInfo analysis Convert refined regions ... > +// into simple regions. > +// > +//===----------------------------------------------------------------------===// > + > +#include "llvm/Instructions.h" > +#include "llvm/ADT/Statistic.h" > +#include "llvm/Analysis/Dominators.h" > +#include "llvm/Analysis/RegionPass.h" > +#include "llvm/Analysis/RegionInfo.h" > +#include "llvm/Transforms/Utils/BasicBlockUtils.h" > + > +#define DEBUG_TYPE "regionsimplify" > + > +using namespace llvm; > + > +STATISTIC(NumEntries, "The # of created entry edges"); The number of entry edges created > +STATISTIC(NumExits, "The # of created exit edges"); dito. > + > +namespace { > +class RegionSimplify: public RegionPass { > + bool modified; > + Region *CR; > + BasicBlock *createSingleEntryEdge(Region *R); > + BasicBlock *createSingleExitEdge(Region *R); > +public: > + static char ID; > + explicit RegionSimplify() : > + RegionPass(ID) { > + initializeRegionSimplifyPass(*PassRegistry::getPassRegistry()); > + } > + > + virtual void print(raw_ostream&O, const Module *M) const; > + > + virtual bool runOnRegion(Region *R, RGPassManager&RGM); > + virtual void getAnalysisUsage(AnalysisUsage&AU) const; > +}; > +} > + > +INITIALIZE_PASS(RegionSimplify, "regionsimplify", > + "Transform refined regions into simple regions", false, false) > + > +char RegionSimplify::ID = 0; > +namespace llvm { > +Pass *createRegionSimplifyPass() { > + return new RegionSimplify(); > +} > +} > + > +void RegionSimplify::print(raw_ostream&O, const Module *M) const { > + BasicBlock *enteringBlock; > + BasicBlock *exitingBlock; > + > + if (modified) { > + enteringBlock = CR->getEnteringBlock(); > + exitingBlock = CR->getExitingBlock(); > + > + O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n"; > + if (enteringBlock) > + O<< " Entry: ]"<< enteringBlock->getNameStr()<< " => " > +<< enteringBlock->getNameStr()<< "]\n"; > + if (exitingBlock) > + O<< " Exit: ["<< exitingBlock->getNameStr()<< " => " > +<< exitingBlock->getNameStr()<< "[\n"; Can you use CR->getNameStr() instead of formatting this yourself? > + > + O<< "\n"; > + } > +} > + > +void RegionSimplify::getAnalysisUsage(AnalysisUsage&AU) const { > + AU.addPreserved (); > + AU.addRequired (); Does this transformation preserve RegionInfo? > +} > + > +// createSingleEntryEdge - Split the entry BasicBlock of the given > +// region after the last PHINode to form a single entry edge. > +// This is similar to CodeExtractor::severSplitPHINodes > +BasicBlock *RegionSimplify::createSingleEntryEdge(Region *R) { > + Function *f = R->getEntry()->getParent(); > + if (&f->getEntryBlock() == R->getEntry()) > + return NULL; // Entry node is the function's entry blocks Why do you need a special case for this? AS the entry node as never any predecessors, I would imaging there would automatically be no splitting. > + > + BasicBlock *oldEntry = R->getEntry(); > + PHINode *PN = dyn_cast (oldEntry->begin()); > + if (!PN) > + return NULL; // No PHI nodes. > + > + BasicBlock::iterator AfterPHIs = oldEntry->getFirstNonPHI(); > + BasicBlock *newEntry = oldEntry->splitBasicBlock(AfterPHIs, > + oldEntry->getName() + ".simregentry"); 'simregionentry' sounds wrong. What about '.single_region_entry', 'singleentry', ...? > + > + // Okay, update dominator sets. // Update dominator tree. > + if (DominatorTree *DT = getAnalysisIfAvailable()) { > + succ_iterator secondSucc = succ_begin(newEntry) + 1; > + if (secondSucc == succ_end(newEntry)) //newEntry has 1 successor > + DT->splitBlock(newEntry); > + else { // newEntry has more than 1 successor, update DT manually > + // oldEntry dominates newEntry. > + // newEntry node dominates all other nodes dominated by oldEntry. > + DomTreeNode *OldNode = DT->getNode(oldEntry); > + if (OldNode) { // don't bother if oldEntry doesn't dominates any node > + std::vector Children; > + for (DomTreeNode::iterator I = OldNode->begin(), E = OldNode->end(); I > + != E; ++I) > + Children.push_back(*I); > + > + DomTreeNode *NewNode = DT->addNewBlock(newEntry, oldEntry); > + for (std::vector::iterator I = Children.begin(), E = > + Children.end(); I != E; ++I) > + DT->changeImmediateDominator(*I, NewNode); > + } > + } > + } > + > + // Loop over all of the predecessors of the old entry that are in the region, > + // changing them to branch to the new entry instead of the old one > + for (pred_iterator PI = pred_begin(oldEntry), PE = pred_end(oldEntry); PI > + != PE; ++PI) { > + if (R->contains(*PI)) { > + TerminatorInst *TI = (*PI)->getTerminator(); > + TI->replaceUsesOfWith(oldEntry, newEntry); > + } > + } > + // just have to update the PHI nodes now, inserting PHI nodes into NewBB. > + for (BasicBlock::iterator PI = oldEntry->begin(); isa (PI); ++PI) { > + PHINode *PN = cast (PI); > + // Create a new PHI node in the new region, which has an incoming value > + // from oldEntry of PN. > + PHINode *NewPN = PHINode::Create(PN->getType(), PN->getName() + ".ph", > + newEntry->begin()); > + > + NewPN->addIncoming(PN, oldEntry); > + > + // Loop over all of the incoming value in PN, moving them to NewPN if they > + // are from the region. > + for (unsigned i = 0; i != PN->getNumIncomingValues(); ++i) { > + BasicBlock *HasValToPN = PN->getIncomingBlock(i); > + if (R->contains(HasValToPN)) { > + NewPN->addIncoming(PN->getIncomingValue(i), HasValToPN); > + PN->removeIncomingValue(i); > + --i; > + } > + } > + } Do you think we can use splitBlockPredecessors to simplify all this? > + > + return newEntry; > +} > + > +// createSingleExitEdge - Split the exit BasicBlock of the given region > +// to form a single exit edge. > +// This does not update RegionInfo analysis. > +BasicBlock *RegionSimplify::createSingleExitEdge(Region *R) { > + BasicBlock *BB = R->getExit(); > + > + SmallVector Preds; > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) > + if (R->contains(*PI)) > + Preds.push_back(*PI); > + > + return SplitBlockPredecessors(BB, Preds.data(), Preds.size(), ".simregexit", > + this); I propose to update RegionInfo here. Copying the setRegionFor from runOnRegion will not be sufficient. You need to update all regions whose entry node was the old exit node of this region. > +} > + > +bool RegionSimplify::runOnRegion(Region *R, RGPassManager&RGM) { > + RegionInfo *RI =&getAnalysis (); > + modified = false; > + > + CR = R; > + if (!R->isTopLevelRegion()) { > + BasicBlock *newBB; > + BasicBlock *oldBB; > + > + if (!(R->getEnteringBlock())) { > + oldBB = R->getEntry(); > + > + newBB = createSingleEntryEdge(R); > + if (newBB) { // update RegionInfo only if we split entry successfully > + RI->splitBlock(newBB, oldBB); I would put this into createSingleEntryEdge(), as you also update the dominance information there. > + > + modified |= true; > + ++NumEntries; > + } > + } > + > + if (!(R->getExitingBlock())) { > + oldBB = R->getExit(); > + newBB = createSingleExitEdge(R); > + > + RI->setRegionFor(newBB, R); I would update the RI in the createSingleExitEdge as you also update the regioninto there. > + > + modified |= true; > + ++NumExits; > + } > + } > + > + return modified; > +} > diff --git a/lib/Transforms/Scalar/Scalar.cpp b/lib/Transforms/Scalar/Scalar.cpp > index bf9ca6d..5d18f22 100644 > --- a/lib/Transforms/Scalar/Scalar.cpp > +++ b/lib/Transforms/Scalar/Scalar.cpp > @@ -51,6 +51,7 @@ void llvm::initializeScalarOpts(PassRegistry&Registry) { > initializeMemCpyOptPass(Registry); > initializeReassociatePass(Registry); > initializeRegToMemPass(Registry); > + initializeRegionSimplifyPass(Registry); > initializeSCCPPass(Registry); > initializeIPSCCPPass(Registry); > initializeSROA_DTPass(Registry); Furthermore, you should add a couple of test cases for the different branches. Tobi From matthewbg at google.com Tue Feb 1 16:12:51 2011 From: matthewbg at google.com (Matt Beaumont-Gay) Date: Tue, 01 Feb 2011 22:12:51 -0000 Subject: [llvm-commits] [llvm] r124688 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <20110201221251.1ECF42A6C12C@llvm.org> Author: matthewbg Date: Tue Feb 1 16:12:50 2011 New Revision: 124688 URL: http://llvm.org/viewvc/llvm-project?rev=124688&view=rev Log: Take Bill Wendling's suggestion for structuring a couple of asserts. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=124688&r1=124687&r2=124688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 1 16:12:50 2011 @@ -2874,9 +2874,9 @@ assert(VT.getSimpleVT() <= N1.getValueType().getSimpleVT() && "Extract subvector must be from larger vector to smaller vector!"); - if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { - (void)CSD; - assert((VT.getVectorNumElements() + CSD->getZExtValue() + if (isa(Index.getNode())) { + assert((VT.getVectorNumElements() + + cast(Index.getNode())->getZExtValue() <= N1.getValueType().getVectorNumElements()) && "Extract subvector overflow!"); } @@ -3093,9 +3093,9 @@ "Dest and insert subvector source types must match!"); assert(N2.getValueType().getSimpleVT() <= N1.getValueType().getSimpleVT() && "Insert subvector must be from smaller vector to larger vector!"); - if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { - (void)CSD; - assert((N2.getValueType().getVectorNumElements() + CSD->getZExtValue() + if (isa(Index.getNode())) { + assert((N2.getValueType().getVectorNumElements() + + cast(Index.getNode())->getZExtValue() <= VT.getVectorNumElements()) && "Insert subvector overflow!"); } From matthewbg at google.com Tue Feb 1 16:17:21 2011 From: matthewbg at google.com (Matt Beaumont-Gay) Date: Tue, 1 Feb 2011 14:17:21 -0800 Subject: [llvm-commits] [llvm] r124350 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: References: <20110127023927.CE2C72A6C12C@llvm.org> Message-ID: On Tue, Feb 1, 2011 at 11:16, Bill Wendling wrote: > On Jan 26, 2011, at 6:39 PM, Matt Beaumont-Gay wrote: > >> Author: matthewbg >> Date: Wed Jan 26 20:39:27 2011 >> New Revision: 124350 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=124350&view=rev >> Log: >> Try harder to not have unused variables. >> >> Modified: >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=124350&r1=124349&r2=124350&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 26 20:39:27 2011 >> @@ -2875,6 +2875,7 @@ >> ? ? ? ? ? ? ?"Extract subvector must be from larger vector to smaller vector!"); >> >> ? ? ? if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { >> + ? ? ? ?(void)CSD; > > Why not use "isa<>" here and "cast<>" in the assert? Thanks, done in r124688. -Matt From gkistanova at gmail.com Tue Feb 1 16:30:39 2011 From: gkistanova at gmail.com (Galina Kistanova) Date: Tue, 01 Feb 2011 22:30:39 -0000 Subject: [llvm-commits] [zorg] r124693 - /zorg/trunk/buildbot/osuosl/master/config/builders.py Message-ID: <20110201223039.4FB882A6C12C@llvm.org> Author: gkistanova Date: Tue Feb 1 16:30:39 2011 New Revision: 124693 URL: http://llvm.org/viewvc/llvm-project?rev=124693&view=rev Log: Removed step install llvm for 3-stage llvm-gcc cross build. Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=124693&r1=124692&r2=124693&view=diff ============================================================================== --- zorg/trunk/buildbot/osuosl/master/config/builders.py (original) +++ zorg/trunk/buildbot/osuosl/master/config/builders.py Tue Feb 1 16:30:39 2011 @@ -515,9 +515,6 @@ 'description' : 'make llvm (stage 3)', 'extra_args' : ['-j8'], 'haltOnFailure' : True }, - {'name' : 'install_llvm_3', - 'description' : 'install llvm (stage 3)', - 'haltOnFailure' : False }, {'name' : 'configure_llvmgcc_3', 'description' : 'configure llvm-gcc (stage 3)', 'haltOnFailure' : True }, From bob.wilson at apple.com Tue Feb 1 16:30:51 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 01 Feb 2011 22:30:51 -0000 Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Message-ID: <20110201223051.C31562A6C12C@llvm.org> Author: bwilson Date: Tue Feb 1 16:30:51 2011 New Revision: 124694 URL: http://llvm.org/viewvc/llvm-project?rev=124694&view=rev Log: PR9081: Split up LDM instruction with deprecated use of both LR and PC. This is completely untested but pretty straightforward, so hopefully I got it right. Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=124694&r1=124693&r2=124694&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Tue Feb 1 16:30:51 2011 @@ -43,7 +43,7 @@ #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) // CompilationCallback stub - We can't use a C function with inline assembly in -// it, because we the prolog/epilog inserted by GCC won't work for us (we need +// it, because the prolog/epilog inserted by GCC won't work for us. (We need // to preserve more context and manipulate the stack directly). Instead, // write our own wrapper, which does things our way, so we have complete // control over register saving and restoring. @@ -99,7 +99,8 @@ // The above twiddling of the saved return addresses allows us to // deallocate everything, including the LR the stub saved, all in one // pop instruction. - "ldmia sp!, {r0, r1, r2, r3, lr, pc}\n" + "ldmia sp!, {r0, r1, r2, r3, lr}\n" + "ldr pc, [sp], #4\n" ); #else // Not an ARM host void ARMCompilationCallback() { From wendling at apple.com Tue Feb 1 16:39:15 2011 From: wendling at apple.com (Bill Wendling) Date: Tue, 1 Feb 2011 14:39:15 -0800 Subject: [llvm-commits] [llvm] r124350 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: References: <20110127023927.CE2C72A6C12C@llvm.org> Message-ID: On Feb 1, 2011, at 2:17 PM, Matt Beaumont-Gay wrote: > On Tue, Feb 1, 2011 at 11:16, Bill Wendling wrote: >> On Jan 26, 2011, at 6:39 PM, Matt Beaumont-Gay wrote: >> >>> Author: matthewbg >>> Date: Wed Jan 26 20:39:27 2011 >>> New Revision: 124350 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=124350&view=rev >>> Log: >>> Try harder to not have unused variables. >>> >>> Modified: >>> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >>> >>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=124350&r1=124349&r2=124350&view=diff >>> ============================================================================== >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 26 20:39:27 2011 >>> @@ -2875,6 +2875,7 @@ >>> "Extract subvector must be from larger vector to smaller vector!"); >>> >>> if (ConstantSDNode *CSD = dyn_cast(Index.getNode())) { >>> + (void)CSD; >> >> Why not use "isa<>" here and "cast<>" in the assert? > > Thanks, done in r124688. > Yay! Thanks :) -bw From vmle at ucdavis.edu Tue Feb 1 18:37:58 2011 From: vmle at ucdavis.edu (Vu Le) Date: Tue, 1 Feb 2011 16:37:58 -0800 Subject: [llvm-commits] Patch for simplifying regions In-Reply-To: <4D4882FC.8060102@fim.uni-passau.de> References: <4D4882FC.8060102@fim.uni-passau.de> Message-ID: Hi Tobias, On Tue, Feb 1, 2011 at 2:02 PM, Tobias Grosser wrote: > On 02/01/2011 02:03 PM, Vu Le wrote: > >> Hi Tobias, Andreas, >> This is my patch for regionsimplify pass. >> I rename the file to RegionSimplify, change the pass name to >> -regionsimplify to conform with those of Loop. >> >> I also update the RegionInfo and DominatorTree whenever we split the >> entry or exit. >> Please give me the feedbacks. >> Thanks. >> Vu >> > > Hi Vu, > > thanks for submitting this patch. I added my comments inline. > > region-simplify.patch >> >> >> diff --git a/include/llvm/InitializePasses.h >> b/include/llvm/InitializePasses.h >> index 2a17c38..a3c1eaa 100644 >> --- a/include/llvm/InitializePasses.h >> +++ b/include/llvm/InitializePasses.h >> @@ -192,6 +192,7 @@ void initializeRegionInfoPass(PassRegistry&); >> void initializeRegionOnlyPrinterPass(PassRegistry&); >> void initializeRegionOnlyViewerPass(PassRegistry&); >> void initializeRegionPrinterPass(PassRegistry&); >> +void initializeRegionSimplifyPass(PassRegistry&); >> void initializeRegionViewerPass(PassRegistry&); >> void initializeRegisterCoalescerAnalysisGroup(PassRegistry&); >> void initializeRenderMachineFunctionPass(PassRegistry&); >> diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h >> index 69e1bd9..ea1faec 100644 >> --- a/include/llvm/LinkAllPasses.h >> +++ b/include/llvm/LinkAllPasses.h >> @@ -114,7 +114,8 @@ namespace { >> (void) llvm::createRegionInfoPass(); >> (void) llvm::createRegionOnlyPrinterPass(); >> (void) llvm::createRegionOnlyViewerPass(); >> - (void) llvm::createRegionPrinterPass(); >> + (void) llvm::createRegionPrinterPass(); >> > Any need to change this line? > > + (void) llvm::createRegionSimplifyPass(); >> (void) llvm::createRegionViewerPass(); >> (void) llvm::createSCCPPass(); >> (void) llvm::createScalarReplAggregatesPass(); >> diff --git a/include/llvm/Transforms/Scalar.h >> b/include/llvm/Transforms/Scalar.h >> index 6f2a38e..e3ca06a 100644 >> --- a/include/llvm/Transforms/Scalar.h >> +++ b/include/llvm/Transforms/Scalar.h >> @@ -349,6 +349,12 @@ Pass *createCorrelatedValuePropagationPass(); >> FunctionPass *createInstructionSimplifierPass(); >> extern char&InstructionSimplifierID; >> >> >> +//===----------------------------------------------------------------------===// >> +// >> +// RegionSimplify - Simplify refined regions, if possible. >> +// >> +Pass *createRegionSimplifyPass(); >> + >> } // End llvm namespace >> >> #endif >> diff --git a/lib/Transforms/Scalar/CMakeLists.txt >> b/lib/Transforms/Scalar/CMakeLists.txt >> index 106fb8f..53fcf69 100644 >> --- a/lib/Transforms/Scalar/CMakeLists.txt >> +++ b/lib/Transforms/Scalar/CMakeLists.txt >> @@ -23,6 +23,7 @@ add_llvm_library(LLVMScalarOpts >> MemCpyOptimizer.cpp >> Reassociate.cpp >> Reg2Mem.cpp >> + RegionSimplify.cpp >> SCCP.cpp >> Scalar.cpp >> ScalarReplAggregates.cpp >> diff --git a/lib/Transforms/Scalar/RegionSimplify.cpp >> b/lib/Transforms/Scalar/RegionSimplify.cpp >> new file mode 100644 >> index 0000000..c0b2770 >> --- /dev/null >> +++ b/lib/Transforms/Scalar/RegionSimplify.cpp >> @@ -0,0 +1,208 @@ >> +//===- SeSeRegionInfo.cpp >> -------------------------------------------------===// >> +// >> +// The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open Source >> +// License. See LICENSE.TXT for details. >> +// >> >> +//===----------------------------------------------------------------------===// >> +// >> +// This file converts refined regions detected by the RegionInfo analysis >> > Convert refined regions ... > > +// into simple regions. >> +// >> >> +//===----------------------------------------------------------------------===// >> + >> +#include "llvm/Instructions.h" >> +#include "llvm/ADT/Statistic.h" >> +#include "llvm/Analysis/Dominators.h" >> +#include "llvm/Analysis/RegionPass.h" >> +#include "llvm/Analysis/RegionInfo.h" >> +#include "llvm/Transforms/Utils/BasicBlockUtils.h" >> + >> +#define DEBUG_TYPE "regionsimplify" >> + >> +using namespace llvm; >> + >> +STATISTIC(NumEntries, "The # of created entry edges"); >> > The number of entry edges created > > +STATISTIC(NumExits, "The # of created exit edges"); >> > dito. > > + >> +namespace { >> +class RegionSimplify: public RegionPass { >> + bool modified; >> + Region *CR; >> + BasicBlock *createSingleEntryEdge(Region *R); >> + BasicBlock *createSingleExitEdge(Region *R); >> +public: >> + static char ID; >> + explicit RegionSimplify() : >> + RegionPass(ID) { >> + initializeRegionSimplifyPass(*PassRegistry::getPassRegistry()); >> + } >> + >> + virtual void print(raw_ostream&O, const Module *M) const; >> + >> + virtual bool runOnRegion(Region *R, RGPassManager&RGM); >> + virtual void getAnalysisUsage(AnalysisUsage&AU) const; >> +}; >> +} >> + >> +INITIALIZE_PASS(RegionSimplify, "regionsimplify", >> + "Transform refined regions into simple regions", false, false) >> + >> +char RegionSimplify::ID = 0; >> +namespace llvm { >> +Pass *createRegionSimplifyPass() { >> + return new RegionSimplify(); >> +} >> +} >> + >> +void RegionSimplify::print(raw_ostream&O, const Module *M) const { >> + BasicBlock *enteringBlock; >> + BasicBlock *exitingBlock; >> + >> + if (modified) { >> + enteringBlock = CR->getEnteringBlock(); >> + exitingBlock = CR->getExitingBlock(); >> + >> + O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n"; >> + if (enteringBlock) >> + O<< " Entry: ]"<< enteringBlock->getNameStr()<< " => " >> +<< enteringBlock->getNameStr()<< "]\n"; >> + if (exitingBlock) >> + O<< " Exit: ["<< exitingBlock->getNameStr()<< " => " >> +<< exitingBlock->getNameStr()<< "[\n"; >> > Can you use CR->getNameStr() instead of formatting this yourself? > This is is Andreas' code. Do you mean if the region is modified, we just print CR->getNameStr()? > > + >> + O<< "\n"; >> + } >> +} >> + >> +void RegionSimplify::getAnalysisUsage(AnalysisUsage&AU) const { >> + AU.addPreserved (); >> + AU.addRequired (); >> > Does this transformation preserve RegionInfo? > Yes, I think RegionInfo is also preserved. > > +} >> + >> +// createSingleEntryEdge - Split the entry BasicBlock of the given >> +// region after the last PHINode to form a single entry edge. >> +// This is similar to CodeExtractor::severSplitPHINodes >> +BasicBlock *RegionSimplify::createSingleEntryEdge(Region *R) { >> + Function *f = R->getEntry()->getParent(); >> + if (&f->getEntryBlock() == R->getEntry()) >> + return NULL; // Entry node is the function's entry blocks >> > Why do you need a special case for this? AS the entry node as never any > predecessors, I would imaging there would automatically be no splitting. > I thought that we should not split regions whose entry is the function entry. But I was wrong. We can split those. But I don't quite understand what you mean. > + >> + BasicBlock *oldEntry = R->getEntry(); >> + PHINode *PN = dyn_cast (oldEntry->begin()); >> + if (!PN) >> + return NULL; // No PHI nodes. >> + >> + BasicBlock::iterator AfterPHIs = oldEntry->getFirstNonPHI(); >> + BasicBlock *newEntry = oldEntry->splitBasicBlock(AfterPHIs, >> + oldEntry->getName() + ".simregentry"); >> > 'simregionentry' sounds wrong. What about '.single_region_entry', > 'singleentry', ...? > > + >> + // Okay, update dominator sets. >> > // Update dominator tree. > > + if (DominatorTree *DT = getAnalysisIfAvailable()) { >> + succ_iterator secondSucc = succ_begin(newEntry) + 1; >> + if (secondSucc == succ_end(newEntry)) //newEntry has 1 successor >> + DT->splitBlock(newEntry); >> + else { // newEntry has more than 1 successor, update DT manually >> + // oldEntry dominates newEntry. >> + // newEntry node dominates all other nodes dominated by oldEntry. >> + DomTreeNode *OldNode = DT->getNode(oldEntry); >> + if (OldNode) { // don't bother if oldEntry doesn't dominates any >> node >> + std::vector Children; >> + for (DomTreeNode::iterator I = OldNode->begin(), E = >> OldNode->end(); I >> + != E; ++I) >> + Children.push_back(*I); >> + >> + DomTreeNode *NewNode = DT->addNewBlock(newEntry, oldEntry); >> + for (std::vector::iterator I = Children.begin(), E >> = >> + Children.end(); I != E; ++I) >> + DT->changeImmediateDominator(*I, NewNode); >> + } >> + } >> + } >> + >> + // Loop over all of the predecessors of the old entry that are in the >> region, >> + // changing them to branch to the new entry instead of the old one >> + for (pred_iterator PI = pred_begin(oldEntry), PE = pred_end(oldEntry); >> PI >> + != PE; ++PI) { >> + if (R->contains(*PI)) { >> + TerminatorInst *TI = (*PI)->getTerminator(); >> + TI->replaceUsesOfWith(oldEntry, newEntry); >> + } >> + } >> + // just have to update the PHI nodes now, inserting PHI nodes into >> NewBB. >> + for (BasicBlock::iterator PI = oldEntry->begin(); isa (PI); >> ++PI) { >> + PHINode *PN = cast (PI); >> + // Create a new PHI node in the new region, which has an incoming >> value >> + // from oldEntry of PN. >> + PHINode *NewPN = PHINode::Create(PN->getType(), PN->getName() + >> ".ph", >> + newEntry->begin()); >> + >> + NewPN->addIncoming(PN, oldEntry); >> + >> + // Loop over all of the incoming value in PN, moving them to NewPN if >> they >> + // are from the region. >> + for (unsigned i = 0; i != PN->getNumIncomingValues(); ++i) { >> + BasicBlock *HasValToPN = PN->getIncomingBlock(i); >> + if (R->contains(HasValToPN)) { >> + NewPN->addIncoming(PN->getIncomingValue(i), HasValToPN); >> + PN->removeIncomingValue(i); >> + --i; >> + } >> + } >> + } >> > Do you think we can use splitBlockPredecessors to simplify all this? > I guess yes. The different here is if we use splitBlockPredecessors, Entry is split into NewNode->Entry. The entry node of R is not still Entry. We only need to update regions whose exit is Entry. Their exit must be changed into NewNode. I'm not quite sure how to do that. > + >> + return newEntry; >> +} >> + >> +// createSingleExitEdge - Split the exit BasicBlock of the given region >> +// to form a single exit edge. >> +// This does not update RegionInfo analysis. >> +BasicBlock *RegionSimplify::createSingleExitEdge(Region *R) { >> + BasicBlock *BB = R->getExit(); >> + >> + SmallVector Preds; >> + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; >> ++PI) >> + if (R->contains(*PI)) >> + Preds.push_back(*PI); >> + >> + return SplitBlockPredecessors(BB, Preds.data(), Preds.size(), >> ".simregexit", >> + this); >> > I propose to update RegionInfo here. Copying the setRegionFor from > runOnRegion will not be sufficient. You need to update all regions whose > entry node was the old exit node of this region. > Why would we do that? Suppose another region X has entry oldExit. In region R, oldExit is split into (NewExit->oldExit). R is now the smallest region containing NewExit. I think it's still OK if the entry of X is oldExit. > +} >> + >> +bool RegionSimplify::runOnRegion(Region *R, RGPassManager&RGM) { >> + RegionInfo *RI =&getAnalysis (); >> + modified = false; >> + >> + CR = R; >> + if (!R->isTopLevelRegion()) { >> + BasicBlock *newBB; >> + BasicBlock *oldBB; >> + >> + if (!(R->getEnteringBlock())) { >> + oldBB = R->getEntry(); >> + >> + newBB = createSingleEntryEdge(R); >> + if (newBB) { // update RegionInfo only if we split entry >> successfully >> + RI->splitBlock(newBB, oldBB); >> > I would put this into createSingleEntryEdge(), as you also update the > dominance information there. > OK. > > + >> + modified |= true; >> + ++NumEntries; >> + } >> + } >> + >> + if (!(R->getExitingBlock())) { >> + oldBB = R->getExit(); >> + newBB = createSingleExitEdge(R); >> + >> + RI->setRegionFor(newBB, R); >> > I would update the RI in the createSingleExitEdge as you also update the > regioninto there. > > OK. > > + >> + modified |= true; >> + ++NumExits; >> + } >> + } >> + >> + return modified; >> +} >> diff --git a/lib/Transforms/Scalar/Scalar.cpp >> b/lib/Transforms/Scalar/Scalar.cpp >> index bf9ca6d..5d18f22 100644 >> --- a/lib/Transforms/Scalar/Scalar.cpp >> +++ b/lib/Transforms/Scalar/Scalar.cpp >> @@ -51,6 +51,7 @@ void llvm::initializeScalarOpts(PassRegistry&Registry) { >> initializeMemCpyOptPass(Registry); >> initializeReassociatePass(Registry); >> initializeRegToMemPass(Registry); >> + initializeRegionSimplifyPass(Registry); >> initializeSCCPPass(Registry); >> initializeIPSCCPPass(Registry); >> initializeSROA_DTPass(Registry); >> > > Furthermore, you should add a couple of test cases for the different > branches. > > I tested with mysql code. Do you know how to verify that our pass preserves the semantics of the program? > Tobi > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110201/f21f745a/attachment-0001.html From bob.wilson at apple.com Tue Feb 1 18:46:09 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 02 Feb 2011 00:46:09 -0000 Subject: [llvm-commits] [llvm] r124705 - /llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Message-ID: <20110202004609.551362A6C12C@llvm.org> Author: bwilson Date: Tue Feb 1 18:46:09 2011 New Revision: 124705 URL: http://llvm.org/viewvc/llvm-project?rev=124705&view=rev Log: Fix comment typo. Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=124705&r1=124704&r2=124705&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Tue Feb 1 18:46:09 2011 @@ -663,7 +663,7 @@ } /// getFrameIndexInstrOffset - Get the offset from the referenced frame - /// index in the instruction, if the is one. + /// index in the instruction, if there is one. virtual int64_t getFrameIndexInstrOffset(const MachineInstr *MI, int Idx) const { return 0; From evan.cheng at apple.com Tue Feb 1 19:06:55 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 02 Feb 2011 01:06:55 -0000 Subject: [llvm-commits] [llvm] r124708 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h test/CodeGen/ARM/ldst-f32-2-i32.ll Message-ID: <20110202010655.A71212A6C12C@llvm.org> Author: evancheng Date: Tue Feb 1 19:06:55 2011 New Revision: 124708 URL: http://llvm.org/viewvc/llvm-project?rev=124708&view=rev Log: Given a pair of floating point load and store, if there are no other uses of the load, then it may be legal to transform the load and store to integer load and store of the same width. This is done if the target specified the transformation as profitable. e.g. On arm, this can transform: vldr.32 s0, [] vstr.32 s0, [] to ldr r12, [] str r12, [] rdar://8944252 Added: llvm/trunk/test/CodeGen/ARM/ldst-f32-2-i32.ll Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=124708&r1=124707&r2=124708&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Feb 1 19:06:55 2011 @@ -963,6 +963,13 @@ return isTypeLegal(VT); } + /// isDesirableToPromoteOp - Return true if it is profitable for dag combiner + /// to transform a floating point op of specified opcode to a equivalent op of + /// an integer type. e.g. f32 load -> i32 load can be profitable on ARM. + virtual bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const { + return false; + } + /// IsDesirableToPromoteOp - This method query the target whether it is /// beneficial for dag combiner to promote the specified node. If true, it /// should return the desired promotion type by reference. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=124708&r1=124707&r2=124708&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Feb 1 19:06:55 2011 @@ -42,6 +42,7 @@ STATISTIC(PreIndexedNodes , "Number of pre-indexed nodes created"); STATISTIC(PostIndexedNodes, "Number of post-indexed nodes created"); STATISTIC(OpsNarrowed , "Number of load/op/store narrowed"); +STATISTIC(LdStFP2Int , "Number of fp load/store pairs transformed to int"); namespace { static cl::opt @@ -234,6 +235,7 @@ SDNode *MatchRotate(SDValue LHS, SDValue RHS, DebugLoc DL); SDValue ReduceLoadWidth(SDNode *N); SDValue ReduceLoadOpStoreWidth(SDNode *N); + SDValue TransformFPLoadStorePair(SDNode *N); SDValue GetDemandedBits(SDValue V, const APInt &Mask); @@ -6111,6 +6113,63 @@ return SDValue(); } +/// TransformFPLoadStorePair - For a given floating point load / store pair, +/// if the load value isn't used by any other operations, then consider +/// transforming the pair to integer load / store operations if the target +/// deems the transformation profitable. +SDValue DAGCombiner::TransformFPLoadStorePair(SDNode *N) { + StoreSDNode *ST = cast(N); + SDValue Chain = ST->getChain(); + SDValue Value = ST->getValue(); + if (ISD::isNormalStore(ST) && ISD::isNormalLoad(Value.getNode()) && + Value.hasOneUse() && + Chain == SDValue(Value.getNode(), 1)) { + LoadSDNode *LD = cast(Value); + EVT VT = LD->getMemoryVT(); + if (!VT.isFloatingPoint() || + VT != ST->getMemoryVT() || + LD->isNonTemporal() || + ST->isNonTemporal() || + LD->getPointerInfo().getAddrSpace() != 0 || + ST->getPointerInfo().getAddrSpace() != 0) + return SDValue(); + + EVT IntVT = EVT::getIntegerVT(*DAG.getContext(), VT.getSizeInBits()); + if (!TLI.isOperationLegal(ISD::LOAD, IntVT) || + !TLI.isOperationLegal(ISD::STORE, IntVT) || + !TLI.isDesirableToTransformToIntegerOp(ISD::LOAD, VT) || + !TLI.isDesirableToTransformToIntegerOp(ISD::STORE, VT)) + return SDValue(); + + unsigned LDAlign = LD->getAlignment(); + unsigned STAlign = ST->getAlignment(); + const Type *IntVTTy = IntVT.getTypeForEVT(*DAG.getContext()); + unsigned ABIAlign = TLI.getTargetData()->getABITypeAlignment(IntVTTy); + if (LDAlign < ABIAlign || STAlign < ABIAlign) + return SDValue(); + + SDValue NewLD = DAG.getLoad(IntVT, Value.getDebugLoc(), + LD->getChain(), LD->getBasePtr(), + LD->getPointerInfo(), + false, false, LDAlign); + + SDValue NewST = DAG.getStore(NewLD.getValue(1), N->getDebugLoc(), + NewLD, ST->getBasePtr(), + ST->getPointerInfo(), + false, false, STAlign); + + AddToWorkList(NewLD.getNode()); + AddToWorkList(NewST.getNode()); + WorkListRemover DeadNodes(*this); + DAG.ReplaceAllUsesOfValueWith(Value.getValue(1), NewLD.getValue(1), + &DeadNodes); + ++LdStFP2Int; + return NewST; + } + + return SDValue(); +} + SDValue DAGCombiner::visitSTORE(SDNode *N) { StoreSDNode *ST = cast(N); SDValue Chain = ST->getChain(); @@ -6210,6 +6269,12 @@ } } + // Try transforming a pair floating point load / store ops to integer + // load / store ops. + SDValue NewST = TransformFPLoadStorePair(N); + if (NewST.getNode()) + return NewST; + if (CombinerAA) { // Walk up chain skipping non-aliasing memory nodes. SDValue BetterChain = FindBetterChain(N, Chain); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=124708&r1=124707&r2=124708&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Feb 1 19:06:55 2011 @@ -5724,6 +5724,11 @@ return SDValue(); } +bool ARMTargetLowering::isDesirableToTransformToIntegerOp(unsigned Opc, + EVT VT) const { + return (VT == MVT::f32) && (Opc == ISD::LOAD || Opc == ISD::STORE); +} + bool ARMTargetLowering::allowsUnalignedMemoryAccesses(EVT VT) const { if (!Subtarget->allowsUnalignedMem()) return false; Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=124708&r1=124707&r2=124708&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Feb 1 19:06:55 2011 @@ -213,14 +213,16 @@ virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl&Results, SelectionDAG &DAG) const; - virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; - virtual const char *getTargetNodeName(unsigned Opcode) const; virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const; + virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; + + bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const; + /// allowsUnalignedMemoryAccesses - Returns true if the target allows /// unaligned memory accesses. of the specified type. /// FIXME: Add getOptimalMemOpType to implement memcpy with NEON? Added: llvm/trunk/test/CodeGen/ARM/ldst-f32-2-i32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ldst-f32-2-i32.ll?rev=124708&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ldst-f32-2-i32.ll (added) +++ llvm/trunk/test/CodeGen/ARM/ldst-f32-2-i32.ll Tue Feb 1 19:06:55 2011 @@ -0,0 +1,28 @@ +; RUN: llc < %s -mtriple=armv7-apple-darwin -mcpu=cortex-a8 | FileCheck %s +; Check if the f32 load / store pair are optimized to i32 load / store. +; rdar://8944252 + +define void @t(i32 %width, float* nocapture %src, float* nocapture %dst, i32 %index) nounwind { +; CHECK: t: +entry: + %src6 = bitcast float* %src to i8* + %0 = icmp eq i32 %width, 0 + br i1 %0, label %return, label %bb + +bb: +; CHECK: ldr [[REGISTER:(r[0-9]+)]], [r1], r3 +; CHECK: str [[REGISTER]], [r2], #4 + %j.05 = phi i32 [ %2, %bb ], [ 0, %entry ] + %tmp = mul i32 %j.05, %index + %uglygep = getelementptr i8* %src6, i32 %tmp + %src_addr.04 = bitcast i8* %uglygep to float* + %dst_addr.03 = getelementptr float* %dst, i32 %j.05 + %1 = load float* %src_addr.04, align 4 + store float %1, float* %dst_addr.03, align 4 + %2 = add i32 %j.05, 1 + %exitcond = icmp eq i32 %2, %width + br i1 %exitcond, label %return, label %bb + +return: + ret void +} From scallanan at apple.com Tue Feb 1 19:09:03 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 02 Feb 2011 01:09:03 -0000 Subject: [llvm-commits] [llvm] r124709 - /llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Message-ID: <20110202010903.15BB22A6C12C@llvm.org> Author: spyffe Date: Tue Feb 1 19:09:02 2011 New Revision: 124709 URL: http://llvm.org/viewvc/llvm-project?rev=124709&view=rev Log: Fixed a bug in the disassembler where the mandatory 0x66 prefix would be misinterpreted in some cases on 32-bit x86 platforms. Thanks to Olivier Meurant for identifying the bug. Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=124709&r1=124708&r2=124709&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original) +++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Tue Feb 1 19:09:02 2011 @@ -388,6 +388,7 @@ } } else { unconsumeByte(insn); + insn->necessaryPrefixLocation = insn->readerCursor - 1; } if (insn->mode == MODE_16BIT) { From gohman at apple.com Tue Feb 1 20:02:34 2011 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Feb 2011 02:02:34 -0000 Subject: [llvm-commits] [llvm] r124712 - in /llvm/trunk: include/llvm/Value.h lib/Transforms/Scalar/Reassociate.cpp test/Transforms/Reassociate/optional-flags.ll Message-ID: <20110202020234.305052A6C12C@llvm.org> Author: djg Date: Tue Feb 1 20:02:34 2011 New Revision: 124712 URL: http://llvm.org/viewvc/llvm-project?rev=124712&view=rev Log: Fix reassociate to clear optional flags, such as nsw. Added: llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Modified: llvm/trunk/include/llvm/Value.h llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=124712&r1=124711&r2=124712&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Tue Feb 1 20:02:34 2011 @@ -252,6 +252,12 @@ return SubclassOptionalData; } + /// clearSubclassOptionalData - Clear the optional flags contained in + /// this value. + void clearSubclassOptionalData() { + SubclassOptionalData = 0; + } + /// hasSameSubclassOptionalData - Test whether the optional flags contained /// in this value are equal to the optional flags in the given value. bool hasSameSubclassOptionalData(const Value *V) const { Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=124712&r1=124711&r2=124712&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Tue Feb 1 20:02:34 2011 @@ -240,6 +240,12 @@ RHS->setOperand(0, LHS); I->setOperand(0, RHS); + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + LHS->clearSubclassOptionalData(); + RHS->clearSubclassOptionalData(); + ++NumLinear; MadeChange = true; DEBUG(dbgs() << "Linearized: " << *I << '\n'); @@ -341,6 +347,11 @@ DEBUG(dbgs() << "RA: " << *I << '\n'); I->setOperand(0, Ops[i].Op); I->setOperand(1, Ops[i+1].Op); + + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + DEBUG(dbgs() << "TO: " << *I << '\n'); MadeChange = true; ++NumChanged; @@ -356,6 +367,11 @@ if (I->getOperand(1) != Ops[i].Op) { DEBUG(dbgs() << "RA: " << *I << '\n'); I->setOperand(1, Ops[i].Op); + + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + DEBUG(dbgs() << "TO: " << *I << '\n'); MadeChange = true; ++NumChanged; Added: llvm/trunk/test/Transforms/Reassociate/optional-flags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/optional-flags.ll?rev=124712&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Reassociate/optional-flags.ll (added) +++ llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Tue Feb 1 20:02:34 2011 @@ -0,0 +1,22 @@ +; RUN: opt -S -reassociate < %s | FileCheck %s +; rdar://8944681 + +; Reassociate should clear optional flags like nsw when reassociating. + +; CHECK: @test0 +; CHECK: %y = add i64 %b, %a +; CHECK: %z = add i64 %y, %c +define i64 @test0(i64 %a, i64 %b, i64 %c) { + %y = add nsw i64 %c, %b + %z = add i64 %y, %a + ret i64 %z +} + +; CHECK: @test1 +; CHECK: %y = add i64 %b, %a +; CHECK: %z = add i64 %y, %c +define i64 @test1(i64 %a, i64 %b, i64 %c) { + %y = add i64 %c, %b + %z = add nsw i64 %y, %a + ret i64 %z +} From gohman at apple.com Tue Feb 1 20:05:46 2011 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Feb 2011 02:05:46 -0000 Subject: [llvm-commits] [llvm] r124713 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Message-ID: <20110202020546.329B02A6C12C@llvm.org> Author: djg Date: Tue Feb 1 20:05:46 2011 New Revision: 124713 URL: http://llvm.org/viewvc/llvm-project?rev=124713&view=rev Log: Conservatively, clear optional flags, such as nsw, when performing reassociation. No testcase, because I wasn't able to create a testcase which actually demonstrates a problem. Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=124713&r1=124712&r2=124713&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Feb 1 20:05:46 2011 @@ -157,6 +157,9 @@ // It simplifies to V. Form "A op V". I.setOperand(0, A); I.setOperand(1, V); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -174,6 +177,9 @@ // It simplifies to V. Form "V op C". I.setOperand(0, V); I.setOperand(1, C); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -193,6 +199,9 @@ // It simplifies to V. Form "V op B". I.setOperand(0, V); I.setOperand(1, B); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -210,6 +219,9 @@ // It simplifies to V. Form "B op V". I.setOperand(0, B); I.setOperand(1, V); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -234,6 +246,9 @@ Worklist.Add(New); I.setOperand(0, New); I.setOperand(1, Folded); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; continue; } From clattner at apple.com Tue Feb 1 22:55:08 2011 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Feb 2011 20:55:08 -0800 Subject: [llvm-commits] [llvm] r124608 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp In-Reply-To: <4D480BA1.5080707@gmail.com> References: <20110131211943.AF2ED2A6C12C@llvm.org> <20110201084518.GA67675@freebsd.org> <4D480BA1.5080707@gmail.com> Message-ID: <8B0E70B0-0FD5-4125-8C8E-250DEA7A1DA7@apple.com> On Feb 1, 2011, at 5:33 AM, Rafael ?vila de Esp?ndola wrote: >> I hope support for .code{16,32,64} will be contributed soon so this will >> go away completely :) > > This is one bug I think will take some time to fix. If I am not > mistaken, the correct way to solve it is to avoid the MC -> Codegen > dependencies. It might also be possible to solve it with some hack like > having two codegens and switching between them. The major prereq for doing this is to get the MC asm parsers off of the subtarget info in the main target stuff. We need a TargetRegistry version that doesn't depend on (for example) libX86.a -Chris From nicholas at mxc.ca Tue Feb 1 23:31:01 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 02 Feb 2011 05:31:01 -0000 Subject: [llvm-commits] [llvm] r124717 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <20110202053101.5EAB52A6C12C@llvm.org> Author: nicholas Date: Tue Feb 1 23:31:01 2011 New Revision: 124717 URL: http://llvm.org/viewvc/llvm-project?rev=124717&view=rev Log: Remove wasteful caching. This isn't needed for correctness because any function that might have changed been affected by a merge elsewhere will have been removed from the function set, and it isn't needed for performance because we call grow() ahead of time to prevent reallocations. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=124717&r1=124716&r2=124717&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Tue Feb 1 23:31:01 2011 @@ -112,23 +112,10 @@ Func = NULL; } - bool &getOrInsertCachedComparison(const ComparableFunction &Other, - bool &inserted) const { - typedef DenseMap::iterator iterator; - std::pair p = - CompareResultCache.insert(std::make_pair(Other.getFunc(), false)); - inserted = p.second; - return p.first->second; - } - private: explicit ComparableFunction(unsigned Hash) : Func(NULL), Hash(Hash), TD(NULL) {} - // DenseMap::grow() triggers a recomparison of all keys in the map, which is - // wildly expensive. This cache tries to preserve known results. - mutable DenseMap CompareResultCache; - AssertingVH Func; unsigned Hash; TargetData *TD; @@ -675,16 +662,8 @@ assert(LHS.getTD() == RHS.getTD() && "Comparing functions for different targets"); - bool inserted; - bool &result1 = LHS.getOrInsertCachedComparison(RHS, inserted); - if (!inserted) - return result1; - bool &result2 = RHS.getOrInsertCachedComparison(LHS, inserted); - if (!inserted) - return result1 = result2; - - return result1 = result2 = FunctionComparator(LHS.getTD(), LHS.getFunc(), - RHS.getFunc()).compare(); + return FunctionComparator(LHS.getTD(), LHS.getFunc(), + RHS.getFunc()).compare(); } // Replace direct callers of Old with New. From geek4civic at gmail.com Wed Feb 2 01:21:39 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Wed, 2 Feb 2011 16:21:39 +0900 Subject: [llvm-commits] [PATCH] utils/llvm-lit Improvement Message-ID: Hello Daniel, I have tweaked llvm-lit for clang tests and CMake environment. Checked on x86_64-centos5/{autoconf/cmake}, cygwin17 and msys/{autoconf/cmake}. (not tested yet on msvc. It would be harder...) On msys, env(1) is located to /bin. I have to invoke llvm-lit as eg. $ python Release+Asserts/bin/llvm-lit {tests}. Please take a look, thank you. * 0001-llvm-lit-may-be-able-to-invoke-clang-tests.patch.txt llvm-lit may be aware $(llvm_obj_root)/tools/clang/test/lit.site.cfg. * 0002-llvm-lit-may-be-available-with-CMake.patch.txt I will add +x(755) to utils/llvm-lit.in, for generated bin/llvm-lit to be executable. On CMake, two extra parameters would be needed for lit. ...Takumi -------------- next part -------------- From 14736c3c2646cc0517fac586497b7cb9bd2c8c13 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 2 Feb 2011 15:05:28 +0900 Subject: [PATCH 1/2] llvm-lit may be able to invoke clang tests. --- utils/llvm-lit/llvm-lit.in | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/utils/llvm-lit/llvm-lit.in b/utils/llvm-lit/llvm-lit.in index 3ff2c24..a16e664 100644 --- a/utils/llvm-lit/llvm-lit.in +++ b/utils/llvm-lit/llvm-lit.in @@ -16,6 +16,10 @@ builtin_parameters = { 'llvm_site_config' : os.path.join(llvm_obj_root, 'test', 'lit.site.cfg') } +clang_site_config = os.path.join(llvm_obj_root, 'tools', 'clang', 'test', 'lit.site.cfg') +if os.path.exists(clang_site_config): + builtin_parameters['clang_site_config'] = clang_site_config + if __name__=='__main__': import lit lit.main(builtin_parameters) -- 1.7.1.GIT -------------- next part -------------- From f4741d3e70c29fd9548e474574692eac3549efe8 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 2 Feb 2011 14:21:19 +0900 Subject: [PATCH 2/2] llvm-lit may be available with CMake. --- utils/llvm-lit/llvm-lit.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) mode change 100644 => 100755 utils/llvm-lit/llvm-lit.in diff --git a/utils/llvm-lit/llvm-lit.in b/utils/llvm-lit/llvm-lit.in old mode 100644 new mode 100755 index a16e664..1df1747 --- a/utils/llvm-lit/llvm-lit.in +++ b/utils/llvm-lit/llvm-lit.in @@ -13,6 +13,8 @@ sys.path.append(os.path.join(llvm_source_root, 'utils', 'lit')) # Set up some builtin parameters, so that by default the LLVM test suite # configuration file knows how to find the object tree. builtin_parameters = { + 'build_config' : "@CMAKE_CFG_INTDIR@", + 'build_mode' : "@RUNTIME_BUILD_MODE@", 'llvm_site_config' : os.path.join(llvm_obj_root, 'test', 'lit.site.cfg') } -- 1.7.1.GIT From geek4civic at gmail.com Wed Feb 2 01:38:27 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Wed, 2 Feb 2011 16:38:27 +0900 Subject: [llvm-commits] [PATCH] report_fatal_error() issue Message-ID: Dan and all, raw_fd_ostream::~raw_fd_ostream() is called as global dtors(in atexit handler). raw_fd_ostream::~raw_fd_ostream() could invoke report_fatal_error(). report_fatal_error() exits by exit(1); Then global dtors for raw_fd_ostream would be called and might crash. I propose report_fatal_error() should be suppressed at stderr's error. On Windows 7(x64), I met this issue. (I have not met on Windows XP) ...Takumi -------------- next part -------------- From c44b25c543fb9db9df08bcf688420eb81a78bd80 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 24 Jan 2011 16:02:13 +0900 Subject: [PATCH] lib/Support/raw_ostream.cpp: ErrorHandling.cpp:report_fatal_error() should not be called at dtor context when FD is 2 (stderr). --- lib/Support/raw_ostream.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index e99c12f..50b0628 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -477,7 +477,7 @@ raw_fd_ostream::~raw_fd_ostream() { // to avoid report_fatal_error calls should check for errors with // has_error() and clear the error flag with clear_error() before // destructing raw_ostream objects which may have errors. - if (has_error()) + if (has_error() && FD != 2) report_fatal_error("IO failure on output stream."); } -- 1.7.1.GIT From simbuerg at googlemail.com Wed Feb 2 03:09:05 2011 From: simbuerg at googlemail.com (Andreas Simbuerger) Date: Wed, 02 Feb 2011 10:09:05 +0100 Subject: [llvm-commits] Patch for simplifying regions In-Reply-To: References: <4D4882FC.8060102@fim.uni-passau.de> Message-ID: <4D491F31.5090004@googlemail.com> Hi Vu, thanks for enhancing my patch :-) Am 02.02.2011 01:37, schrieb Vu Le: > Hi Tobias, > > On Tue, Feb 1, 2011 at 2:02 PM, Tobias Grosser > > wrote: > > On 02/01/2011 02:03 PM, Vu Le wrote: > > Hi Tobias, Andreas, > This is my patch for regionsimplify pass. > I rename the file to RegionSimplify, change the pass name to > -regionsimplify to conform with those of Loop. > > I also update the RegionInfo and DominatorTree whenever we split the > entry or exit. > Please give me the feedbacks. > Thanks. > Vu > > > Hi Vu, > > thanks for submitting this patch. I added my comments inline. > > region-simplify.patch > > > diff --git a/include/llvm/InitializePasses.h > b/include/llvm/InitializePasses.h > index 2a17c38..a3c1eaa 100644 > --- a/include/llvm/InitializePasses.h > +++ b/include/llvm/InitializePasses.h > @@ -192,6 +192,7 @@ void initializeRegionInfoPass(PassRegistry&); > void initializeRegionOnlyPrinterPass(PassRegistry&); > void initializeRegionOnlyViewerPass(PassRegistry&); > void initializeRegionPrinterPass(PassRegistry&); > +void initializeRegionSimplifyPass(PassRegistry&); > void initializeRegionViewerPass(PassRegistry&); > void initializeRegisterCoalescerAnalysisGroup(PassRegistry&); > void initializeRenderMachineFunctionPass(PassRegistry&); > diff --git a/include/llvm/LinkAllPasses.h > b/include/llvm/LinkAllPasses.h > index 69e1bd9..ea1faec 100644 > --- a/include/llvm/LinkAllPasses.h > +++ b/include/llvm/LinkAllPasses.h > @@ -114,7 +114,8 @@ namespace { > (void) llvm::createRegionInfoPass(); > (void) llvm::createRegionOnlyPrinterPass(); > (void) llvm::createRegionOnlyViewerPass(); > - (void) llvm::createRegionPrinterPass(); > + (void) llvm::createRegionPrinterPass(); > > Any need to change this line? > > + (void) llvm::createRegionSimplifyPass(); > (void) llvm::createRegionViewerPass(); > (void) llvm::createSCCPPass(); > (void) llvm::createScalarReplAggregatesPass(); > diff --git a/include/llvm/Transforms/Scalar.h > b/include/llvm/Transforms/Scalar.h > index 6f2a38e..e3ca06a 100644 > --- a/include/llvm/Transforms/Scalar.h > +++ b/include/llvm/Transforms/Scalar.h > @@ -349,6 +349,12 @@ Pass *createCorrelatedValuePropagationPass(); > FunctionPass *createInstructionSimplifierPass(); > extern char&InstructionSimplifierID; > > +//===----------------------------------------------------------------------===// > +// > +// RegionSimplify - Simplify refined regions, if possible. > +// > +Pass *createRegionSimplifyPass(); > + > } // End llvm namespace > > #endif > diff --git a/lib/Transforms/Scalar/CMakeLists.txt > b/lib/Transforms/Scalar/CMakeLists.txt > index 106fb8f..53fcf69 100644 > --- a/lib/Transforms/Scalar/CMakeLists.txt > +++ b/lib/Transforms/Scalar/CMakeLists.txt > @@ -23,6 +23,7 @@ add_llvm_library(LLVMScalarOpts > MemCpyOptimizer.cpp > Reassociate.cpp > Reg2Mem.cpp > + RegionSimplify.cpp > SCCP.cpp > Scalar.cpp > ScalarReplAggregates.cpp > diff --git a/lib/Transforms/Scalar/RegionSimplify.cpp > b/lib/Transforms/Scalar/RegionSimplify.cpp > new file mode 100644 > index 0000000..c0b2770 > --- /dev/null > +++ b/lib/Transforms/Scalar/RegionSimplify.cpp > @@ -0,0 +1,208 @@ > +//===- SeSeRegionInfo.cpp > -------------------------------------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois > Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file converts refined regions detected by the > RegionInfo analysis > > Convert refined regions ... > > +// into simple regions. > +// > +//===----------------------------------------------------------------------===// > + > +#include "llvm/Instructions.h" > +#include "llvm/ADT/Statistic.h" > +#include "llvm/Analysis/Dominators.h" > +#include "llvm/Analysis/RegionPass.h" > +#include "llvm/Analysis/RegionInfo.h" > +#include "llvm/Transforms/Utils/BasicBlockUtils.h" > + > +#define DEBUG_TYPE "regionsimplify" > + > +using namespace llvm; > + > +STATISTIC(NumEntries, "The # of created entry edges"); > > The number of entry edges created > > +STATISTIC(NumExits, "The # of created exit edges"); > > dito. > > + > +namespace { > +class RegionSimplify: public RegionPass { > + bool modified; > + Region *CR; > + BasicBlock *createSingleEntryEdge(Region *R); > + BasicBlock *createSingleExitEdge(Region *R); > +public: > + static char ID; > + explicit RegionSimplify() : > + RegionPass(ID) { > + initializeRegionSimplifyPass(*PassRegistry::getPassRegistry()); > + } > + > + virtual void print(raw_ostream&O, const Module *M) const; > + > + virtual bool runOnRegion(Region *R, RGPassManager&RGM); > + virtual void getAnalysisUsage(AnalysisUsage&AU) const; > +}; > +} > + > +INITIALIZE_PASS(RegionSimplify, "regionsimplify", > + "Transform refined regions into simple regions", false, false) > + > +char RegionSimplify::ID = 0; > +namespace llvm { > +Pass *createRegionSimplifyPass() { > + return new RegionSimplify(); > +} > +} > + > +void RegionSimplify::print(raw_ostream&O, const Module *M) const { > + BasicBlock *enteringBlock; > + BasicBlock *exitingBlock; > + > + if (modified) { > + enteringBlock = CR->getEnteringBlock(); > + exitingBlock = CR->getExitingBlock(); > + > + O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n"; > + if (enteringBlock) > + O<< " Entry: ]"<< enteringBlock->getNameStr()<< " => " > +<< enteringBlock->getNameStr()<< "]\n"; > + if (exitingBlock) > + O<< " Exit: ["<< exitingBlock->getNameStr()<< " => " > +<< exitingBlock->getNameStr()<< "[\n"; > > Can you use CR->getNameStr() instead of formatting this yourself? > > > This is is Andreas' code. Do you mean if the region is modified, we just > print CR->getNameStr()? I thought it would be nice to have the output of both the entering and exiting nodes (if changed) and the region namestr (which shows entry & exit block). That's why I formatted this myself. > > > > + > + O<< "\n"; > + } > +} > + > +void RegionSimplify::getAnalysisUsage(AnalysisUsage&AU) const { > + AU.addPreserved (); > + AU.addRequired (); > > Does this transformation preserve RegionInfo? > > > Yes, I think RegionInfo is also preserved. There would be no point of putting effort in updating the RegionInfo if we don't preserve it. If I missed to add it, sorry ;-). > > > > +} > + > +// createSingleEntryEdge - Split the entry BasicBlock of the given > +// region after the last PHINode to form a single entry edge. > +// This is similar to CodeExtractor::severSplitPHINodes > +BasicBlock *RegionSimplify::createSingleEntryEdge(Region *R) { > + Function *f = R->getEntry()->getParent(); > + if (&f->getEntryBlock() == R->getEntry()) > + return NULL; // Entry node is the function's entry blocks > > Why do you need a special case for this? AS the entry node as never > any predecessors, I would imaging there would automatically be no > splitting. > > > I thought that we should not split regions whose entry is the function > entry. But I was wrong. We can split those. But I don't quite understand > what you mean. > > > + > + BasicBlock *oldEntry = R->getEntry(); > + PHINode *PN = dyn_cast (oldEntry->begin()); > + if (!PN) > + return NULL; // No PHI nodes. > + > + BasicBlock::iterator AfterPHIs = oldEntry->getFirstNonPHI(); > + BasicBlock *newEntry = oldEntry->splitBasicBlock(AfterPHIs, > + oldEntry->getName() + ".simregentry"); > > 'simregionentry' sounds wrong. What about '.single_region_entry', > 'singleentry', ...? > > + > + // Okay, update dominator sets. > > // Update dominator tree. > > + if (DominatorTree *DT = > getAnalysisIfAvailable()) { > + succ_iterator secondSucc = succ_begin(newEntry) + 1; > + if (secondSucc == succ_end(newEntry)) //newEntry has 1 > successor > + DT->splitBlock(newEntry); > + else { // newEntry has more than 1 successor, update DT > manually > + // oldEntry dominates newEntry. > + // newEntry node dominates all other nodes dominated by > oldEntry. > + DomTreeNode *OldNode = DT->getNode(oldEntry); > + if (OldNode) { // don't bother if oldEntry doesn't > dominates any node > + std::vector Children; > + for (DomTreeNode::iterator I = OldNode->begin(), E = > OldNode->end(); I > + != E; ++I) > + Children.push_back(*I); > + > + DomTreeNode *NewNode = DT->addNewBlock(newEntry, oldEntry); > + for (std::vector::iterator I = > Children.begin(), E = > + Children.end(); I != E; ++I) > + DT->changeImmediateDominator(*I, NewNode); > + } > + } > + } > + > + // Loop over all of the predecessors of the old entry that > are in the region, > + // changing them to branch to the new entry instead of the > old one > + for (pred_iterator PI = pred_begin(oldEntry), PE = > pred_end(oldEntry); PI > + != PE; ++PI) { > + if (R->contains(*PI)) { > + TerminatorInst *TI = (*PI)->getTerminator(); > + TI->replaceUsesOfWith(oldEntry, newEntry); > + } > + } > + // just have to update the PHI nodes now, inserting PHI nodes > into NewBB. > + for (BasicBlock::iterator PI = oldEntry->begin(); > isa (PI); ++PI) { > + PHINode *PN = cast (PI); > + // Create a new PHI node in the new region, which has an > incoming value > + // from oldEntry of PN. > + PHINode *NewPN = PHINode::Create(PN->getType(), > PN->getName() + ".ph", > + newEntry->begin()); > + > + NewPN->addIncoming(PN, oldEntry); > + > + // Loop over all of the incoming value in PN, moving them > to NewPN if they > + // are from the region. > + for (unsigned i = 0; i != PN->getNumIncomingValues(); ++i) { > + BasicBlock *HasValToPN = PN->getIncomingBlock(i); > + if (R->contains(HasValToPN)) { > + NewPN->addIncoming(PN->getIncomingValue(i), HasValToPN); > + PN->removeIncomingValue(i); > + --i; > + } > + } > + } > > Do you think we can use splitBlockPredecessors to simplify all this? > > I guess yes. The different here is if we use splitBlockPredecessors, > Entry is split into NewNode->Entry. The entry node of R is not still Entry. > > We only need to update regions whose exit is Entry. > Their exit must be changed into NewNode. > I'm not quite sure how to do that. > > > + > + return newEntry; > +} > + > +// createSingleExitEdge - Split the exit BasicBlock of the > given region > +// to form a single exit edge. > +// This does not update RegionInfo analysis. > +BasicBlock *RegionSimplify::createSingleExitEdge(Region *R) { > + BasicBlock *BB = R->getExit(); > + > + SmallVector Preds; > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI > != PE; ++PI) > + if (R->contains(*PI)) > + Preds.push_back(*PI); > + > + return SplitBlockPredecessors(BB, Preds.data(), Preds.size(), > ".simregexit", > + this); > > I propose to update RegionInfo here. Copying the setRegionFor from > runOnRegion will not be sufficient. You need to update all regions > whose entry node was the old exit node of this region. > > > Why would we do that? > Suppose another region X has entry oldExit. > In region R, oldExit is split into (NewExit->oldExit). > R is now the smallest region containing NewExit. > > I think it's still OK if the entry of X is oldExit. > > > +} > + > +bool RegionSimplify::runOnRegion(Region *R, RGPassManager&RGM) { > + RegionInfo *RI =&getAnalysis (); > + modified = false; > + > + CR = R; > + if (!R->isTopLevelRegion()) { > + BasicBlock *newBB; > + BasicBlock *oldBB; > + > + if (!(R->getEnteringBlock())) { > + oldBB = R->getEntry(); > + > + newBB = createSingleEntryEdge(R); > + if (newBB) { // update RegionInfo only if we split entry > successfully > + RI->splitBlock(newBB, oldBB); > > I would put this into createSingleEntryEdge(), as you also update > the dominance information there. > > > OK. > > > > + > + modified |= true; > + ++NumEntries; > + } > + } > + > + if (!(R->getExitingBlock())) { > + oldBB = R->getExit(); > + newBB = createSingleExitEdge(R); > + > + RI->setRegionFor(newBB, R); > > I would update the RI in the createSingleExitEdge as you also update > the regioninto there. > > OK. > I thought it would be a lot cleaner if we have the edge creation separated from the update code. > > > + > + modified |= true; > + ++NumExits; > + } > + } > + > + return modified; > +} > diff --git a/lib/Transforms/Scalar/Scalar.cpp > b/lib/Transforms/Scalar/Scalar.cpp > index bf9ca6d..5d18f22 100644 > --- a/lib/Transforms/Scalar/Scalar.cpp > +++ b/lib/Transforms/Scalar/Scalar.cpp > @@ -51,6 +51,7 @@ void > llvm::initializeScalarOpts(PassRegistry&Registry) { > initializeMemCpyOptPass(Registry); > initializeReassociatePass(Registry); > initializeRegToMemPass(Registry); > + initializeRegionSimplifyPass(Registry); > initializeSCCPPass(Registry); > initializeIPSCCPPass(Registry); > initializeSROA_DTPass(Registry); > > > Furthermore, you should add a couple of test cases for the different > branches. > > I tested with mysql code. Do you know how to verify that our pass > preserves the semantics of the program? > > Tobi > > Again I have to thank you a lot for finishing my broken patch :-) Cheers, Andreas From baldrick at free.fr Wed Feb 2 04:08:38 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Feb 2011 10:08:38 -0000 Subject: [llvm-commits] [llvm] r124720 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp unittests/ADT/TripleTest.cpp Message-ID: <20110202100838.827B62A6C12C@llvm.org> Author: baldrick Date: Wed Feb 2 04:08:38 2011 New Revision: 124720 URL: http://llvm.org/viewvc/llvm-project?rev=124720&view=rev Log: Remove NoVendor and NoOS, added in commit 123990, from Triple. While it may be useful to understand "none", this is not the place for it. Tweak the fix to Normalize while there: the fix added in 123990 works correctly, but I like this way better. Finally, now that Triple understands some non-trivial environment values, teach the unittests about them. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=124720&r1=124719&r2=124720&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Wed Feb 2 04:08:38 2011 @@ -72,8 +72,7 @@ UnknownVendor, Apple, - PC, - NoVendor + PC }; enum OSType { UnknownOS, @@ -93,8 +92,7 @@ Solaris, Win32, Haiku, - Minix, - NoOS + Minix }; enum EnvironmentType { UnknownEnvironment, Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=124720&r1=124719&r2=124720&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Wed Feb 2 04:08:38 2011 @@ -84,7 +84,6 @@ case Apple: return "apple"; case PC: return "pc"; - case NoVendor: return "none"; } return ""; @@ -110,7 +109,6 @@ case Win32: return "win32"; case Haiku: return "haiku"; case Minix: return "minix"; - case NoOS: return "none"; } return ""; @@ -299,8 +297,6 @@ return Apple; else if (VendorName == "pc") return PC; - else if (VendorName == "none") - return NoVendor; else return UnknownVendor; } @@ -338,8 +334,6 @@ return Haiku; else if (OSName.startswith("minix")) return Minix; - else if (OSName.startswith("eabi")) - return NoOS; else return UnknownOS; } @@ -363,12 +357,7 @@ Arch = ParseArch(getArchName()); Vendor = ParseVendor(getVendorName()); OS = ParseOS(getOSName()); - if (OS == NoOS) { - // Some targets don't have an OS (embedded systems) - Environment = ParseEnvironment(getOSName()); - } else { - Environment = ParseEnvironment(getEnvironmentName()); - } + Environment = ParseEnvironment(getEnvironmentName()); assert(isInitialized() && "Failed to initialize!"); } @@ -435,13 +424,7 @@ break; case 2: OS = ParseOS(Comp); - // Some targets don't have an OS (embedded systems) - if (OS == NoOS) { - Environment = ParseEnvironment(Comp); - Valid = Environment != UnknownEnvironment; - } else { - Valid = OS != UnknownOS; - } + Valid = OS != UnknownOS; break; case 3: Environment = ParseEnvironment(Comp); @@ -477,18 +460,15 @@ do { // Insert one empty component at Idx. StringRef CurrentComponent(""); // The empty component. - for (unsigned i = Idx; i < Components.size(); ++i) { - // Skip over any fixed components. - while (i < array_lengthof(Found) && Found[i]) ++i; - // Fix problem when Components vector is not big enough - if (i >= Components.size()) - Components.push_back(StringRef("")); + for (unsigned i = Idx; i < Components.size();) { // Place the component at the new position, getting the component // that was at this position - it will be moved right. std::swap(CurrentComponent, Components[i]); // If it was placed on top of an empty component then we are done. if (CurrentComponent.empty()) break; + // Advance to the next component, skipping any fixed components. + while (++i < array_lengthof(Found) && Found[i]); } // The last component was pushed off the end - append it. if (!CurrentComponent.empty()) Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=124720&r1=124719&r2=124720&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Wed Feb 2 04:08:38 2011 @@ -93,10 +93,10 @@ EXPECT_EQ(Triple::UnknownOS, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); - T = Triple("arm-none-eabi"); + T = Triple("arm-none-none-eabi"); EXPECT_EQ(Triple::arm, T.getArch()); - EXPECT_EQ(Triple::NoVendor, T.getVendor()); - EXPECT_EQ(Triple::NoOS, T.getOS()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::UnknownOS, T.getOS()); EXPECT_EQ(Triple::EABI, T.getEnvironment()); T = Triple("huh"); @@ -154,7 +154,6 @@ // Check that normalizing a permutated set of valid components returns a // triple with the unpermuted components. StringRef C[4]; - C[3] = "environment"; for (int Arch = 1+Triple::UnknownArch; Arch < Triple::InvalidArch; ++Arch) { C[0] = Triple::getArchTypeName(Triple::ArchType(Arch)); for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::PC; @@ -162,47 +161,51 @@ C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor)); for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) { C[2] = Triple::getOSTypeName(Triple::OSType(OS)); - - std::string E = Join(C[0], C[1], C[2]); - std::string F = Join(C[0], C[1], C[2], C[3]); - EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[2], C[3]))); - - // If a value has multiple interpretations, then the permutation - // test will inevitably fail. Currently this is only the case for - // "psp" which parses as both an architecture and an O/S. - if (OS == Triple::Psp) - continue; - - EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1]))); - EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0]))); - EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2]))); - EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1]))); - EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0]))); - - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[3], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[3], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[1], C[3]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[1], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[2], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[3], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[0], C[3]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[0], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[2], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[2], C[3]))); - EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[3], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[0], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[1], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[1], C[3]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[3], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[3], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[0], C[3]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[1], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[2], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[2], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[0], C[2]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[0], C[1]))); - EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[1], C[0]))); + for (int Env = 1+Triple::UnknownEnvironment; Env <= Triple::MachO; + ++Env) { + C[3] = Triple::getEnvironmentTypeName(Triple::EnvironmentType(Env)); + + std::string E = Join(C[0], C[1], C[2]); + std::string F = Join(C[0], C[1], C[2], C[3]); + EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[2], C[3]))); + + // If a value has multiple interpretations, then the permutation + // test will inevitably fail. Currently this is only the case for + // "psp" which parses as both an architecture and an O/S. + if (OS == Triple::Psp) + continue; + + EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1]))); + EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0]))); + EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2]))); + EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1]))); + EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0]))); + + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[3], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[3], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[1], C[3]))); + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[1], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[2], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[3], C[0]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[0], C[3]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[0], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[2], C[0]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[2], C[3]))); + EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[3], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[0], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[1], C[0]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[1], C[3]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[3], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[3], C[0]))); + EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[0], C[3]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[1], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[2], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[2], C[0]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[0], C[2]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[0], C[1]))); + EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[1], C[0]))); + } } } } @@ -217,6 +220,7 @@ EXPECT_EQ("i486--linux-gnu", Triple::normalize("i486-linux-gnu")); // i486-pc-linux-gnu EXPECT_EQ("i386-redhat-linux", Triple::normalize("i386-redhat-linux")); // i386-redhat-linux-gnu EXPECT_EQ("i686--linux", Triple::normalize("i686-linux")); // i686-pc-linux-gnu + EXPECT_EQ("arm-none--eabi", Triple::normalize("arm-none-eabi")); // arm-none-eabi } TEST(TripleTest, MutateName) { From Renato.Golin at arm.com Wed Feb 2 04:31:48 2011 From: Renato.Golin at arm.com (Renato Golin) Date: Wed, 2 Feb 2011 10:31:48 +0000 Subject: [llvm-commits] [llvm] r124720 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp unittests/ADT/TripleTest.cpp In-Reply-To: <20110202100838.827B62A6C12C@llvm.org> References: <20110202100838.827B62A6C12C@llvm.org> Message-ID: > Remove NoVendor and NoOS, added in commit 123990, from Triple. While it > may be useful to understand "none", this is not the place for it. Tweak > the fix to Normalize while there: the fix added in 123990 works correctly, > but I like this way better. Finally, now that Triple understands some > non-trivial environment values, teach the unittests about them. Thanks Duncan! As discussed, that seem to fix the problems. I'll add later some of the triples we discussed to the normalization unit tests, just to make sure we covered all cases. I'll also re-run all tests with my Clang patch, and probably add some more logic to Clang (like don't disable fpelim in EABI mode) and other stuff. best, --renato -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. From Renato.Golin at arm.com Wed Feb 2 05:14:39 2011 From: Renato.Golin at arm.com (Renato Golin) Date: Wed, 2 Feb 2011 11:14:39 +0000 Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp In-Reply-To: <20110201223051.C31562A6C12C@llvm.org> References: <20110201223051.C31562A6C12C@llvm.org> Message-ID: Hi Bob, Two things... First, silly comment but, would be good to update the comment just above (all in one pop) to reflect the change. Second, I'm not a JIT expert (nor I know the full context), but does that mix with the requirement of using BX LR (for ARM/Thumb switch)? Or the JOT never mix them up anyway? cheers, --renato ________________________________________ From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Bob Wilson [bob.wilson at apple.com] Sent: 01 February 2011 22:30 To: llvm-commits at cs.uiuc.edu Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Author: bwilson Date: Tue Feb 1 16:30:51 2011 New Revision: 124694 URL: http://llvm.org/viewvc/llvm-project?rev=124694&view=rev Log: PR9081: Split up LDM instruction with deprecated use of both LR and PC. This is completely untested but pretty straightforward, so hopefully I got it right. Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=124694&r1=124693&r2=124694&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Tue Feb 1 16:30:51 2011 @@ -43,7 +43,7 @@ #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) // CompilationCallback stub - We can't use a C function with inline assembly in -// it, because we the prolog/epilog inserted by GCC won't work for us (we need +// it, because the prolog/epilog inserted by GCC won't work for us. (We need // to preserve more context and manipulate the stack directly). Instead, // write our own wrapper, which does things our way, so we have complete // control over register saving and restoring. @@ -99,7 +99,8 @@ // The above twiddling of the saved return addresses allows us to // deallocate everything, including the LR the stub saved, all in one // pop instruction. - "ldmia sp!, {r0, r1, r2, r3, lr, pc}\n" + "ldmia sp!, {r0, r1, r2, r3, lr}\n" + "ldr pc, [sp], #4\n" ); #else // Not an ARM host void ARMCompilationCallback() { _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. From richard at xmos.com Wed Feb 2 08:57:41 2011 From: richard at xmos.com (Richard Osborne) Date: Wed, 02 Feb 2011 14:57:41 -0000 Subject: [llvm-commits] [llvm] r124722 - in /llvm/trunk: lib/Target/XCore/XCoreCallingConv.td lib/Target/XCore/XCoreFrameLowering.cpp lib/Target/XCore/XCoreISelLowering.cpp lib/Target/XCore/XCoreISelLowering.h test/CodeGen/XCore/trampoline.ll Message-ID: <20110202145741.A70B42A6C12C@llvm.org> Author: friedgold Date: Wed Feb 2 08:57:41 2011 New Revision: 124722 URL: http://llvm.org/viewvc/llvm-project?rev=124722&view=rev Log: Add support for trampolines on the XCore. Added: llvm/trunk/test/CodeGen/XCore/trampoline.ll Modified: llvm/trunk/lib/Target/XCore/XCoreCallingConv.td llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Modified: llvm/trunk/lib/Target/XCore/XCoreCallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreCallingConv.td?rev=124722&r1=124721&r2=124722&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreCallingConv.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreCallingConv.td Wed Feb 2 08:57:41 2011 @@ -24,6 +24,9 @@ // Promote i8/i16 arguments to i32. CCIfType<[i8, i16], CCPromoteToType>, + // The 'nest' parameter, if any, is passed in R11. + CCIfNest>, + // The first 4 integer arguments are passed in integer registers. CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, Modified: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp?rev=124722&r1=124721&r2=124722&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp Wed Feb 2 08:57:41 2011 @@ -100,6 +100,11 @@ DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc(); bool FP = hasFP(MF); + bool Nested = MF.getFunction()->getAttributes().hasAttrSomewhere(Attribute::Nest); + + if (Nested) { + loadFromStack(MBB, MBBI, XCore::R11, 0, dl, TII); + } // Work out frame sizes. int FrameSize = MFI->getStackSize(); Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=124722&r1=124721&r2=124722&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Feb 2 08:57:41 2011 @@ -148,7 +148,10 @@ setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand); - + + // TRAMPOLINE is custom lowered. + setOperationAction(ISD::TRAMPOLINE, MVT::Other, Custom); + maxStoresPerMemset = maxStoresPerMemsetOptSize = 4; maxStoresPerMemmove = maxStoresPerMemmoveOptSize = maxStoresPerMemcpy = maxStoresPerMemcpyOptSize = 2; @@ -178,6 +181,7 @@ case ISD::ADD: case ISD::SUB: return ExpandADDSUB(Op.getNode(), DAG); case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG); + case ISD::TRAMPOLINE: return LowerTRAMPOLINE(Op, DAG); default: llvm_unreachable("unimplemented operand"); return SDValue(); @@ -794,6 +798,64 @@ RegInfo->getFrameRegister(MF), MVT::i32); } +SDValue XCoreTargetLowering:: +LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) const { + SDValue Chain = Op.getOperand(0); + SDValue Trmp = Op.getOperand(1); // trampoline + SDValue FPtr = Op.getOperand(2); // nested function + SDValue Nest = Op.getOperand(3); // 'nest' parameter value + + const Value *TrmpAddr = cast(Op.getOperand(4))->getValue(); + + // .align 4 + // LDAPF_u10 r11, nest + // LDW_2rus r11, r11[0] + // STWSP_ru6 r11, sp[0] + // LDAPF_u10 r11, fptr + // LDW_2rus r11, r11[0] + // BAU_1r r11 + // nest: + // .word nest + // fptr: + // .word fptr + SDValue OutChains[5]; + + SDValue Addr = Trmp; + + DebugLoc dl = Op.getDebugLoc(); + OutChains[0] = DAG.getStore(Chain, dl, DAG.getConstant(0x0a3cd805, MVT::i32), + Addr, MachinePointerInfo(TrmpAddr), false, false, + 0); + + Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp, + DAG.getConstant(4, MVT::i32)); + OutChains[1] = DAG.getStore(Chain, dl, DAG.getConstant(0xd80456c0, MVT::i32), + Addr, MachinePointerInfo(TrmpAddr, 4), false, + false, 0); + + Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp, + DAG.getConstant(8, MVT::i32)); + OutChains[2] = DAG.getStore(Chain, dl, DAG.getConstant(0x27fb0a3c, MVT::i32), + Addr, MachinePointerInfo(TrmpAddr, 8), false, + false, 0); + + Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp, + DAG.getConstant(12, MVT::i32)); + OutChains[3] = DAG.getStore(Chain, dl, Nest, Addr, + MachinePointerInfo(TrmpAddr, 12), false, false, + 0); + + Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp, + DAG.getConstant(16, MVT::i32)); + OutChains[4] = DAG.getStore(Chain, dl, FPtr, Addr, + MachinePointerInfo(TrmpAddr, 16), false, false, + 0); + + SDValue Ops[] = + { Trmp, DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains, 5) }; + return DAG.getMergeValues(Ops, 2, dl); +} + //===----------------------------------------------------------------------===// // Calling Convention Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=124722&r1=124721&r2=124722&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Wed Feb 2 08:57:41 2011 @@ -147,6 +147,7 @@ SDValue LowerUMUL_LOHI(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSMUL_LOHI(SDValue Op, SelectionDAG &DAG) const; SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; // Inline asm support std::vector Added: llvm/trunk/test/CodeGen/XCore/trampoline.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/trampoline.ll?rev=124722&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/trampoline.ll (added) +++ llvm/trunk/test/CodeGen/XCore/trampoline.ll Wed Feb 2 08:57:41 2011 @@ -0,0 +1,37 @@ +; RUN: llc < %s -march=xcore | FileCheck %s + +%struct.FRAME.f = type { i32, i32 ()* } + +define void @f() nounwind { +entry: +; CHECK: f: +; CHECK ldap r11, g.1101 +; CHECK stw r11, sp[7] + %TRAMP.23 = alloca [20 x i8], align 2 + %FRAME.0 = alloca %struct.FRAME.f, align 4 + %TRAMP.23.sub = getelementptr inbounds [20 x i8]* %TRAMP.23, i32 0, i32 0 + %FRAME.02 = bitcast %struct.FRAME.f* %FRAME.0 to i8* + %tramp = call i8* @llvm.init.trampoline(i8* %TRAMP.23.sub, i8* bitcast (i32 (%struct.FRAME.f*)* @g.1101 to i8*), i8* %FRAME.02) + %0 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 1 + %1 = bitcast i8* %tramp to i32 ()* + store i32 ()* %1, i32 ()** %0, align 4 + %2 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 0 + store i32 1, i32* %2, align 4 + call void @h(i32 ()* %1) nounwind + ret void +} + +define internal i32 @g.1101(%struct.FRAME.f* nocapture nest %CHAIN.1) nounwind readonly { +entry: +; CHECK: g.1101: +; CHECK: ldw r11, sp[0] +; CHECK-NEXT: ldw r0, r11[0] +; CHECK-NEXT: retsp 0 + %0 = getelementptr inbounds %struct.FRAME.f* %CHAIN.1, i32 0, i32 0 + %1 = load i32* %0, align 4 + ret i32 %1 +} + +declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind + +declare void @h(i32 ()*) From benny.kra at googlemail.com Wed Feb 2 09:56:22 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 02 Feb 2011 15:56:22 -0000 Subject: [llvm-commits] [llvm] r124724 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll test/Transforms/SimplifyCFG/switch_formation.dbg.ll Message-ID: <20110202155622.9F92F2A6C12C@llvm.org> Author: d0k Date: Wed Feb 2 09:56:22 2011 New Revision: 124724 URL: http://llvm.org/viewvc/llvm-project?rev=124724&view=rev Log: SimplifyCFG: Turn switches into sub+icmp+branch if possible. This makes the job of the later optzn passes easier, allowing the vast amount of icmp transforms to chew on it. We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting binary on i386-linux. The testcase from README.txt now compiles into decl %edi cmpl $3, %edi sbbl %eax, %eax andl $1, %eax ret Modified: llvm/trunk/lib/Target/README.txt llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll llvm/trunk/test/Transforms/SimplifyCFG/switch_formation.dbg.ll Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=124724&r1=124723&r2=124724&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 2 09:56:22 2011 @@ -2274,51 +2274,3 @@ avoids partial register stalls in some important cases. //===---------------------------------------------------------------------===// - -With PR8575 we're now generating better code for: - -static _Bool foo(int x) { return x == 1; } -static _Bool bar(int x) { return x == 2; } -static _Bool baz(int x) { return x == 3; } - -_Bool quux(int x) { - return foo(x) || bar(x) || baz(x); -} - -$ clang t.c -S -o - -O3 -mkernel -fomit-frame-pointer -_quux: ## @quux -## BB#0: ## %entry - decl %edi - cmpl $3, %edi - movb $1, %al - jb LBB0_2 -## BB#1: ## %lor.rhs - xorb %al, %al -LBB0_2: ## %lor.end - movzbl %al, %eax - andl $1, %eax - ret - -But this should use a "setcc" instead of materializing a 0/1 value -the hard way. This looks like #1: simplifycfg should transform the -switch into a sub+icmp+branch, and an instcombine hack to replace -the PHI with a zext of the branch condition. Here's the IR today: - -define zeroext i1 @quux(i32 %x) nounwind readnone ssp noredzone { -entry: - switch i32 %x, label %lor.rhs [ - i32 1, label %lor.end - i32 2, label %lor.end - i32 3, label %lor.end - ] - -lor.rhs: ; preds = %entry - br label %lor.end - -lor.end: ; preds = %lor.rhs, %entry, %entry, %entry - %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ] - ret i1 %0 -} - -//===---------------------------------------------------------------------===// - Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=124724&r1=124723&r2=124724&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Feb 2 09:56:22 2011 @@ -2237,6 +2237,34 @@ return Changed; } +/// TurnSwitchRangeIntoICmp - Turns a switch with that contains only a +/// integer range comparison into a sub, an icmp and a branch. +static bool TurnSwitchRangeIntoICmp(SwitchInst *SI) { + assert(SI->getNumCases() > 2 && "Degenerate switch?"); + // We can do this transform if the switch consists of an ascending series + // and all cases point to the same destination. + for (unsigned I = 2, E = SI->getNumCases(); I != E; ++I) + if (SI->getSuccessor(I-1) != SI->getSuccessor(I) || + SI->getCaseValue(I-1)->getValue()+1 != SI->getCaseValue(I)->getValue()) + return false; + + Constant *Offset = ConstantExpr::getNeg(SI->getCaseValue(1)); + Constant *NumCases = ConstantInt::get(Offset->getType(), SI->getNumCases()-1); + + Value *Sub = BinaryOperator::CreateAdd(SI->getCondition(), Offset, "off", SI); + Value *Cmp = new ICmpInst(SI, ICmpInst::ICMP_ULT, Sub, NumCases, "switch"); + BranchInst::Create(SI->getSuccessor(1), SI->getDefaultDest(), Cmp, SI); + + // Prune obsolete incoming values off the successor's PHI nodes. + for (BasicBlock::iterator BBI = SI->getSuccessor(1)->begin(); + isa(BBI); ++BBI) { + for (unsigned I = 0, E = SI->getNumCases()-2; I != E; ++I) + cast(BBI)->removeIncomingValue(SI->getParent()); + } + SI->eraseFromParent(); + + return true; +} bool SimplifyCFGOpt::SimplifySwitch(SwitchInst *SI) { // If this switch is too complex to want to look at, ignore it. @@ -2260,6 +2288,10 @@ if (SI == &*BBI) if (FoldValueComparisonIntoPredecessors(SI)) return SimplifyCFG(BB) | true; + + // Try to transform the switch into an icmp and a branch. + if (TurnSwitchRangeIntoICmp(SI)) + return SimplifyCFG(BB) | true; return false; } Modified: llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll?rev=124724&r1=124723&r2=124724&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll Wed Feb 2 09:56:22 2011 @@ -141,14 +141,8 @@ ret i1 %UnifiedRetVal ; CHECK: @test6 -; CHECK: switch i32 %tmp.2.i, label %shortcirc_next.4 [ -; CHECK: i32 14, label %UnifiedReturnBlock -; CHECK: i32 15, label %UnifiedReturnBlock -; CHECK: i32 16, label %UnifiedReturnBlock -; CHECK: i32 17, label %UnifiedReturnBlock -; CHECK: i32 18, label %UnifiedReturnBlock -; CHECK: i32 19, label %UnifiedReturnBlock -; CHECK: ] +; CHECK: %off = add i32 %tmp.2.i, -14 +; CHECK: %switch = icmp ult i32 %off, 6 } define void @test7(i8 zeroext %c, i32 %x) nounwind ssp noredzone { @@ -447,11 +441,8 @@ define zeroext i1 @test16(i32 %x) nounwind { entry: ; CHECK: @test16 -; CHECK: switch i32 %x, label %lor.rhs [ -; CHECK: i32 1, label %lor.end -; CHECK: i32 2, label %lor.end -; CHECK: i32 3, label %lor.end -; CHECK: ] +; CHECK: %off = add i32 %x, -1 +; CHECK: %switch = icmp ult i32 %off, 3 %cmp.i = icmp eq i32 %x, 1 br i1 %cmp.i, label %lor.end, label %lor.lhs.false Modified: llvm/trunk/test/Transforms/SimplifyCFG/switch_formation.dbg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch_formation.dbg.ll?rev=124724&r1=124723&r2=124724&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/switch_formation.dbg.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/switch_formation.dbg.ll Wed Feb 2 09:56:22 2011 @@ -13,15 +13,9 @@ declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind define i1 @t({ i32, i32 }* %I) { -; CHECK: t -; CHECK: switch i32 %tmp.2.i, label %shortcirc_next.4 [ -; CHECK: i32 14, label %UnifiedReturnBlock -; CHECK: i32 15, label %UnifiedReturnBlock -; CHECK: i32 16, label %UnifiedReturnBlock -; CHECK: i32 17, label %UnifiedReturnBlock -; CHECK: i32 18, label %UnifiedReturnBlock -; CHECK: i32 19, label %UnifiedReturnBlock -; CHECK: ] +; CHECK: @t +; CHECK: %off = add i32 %tmp.2.i, -14 +; CHECK: %switch = icmp ult i32 %off, 6 entry: %tmp.1.i = getelementptr { i32, i32 }* %I, i64 0, i32 1 ; [#uses=1] %tmp.2.i = load i32* %tmp.1.i ; [#uses=6] From gohman at apple.com Wed Feb 2 11:15:19 2011 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Feb 2011 09:15:19 -0800 Subject: [llvm-commits] [PATCH] report_fatal_error() issue In-Reply-To: References: Message-ID: <58C3D007-6443-40B5-A2AB-F1938D0CC5AC@apple.com> On Feb 1, 2011, at 11:38 PM, NAKAMURA Takumi wrote: > Dan and all, > > raw_fd_ostream::~raw_fd_ostream() is called as global dtors(in > atexit handler). > raw_fd_ostream::~raw_fd_ostream() could invoke report_fatal_error(). > report_fatal_error() exits by exit(1); > > Then global dtors for raw_fd_ostream would be called and might crash. > > I propose report_fatal_error() should be suppressed at stderr's error. > > On Windows 7(x64), I met this issue. (I have not met on Windows XP) If there's a real bug here, please explain it. Otherwise, this seems to be some Windows quirk, so it should be conditionalized with #if accordingly. In either case, please add a comment in the code. Dan From bob.wilson at apple.com Wed Feb 2 11:17:04 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 2 Feb 2011 09:17:04 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: <20110129044624.089B12A6C12C@llvm.org> References: <20110129044624.089B12A6C12C@llvm.org> Message-ID: <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote: > Author: evancheng > Date: Fri Jan 28 22:46:23 2011 > New Revision: 124526 > > URL: http://llvm.org/viewvc/llvm-project?rev=124526&view=rev > Log: > Re-apply r124518 with fix. Watch out for invalidated iterator. > > Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) > +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011 > @@ -502,7 +505,7 @@ > } > // Heuristically, don't tail-duplicate calls if it would expand code size, > // as it's less likely to be worth the extra cost. > - if (InstrCount > 1 && HasCall) > + if (InstrCount > 1 && (PreRegAlloc && HasCall)) What is this change for? The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it. This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch. If there's a good reason for this, could you add a comment to explain? From bob.wilson at apple.com Wed Feb 2 11:26:37 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 2 Feb 2011 09:26:37 -0800 Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp In-Reply-To: References: <20110201223051.C31562A6C12C@llvm.org> Message-ID: On Feb 2, 2011, at 3:14 AM, Renato Golin wrote: > Hi Bob, > > Two things... > > First, silly comment but, would be good to update the comment just above (all in one pop) to reflect the change. Sure, I can do that. > > Second, I'm not a JIT expert (nor I know the full context), but does that mix with the requirement of using BX LR (for ARM/Thumb switch)? Or the JOT never mix them up anyway? Last time I checked (quite a while ago) the JIT only supported ARM. The "ldr pc" instruction will support interworking in v5T and beyond, and it's no worse in that respect than the ldm instruction used before. I'm not at all familiar with this code, but as far as I can tell, it is supposed to branch with _all_ of the registers restored to their original values, including LR. So that pretty much rules out using "bx lr".... At least this way it will avoid the build failure. > > cheers, > --renato > > ________________________________________ > From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Bob Wilson [bob.wilson at apple.com] > Sent: 01 February 2011 22:30 > To: llvm-commits at cs.uiuc.edu > Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp > > Author: bwilson > Date: Tue Feb 1 16:30:51 2011 > New Revision: 124694 > > URL: http://llvm.org/viewvc/llvm-project?rev=124694&view=rev > Log: > PR9081: Split up LDM instruction with deprecated use of both LR and PC. > This is completely untested but pretty straightforward, so hopefully I > got it right. > > Modified: > llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp > > Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=124694&r1=124693&r2=124694&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Tue Feb 1 16:30:51 2011 > @@ -43,7 +43,7 @@ > #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) > > // CompilationCallback stub - We can't use a C function with inline assembly in > -// it, because we the prolog/epilog inserted by GCC won't work for us (we need > +// it, because the prolog/epilog inserted by GCC won't work for us. (We need > // to preserve more context and manipulate the stack directly). Instead, > // write our own wrapper, which does things our way, so we have complete > // control over register saving and restoring. > @@ -99,7 +99,8 @@ > // The above twiddling of the saved return addresses allows us to > // deallocate everything, including the LR the stub saved, all in one > // pop instruction. > - "ldmia sp!, {r0, r1, r2, r3, lr, pc}\n" > + "ldmia sp!, {r0, r1, r2, r3, lr}\n" > + "ldr pc, [sp], #4\n" > ); > #else // Not an ARM host > void ARMCompilationCallback() { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. > From bob.wilson at apple.com Wed Feb 2 11:29:40 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 02 Feb 2011 17:29:40 -0000 Subject: [llvm-commits] [llvm] r124725 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Message-ID: <20110202172940.A702A2A6C12E@llvm.org> Author: bwilson Date: Wed Feb 2 11:29:40 2011 New Revision: 124725 URL: http://llvm.org/viewvc/llvm-project?rev=124725&view=rev Log: Update comment to match my recent change. Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=124725&r1=124724&r2=124725&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Wed Feb 2 11:29:40 2011 @@ -97,8 +97,8 @@ "str r0, [sp,#16]\n" // Return to the (newly modified) stub to invoke the real function. // The above twiddling of the saved return addresses allows us to - // deallocate everything, including the LR the stub saved, all in one - // pop instruction. + // deallocate everything, including the LR the stub saved, with two + // updating load instructions. "ldmia sp!, {r0, r1, r2, r3, lr}\n" "ldr pc, [sp], #4\n" ); From Renato.Golin at arm.com Wed Feb 2 11:34:54 2011 From: Renato.Golin at arm.com (Renato Golin) Date: Wed, 2 Feb 2011 17:34:54 +0000 Subject: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp In-Reply-To: References: <20110201223051.C31562A6C12C@llvm.org> , Message-ID: Great, thanks! --renato ________________________________________ From: Bob Wilson [bob.wilson at apple.com] Sent: 02 February 2011 17:26 To: Renato Golin Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] [llvm] r124694 - /llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp On Feb 2, 2011, at 3:14 AM, Renato Golin wrote: > Hi Bob, > > Two things... > > First, silly comment but, would be good to update the comment just above (all in one pop) to reflect the change. Sure, I can do that. > > Second, I'm not a JIT expert (nor I know the full context), but does that mix with the requirement of using BX LR (for ARM/Thumb switch)? Or the JOT never mix them up anyway? Last time I checked (quite a while ago) the JIT only supported ARM. The "ldr pc" instruction will support interworking in v5T and beyond, and it's no worse in that respect than the ldm instruction used before. I'm not at all familiar with this code, but as far as I can tell, it is supposed to branch with _all_ of the registers restored to their original values, including LR. So that pretty much rules out using "bx lr".... At least this way it will avoid the build failure. -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. From vmle at ucdavis.edu Wed Feb 2 11:46:37 2011 From: vmle at ucdavis.edu (Vu Le) Date: Wed, 2 Feb 2011 09:46:37 -0800 Subject: [llvm-commits] Patch for simplifying regions In-Reply-To: <4D491F31.5090004@googlemail.com> References: <4D4882FC.8060102@fim.uni-passau.de> <4D491F31.5090004@googlemail.com> Message-ID: Hi Andreas, On Wed, Feb 2, 2011 at 1:09 AM, Andreas Simbuerger wrote: > Hi Vu, > > thanks for enhancing my patch :-) > > Am 02.02.2011 01:37, schrieb Vu Le: > > Hi Tobias, > > > > On Tue, Feb 1, 2011 at 2:02 PM, Tobias Grosser > > > wrote: > > > > On 02/01/2011 02:03 PM, Vu Le wrote: > > > > Hi Tobias, Andreas, > > This is my patch for regionsimplify pass. > > I rename the file to RegionSimplify, change the pass name to > > -regionsimplify to conform with those of Loop. > > > > I also update the RegionInfo and DominatorTree whenever we split > the > > entry or exit. > > Please give me the feedbacks. > > Thanks. > > Vu > > > > > > Hi Vu, > > > > thanks for submitting this patch. I added my comments inline. > > > > region-simplify.patch > > > > > > diff --git a/include/llvm/InitializePasses.h > > b/include/llvm/InitializePasses.h > > index 2a17c38..a3c1eaa 100644 > > --- a/include/llvm/InitializePasses.h > > +++ b/include/llvm/InitializePasses.h > > @@ -192,6 +192,7 @@ void initializeRegionInfoPass(PassRegistry&); > > void initializeRegionOnlyPrinterPass(PassRegistry&); > > void initializeRegionOnlyViewerPass(PassRegistry&); > > void initializeRegionPrinterPass(PassRegistry&); > > +void initializeRegionSimplifyPass(PassRegistry&); > > void initializeRegionViewerPass(PassRegistry&); > > void initializeRegisterCoalescerAnalysisGroup(PassRegistry&); > > void initializeRenderMachineFunctionPass(PassRegistry&); > > diff --git a/include/llvm/LinkAllPasses.h > > b/include/llvm/LinkAllPasses.h > > index 69e1bd9..ea1faec 100644 > > --- a/include/llvm/LinkAllPasses.h > > +++ b/include/llvm/LinkAllPasses.h > > @@ -114,7 +114,8 @@ namespace { > > (void) llvm::createRegionInfoPass(); > > (void) llvm::createRegionOnlyPrinterPass(); > > (void) llvm::createRegionOnlyViewerPass(); > > - (void) llvm::createRegionPrinterPass(); > > + (void) llvm::createRegionPrinterPass(); > > > > Any need to change this line? > > > > + (void) llvm::createRegionSimplifyPass(); > > (void) llvm::createRegionViewerPass(); > > (void) llvm::createSCCPPass(); > > (void) llvm::createScalarReplAggregatesPass(); > > diff --git a/include/llvm/Transforms/Scalar.h > > b/include/llvm/Transforms/Scalar.h > > index 6f2a38e..e3ca06a 100644 > > --- a/include/llvm/Transforms/Scalar.h > > +++ b/include/llvm/Transforms/Scalar.h > > @@ -349,6 +349,12 @@ Pass > *createCorrelatedValuePropagationPass(); > > FunctionPass *createInstructionSimplifierPass(); > > extern char&InstructionSimplifierID; > > > > > +//===----------------------------------------------------------------------===// > > +// > > +// RegionSimplify - Simplify refined regions, if possible. > > +// > > +Pass *createRegionSimplifyPass(); > > + > > } // End llvm namespace > > > > #endif > > diff --git a/lib/Transforms/Scalar/CMakeLists.txt > > b/lib/Transforms/Scalar/CMakeLists.txt > > index 106fb8f..53fcf69 100644 > > --- a/lib/Transforms/Scalar/CMakeLists.txt > > +++ b/lib/Transforms/Scalar/CMakeLists.txt > > @@ -23,6 +23,7 @@ add_llvm_library(LLVMScalarOpts > > MemCpyOptimizer.cpp > > Reassociate.cpp > > Reg2Mem.cpp > > + RegionSimplify.cpp > > SCCP.cpp > > Scalar.cpp > > ScalarReplAggregates.cpp > > diff --git a/lib/Transforms/Scalar/RegionSimplify.cpp > > b/lib/Transforms/Scalar/RegionSimplify.cpp > > new file mode 100644 > > index 0000000..c0b2770 > > --- /dev/null > > +++ b/lib/Transforms/Scalar/RegionSimplify.cpp > > @@ -0,0 +1,208 @@ > > +//===- SeSeRegionInfo.cpp > > -------------------------------------------------===// > > +// > > +// The LLVM Compiler Infrastructure > > +// > > +// This file is distributed under the University of Illinois > > Open Source > > +// License. See LICENSE.TXT for details. > > +// > > > +//===----------------------------------------------------------------------===// > > +// > > +// This file converts refined regions detected by the > > RegionInfo analysis > > > > Convert refined regions ... > > > > +// into simple regions. > > +// > > > +//===----------------------------------------------------------------------===// > > + > > +#include "llvm/Instructions.h" > > +#include "llvm/ADT/Statistic.h" > > +#include "llvm/Analysis/Dominators.h" > > +#include "llvm/Analysis/RegionPass.h" > > +#include "llvm/Analysis/RegionInfo.h" > > +#include "llvm/Transforms/Utils/BasicBlockUtils.h" > > + > > +#define DEBUG_TYPE "regionsimplify" > > + > > +using namespace llvm; > > + > > +STATISTIC(NumEntries, "The # of created entry edges"); > > > > The number of entry edges created > > > > +STATISTIC(NumExits, "The # of created exit edges"); > > > > dito. > > > > + > > +namespace { > > +class RegionSimplify: public RegionPass { > > + bool modified; > > + Region *CR; > > + BasicBlock *createSingleEntryEdge(Region *R); > > + BasicBlock *createSingleExitEdge(Region *R); > > +public: > > + static char ID; > > + explicit RegionSimplify() : > > + RegionPass(ID) { > > + > initializeRegionSimplifyPass(*PassRegistry::getPassRegistry()); > > + } > > + > > + virtual void print(raw_ostream&O, const Module *M) const; > > + > > + virtual bool runOnRegion(Region *R, RGPassManager&RGM); > > + virtual void getAnalysisUsage(AnalysisUsage&AU) const; > > +}; > > +} > > + > > +INITIALIZE_PASS(RegionSimplify, "regionsimplify", > > + "Transform refined regions into simple regions", false, > false) > > + > > +char RegionSimplify::ID = 0; > > +namespace llvm { > > +Pass *createRegionSimplifyPass() { > > + return new RegionSimplify(); > > +} > > +} > > + > > +void RegionSimplify::print(raw_ostream&O, const Module *M) const > { > > + BasicBlock *enteringBlock; > > + BasicBlock *exitingBlock; > > + > > + if (modified) { > > + enteringBlock = CR->getEnteringBlock(); > > + exitingBlock = CR->getExitingBlock(); > > + > > + O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n"; > > + if (enteringBlock) > > + O<< " Entry: ]"<< enteringBlock->getNameStr()<< " => > " > > +<< enteringBlock->getNameStr()<< "]\n"; > > + if (exitingBlock) > > + O<< " Exit: ["<< exitingBlock->getNameStr()<< " => " > > +<< exitingBlock->getNameStr()<< "[\n"; > > > > Can you use CR->getNameStr() instead of formatting this yourself? > > > > > > This is is Andreas' code. Do you mean if the region is modified, we just > > print CR->getNameStr()? > > I thought it would be nice to have the output of both the entering and > exiting nodes (if changed) and the region namestr (which shows entry & > exit block). That's why I formatted this myself. > > > > > > > > > + > > + O<< "\n"; > > + } > > +} > > + > > +void RegionSimplify::getAnalysisUsage(AnalysisUsage&AU) const { > > + AU.addPreserved (); > > + AU.addRequired (); > > > > Does this transformation preserve RegionInfo? > > > > > > Yes, I think RegionInfo is also preserved. > > There would be no point of putting effort in updating the RegionInfo if > we don't preserve it. If I missed to add it, sorry ;-). > > We need to update RegionInfo to reflect the changes. Otherwise when you visit the next region, your pass will break. > > > > > > > > +} > > + > > +// createSingleEntryEdge - Split the entry BasicBlock of the > given > > +// region after the last PHINode to form a single entry edge. > > +// This is similar to CodeExtractor::severSplitPHINodes > > +BasicBlock *RegionSimplify::createSingleEntryEdge(Region *R) { > > + Function *f = R->getEntry()->getParent(); > > + if (&f->getEntryBlock() == R->getEntry()) > > + return NULL; // Entry node is the function's entry blocks > > > > Why do you need a special case for this? AS the entry node as never > > any predecessors, I would imaging there would automatically be no > > splitting. > > > > > > I thought that we should not split regions whose entry is the function > > entry. But I was wrong. We can split those. But I don't quite understand > > what you mean. > > > > > > + > > + BasicBlock *oldEntry = R->getEntry(); > > + PHINode *PN = dyn_cast (oldEntry->begin()); > > + if (!PN) > > + return NULL; // No PHI nodes. > > + > > + BasicBlock::iterator AfterPHIs = oldEntry->getFirstNonPHI(); > > + BasicBlock *newEntry = oldEntry->splitBasicBlock(AfterPHIs, > > + oldEntry->getName() + ".simregentry"); > > > > 'simregionentry' sounds wrong. What about '.single_region_entry', > > 'singleentry', ...? > > > > + > > + // Okay, update dominator sets. > > > > // Update dominator tree. > > > > + if (DominatorTree *DT = > > getAnalysisIfAvailable()) { > > + succ_iterator secondSucc = succ_begin(newEntry) + 1; > > + if (secondSucc == succ_end(newEntry)) //newEntry has 1 > > successor > > + DT->splitBlock(newEntry); > > + else { // newEntry has more than 1 successor, update DT > > manually > > + // oldEntry dominates newEntry. > > + // newEntry node dominates all other nodes dominated by > > oldEntry. > > + DomTreeNode *OldNode = DT->getNode(oldEntry); > > + if (OldNode) { // don't bother if oldEntry doesn't > > dominates any node > > + std::vector Children; > > + for (DomTreeNode::iterator I = OldNode->begin(), E = > > OldNode->end(); I > > + != E; ++I) > > + Children.push_back(*I); > > + > > + DomTreeNode *NewNode = DT->addNewBlock(newEntry, > oldEntry); > > + for (std::vector::iterator I = > > Children.begin(), E = > > + Children.end(); I != E; ++I) > > + DT->changeImmediateDominator(*I, NewNode); > > + } > > + } > > + } > > + > > + // Loop over all of the predecessors of the old entry that > > are in the region, > > + // changing them to branch to the new entry instead of the > > old one > > + for (pred_iterator PI = pred_begin(oldEntry), PE = > > pred_end(oldEntry); PI > > + != PE; ++PI) { > > + if (R->contains(*PI)) { > > + TerminatorInst *TI = (*PI)->getTerminator(); > > + TI->replaceUsesOfWith(oldEntry, newEntry); > > + } > > + } > > + // just have to update the PHI nodes now, inserting PHI nodes > > into NewBB. > > + for (BasicBlock::iterator PI = oldEntry->begin(); > > isa (PI); ++PI) { > > + PHINode *PN = cast (PI); > > + // Create a new PHI node in the new region, which has an > > incoming value > > + // from oldEntry of PN. > > + PHINode *NewPN = PHINode::Create(PN->getType(), > > PN->getName() + ".ph", > > + newEntry->begin()); > > + > > + NewPN->addIncoming(PN, oldEntry); > > + > > + // Loop over all of the incoming value in PN, moving them > > to NewPN if they > > + // are from the region. > > + for (unsigned i = 0; i != PN->getNumIncomingValues(); ++i) { > > + BasicBlock *HasValToPN = PN->getIncomingBlock(i); > > + if (R->contains(HasValToPN)) { > > + NewPN->addIncoming(PN->getIncomingValue(i), HasValToPN); > > + PN->removeIncomingValue(i); > > + --i; > > + } > > + } > > + } > > > > Do you think we can use splitBlockPredecessors to simplify all this? > > > > I guess yes. The different here is if we use splitBlockPredecessors, > > Entry is split into NewNode->Entry. The entry node of R is not still > Entry. > > > > We only need to update regions whose exit is Entry. > > Their exit must be changed into NewNode. > > I'm not quite sure how to do that. > Do you have any idea how to do that? Update Entry is simpler since it belongs to the region. Exit node does not. > > > > > > + > > + return newEntry; > > +} > > + > > +// createSingleExitEdge - Split the exit BasicBlock of the > > given region > > +// to form a single exit edge. > > +// This does not update RegionInfo analysis. > > +BasicBlock *RegionSimplify::createSingleExitEdge(Region *R) { > > + BasicBlock *BB = R->getExit(); > > + > > + SmallVector Preds; > > + for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI > > != PE; ++PI) > > + if (R->contains(*PI)) > > + Preds.push_back(*PI); > > + > > + return SplitBlockPredecessors(BB, Preds.data(), Preds.size(), > > ".simregexit", > > + this); > > > > I propose to update RegionInfo here. Copying the setRegionFor from > > runOnRegion will not be sufficient. You need to update all regions > > whose entry node was the old exit node of this region. > > > > > > Why would we do that? > > Suppose another region X has entry oldExit. > > In region R, oldExit is split into (NewExit->oldExit). > > R is now the smallest region containing NewExit. > > > > I think it's still OK if the entry of X is oldExit. > > > > > > +} > > + > > +bool RegionSimplify::runOnRegion(Region *R, RGPassManager&RGM) { > > + RegionInfo *RI =&getAnalysis (); > > + modified = false; > > + > > + CR = R; > > + if (!R->isTopLevelRegion()) { > > + BasicBlock *newBB; > > + BasicBlock *oldBB; > > + > > + if (!(R->getEnteringBlock())) { > > + oldBB = R->getEntry(); > > + > > + newBB = createSingleEntryEdge(R); > > + if (newBB) { // update RegionInfo only if we split entry > > successfully > > + RI->splitBlock(newBB, oldBB); > > > > I would put this into createSingleEntryEdge(), as you also update > > the dominance information there. > > > > > > OK. > > > > > > > > + > > + modified |= true; > > + ++NumEntries; > > + } > > + } > > + > > + if (!(R->getExitingBlock())) { > > + oldBB = R->getExit(); > > + newBB = createSingleExitEdge(R); > > + > > + RI->setRegionFor(newBB, R); > > > > I would update the RI in the createSingleExitEdge as you also update > > the regioninto there. > > > > OK. > > > > I thought it would be a lot cleaner if we have the edge creation > separated from the update code. > > > > > > > + > > + modified |= true; > > + ++NumExits; > > + } > > + } > > + > > + return modified; > > +} > > diff --git a/lib/Transforms/Scalar/Scalar.cpp > > b/lib/Transforms/Scalar/Scalar.cpp > > index bf9ca6d..5d18f22 100644 > > --- a/lib/Transforms/Scalar/Scalar.cpp > > +++ b/lib/Transforms/Scalar/Scalar.cpp > > @@ -51,6 +51,7 @@ void > > llvm::initializeScalarOpts(PassRegistry&Registry) { > > initializeMemCpyOptPass(Registry); > > initializeReassociatePass(Registry); > > initializeRegToMemPass(Registry); > > + initializeRegionSimplifyPass(Registry); > > initializeSCCPPass(Registry); > > initializeIPSCCPPass(Registry); > > initializeSROA_DTPass(Registry); > > > > > > Furthermore, you should add a couple of test cases for the different > > branches. > > > > I tested with mysql code. Do you know how to verify that our pass > > preserves the semantics of the program? > > > > Tobi > > > > > > Again I have to thank you a lot for finishing my broken patch :-) > > Cheers, > Andreas > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110202/26676e59/attachment.html From evan.cheng at apple.com Wed Feb 2 12:17:27 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Feb 2011 10:17:27 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> References: <20110129044624.089B12A6C12C@llvm.org> <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> Message-ID: <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote: > > On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Fri Jan 28 22:46:23 2011 >> New Revision: 124526 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=124526&view=rev >> Log: >> Re-apply r124518 with fix. Watch out for invalidated iterator. >> >> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) >> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011 >> @@ -502,7 +505,7 @@ >> } >> // Heuristically, don't tail-duplicate calls if it would expand code size, >> // as it's less likely to be worth the extra cost. >> - if (InstrCount > 1 && HasCall) >> + if (InstrCount > 1 && (PreRegAlloc && HasCall)) > > What is this change for? The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it. This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch. If there's a good reason for this, could you add a comment to explain? I was looking at a test case and didn't quite understand why calls are not being duplicated. I assume the reason is that call is often a register allocation barrier. Before register allocation, there is no way to know whether the call would cause register spills around it. Evan From enderby at apple.com Wed Feb 2 12:20:55 2011 From: enderby at apple.com (Kevin Enderby) Date: Wed, 02 Feb 2011 18:20:55 -0000 Subject: [llvm-commits] [llvm] r124734 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <20110202182055.B32CE2A6C12C@llvm.org> Author: enderby Date: Wed Feb 2 12:20:55 2011 New Revision: 124734 URL: http://llvm.org/viewvc/llvm-project?rev=124734&view=rev Log: Changed the TableGen created MatchInstructionImpl() setting of ErrorInfo. The algorithm for identifying which operand is invalid will now always point to some operand and not the mnemonic sometimes. The change is now that ErrorInfo is the index of the highest operand that does not match for any of the matching mnemonics records. And no longer the ~0U value when the mnemonic matches and not every record with a matching mnemonic has the same mismatching operand index. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=124734&r1=124733&r2=124734&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Wed Feb 2 12:20:55 2011 @@ -2098,10 +2098,8 @@ OS << " continue;\n"; OS << " // If this operand is broken for all of the instances of this\n"; OS << " // mnemonic, keep track of it so we can report loc info.\n"; - OS << " if (it == MnemonicRange.first || ErrorInfo == i+1)\n"; + OS << " if (it == MnemonicRange.first || ErrorInfo <= i+1)\n"; OS << " ErrorInfo = i+1;\n"; - OS << " else\n"; - OS << " ErrorInfo = ~0U;"; OS << " // Otherwise, just reject this instance of the mnemonic.\n"; OS << " OperandsValid = false;\n"; OS << " break;\n"; From stoklund at 2pi.dk Wed Feb 2 12:30:00 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 2 Feb 2011 10:30:00 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> References: <20110129044624.089B12A6C12C@llvm.org> <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> Message-ID: <626E12A1-C917-48E2-B89C-097DC8077CD0@2pi.dk> On Feb 2, 2011, at 10:17 AM, Evan Cheng wrote: > > On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote: > >> >> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote: >>> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff >>> ============================================================================== >>> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011 >>> @@ -502,7 +505,7 @@ >>> } >>> // Heuristically, don't tail-duplicate calls if it would expand code size, >>> // as it's less likely to be worth the extra cost. >>> - if (InstrCount > 1 && HasCall) >>> + if (InstrCount > 1 && (PreRegAlloc && HasCall)) >> >> What is this change for? The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it. This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch. If there's a good reason for this, could you add a comment to explain? > > I was looking at a test case and didn't quite understand why calls are not being duplicated. I assume the reason is that call is often a register allocation barrier. Before register allocation, there is no way to know whether the call would cause register spills around it. After register allocation, a call still takes a long time to execute, so the relative benefit of duplicating the block is quite small. Did this help a test case? /jakob From clattner at apple.com Wed Feb 2 12:44:58 2011 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Feb 2011 10:44:58 -0800 Subject: [llvm-commits] [llvm] r124657 - in /llvm/trunk: include/llvm/Support/PatternMatch.h lib/Analysis/InstructionSimplify.cpp In-Reply-To: <20110201090621.3594E2A6C12D@llvm.org> References: <20110201090621.3594E2A6C12D@llvm.org> Message-ID: On Feb 1, 2011, at 1:06 AM, Duncan Sands wrote: > Author: baldrick > Date: Tue Feb 1 03:06:20 2011 > New Revision: 124657 > > URL: http://llvm.org/viewvc/llvm-project?rev=124657&view=rev > Log: > Add a m_Undef pattern for convenience. This is so that code that uses > pattern matching can also pattern match undef, creating a more uniform > style. Nice. FWIW, I verified that we get good code for both idioms: bool foo(Value *V) { return isa(V); } bool foo2(Value *V) { return match(V, m_Undef()); } both compile into: define zeroext i1 @_Z4foo2PN4llvm5ValueE(%"class.llvm::Value"* nocapture %V) nounwind readonly ssp { entry: %tmp.i.i.i.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::Value"* %V, i64 0, i32 1 %tmp2.i.i.i.i.i.i.i.i.i = load i8* %tmp.i.i.i.i.i.i.i.i.i, align 1, !tbaa !0 %cmp.i.i.i.i.i.i.i.i = icmp eq i8 %tmp2.i.i.i.i.i.i.i.i.i, 5 ret i1 %cmp.i.i.i.i.i.i.i.i } -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110202/16a35b01/attachment.html From evan.cheng at apple.com Wed Feb 2 12:51:52 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Feb 2011 10:51:52 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: <626E12A1-C917-48E2-B89C-097DC8077CD0@2pi.dk> References: <20110129044624.089B12A6C12C@llvm.org> <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> <626E12A1-C917-48E2-B89C-097DC8077CD0@2pi.dk> Message-ID: On Feb 2, 2011, at 10:30 AM, Jakob Stoklund Olesen wrote: > > On Feb 2, 2011, at 10:17 AM, Evan Cheng wrote: > >> >> On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote: >> >>> >>> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote: >>>> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) >>>> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011 >>>> @@ -502,7 +505,7 @@ >>>> } >>>> // Heuristically, don't tail-duplicate calls if it would expand code size, >>>> // as it's less likely to be worth the extra cost. >>>> - if (InstrCount > 1 && HasCall) >>>> + if (InstrCount > 1 && (PreRegAlloc && HasCall)) >>> >>> What is this change for? The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it. This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch. If there's a good reason for this, could you add a comment to explain? >> >> I was looking at a test case and didn't quite understand why calls are not being duplicated. I assume the reason is that call is often a register allocation barrier. Before register allocation, there is no way to know whether the call would cause register spills around it. > > After register allocation, a call still takes a long time to execute, so the relative benefit of duplicating the block is quite small. I don't get this argument. The call is going to be executed either way, we are only concerned about whether getting rid of the unconditional branch is worth the code size increase. Isn't a branch + call, which is just a branch to a branch, bad? The case I really want to get is duplicating a tail call into the predecessor. See test/Transforms/SimplifyCFG/MagicPointer.ll. The ideal codegen for this should be: _f: ## @f ## BB#0: ## %entry cmpq $4, %rdi ja LBB0_6 ## BB#1: ## %entry leaq LJTI0_0(%rip), %rax movslq (%rax,%rdi,4), %rcx addq %rax, %rcx jmpq *%rcx LBB0_2: ## %if.then leaq L_.str(%rip), %rdi jmp _puts ## TAILCALL LBB0_3: ## %if.then2 leaq L_.str1(%rip), %rdi jmp _puts ## TAILCALL LBB0_4: ## %if.then9 leaq L_.str2(%rip), %rdi jmp _puts ## TAILCALL LBB0_5: ## %if.then14 leaq L_.str3(%rip), %rdi LBB0_6: ## %if.else16 jmp _puts But this require duplicating the call earlier. > > Did this help a test case? MagicPointer.ll is the motivating test case. We don't have a solution yet. rdar://8928086. Evan > > /jakob > From bob.wilson at apple.com Wed Feb 2 13:14:15 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 2 Feb 2011 11:14:15 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: References: <20110129044624.089B12A6C12C@llvm.org> <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> <626E12A1-C917-48E2-B89C-097DC8077CD0@2pi.dk> Message-ID: <0F9F8C7E-0262-4237-9FB3-A8D9F8EEF793@apple.com> On Feb 2, 2011, at 10:51 AM, Evan Cheng wrote: > > On Feb 2, 2011, at 10:30 AM, Jakob Stoklund Olesen wrote: > >> >> On Feb 2, 2011, at 10:17 AM, Evan Cheng wrote: >> >>> >>> On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote: >>> >>>> >>>> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote: >>>>> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff >>>>> ============================================================================== >>>>> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) >>>>> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011 >>>>> @@ -502,7 +505,7 @@ >>>>> } >>>>> // Heuristically, don't tail-duplicate calls if it would expand code size, >>>>> // as it's less likely to be worth the extra cost. >>>>> - if (InstrCount > 1 && HasCall) >>>>> + if (InstrCount > 1 && (PreRegAlloc && HasCall)) >>>> >>>> What is this change for? The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it. This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch. If there's a good reason for this, could you add a comment to explain? >>> >>> I was looking at a test case and didn't quite understand why calls are not being duplicated. I assume the reason is that call is often a register allocation barrier. Before register allocation, there is no way to know whether the call would cause register spills around it. >> >> After register allocation, a call still takes a long time to execute, so the relative benefit of duplicating the block is quite small. > > I don't get this argument. The call is going to be executed either way, we are only concerned about whether getting rid of the unconditional branch is worth the code size increase. Isn't a branch + call, which is just a branch to a branch, bad? The case I really want to get is duplicating a tail call into the predecessor. > > See test/Transforms/SimplifyCFG/MagicPointer.ll. > > The ideal codegen for this should be: > _f: ## @f > ## BB#0: ## %entry > cmpq $4, %rdi > ja LBB0_6 > ## BB#1: ## %entry > leaq LJTI0_0(%rip), %rax > movslq (%rax,%rdi,4), %rcx > addq %rax, %rcx > jmpq *%rcx > LBB0_2: ## %if.then > leaq L_.str(%rip), %rdi > jmp _puts ## TAILCALL > LBB0_3: ## %if.then2 > leaq L_.str1(%rip), %rdi > jmp _puts ## TAILCALL > LBB0_4: ## %if.then9 > leaq L_.str2(%rip), %rdi > jmp _puts ## TAILCALL > LBB0_5: ## %if.then14 > leaq L_.str3(%rip), %rdi > LBB0_6: ## %if.else16 > jmp _puts > > > But this require duplicating the call earlier. > >> >> Did this help a test case? > > MagicPointer.ll is the motivating test case. We don't have a solution yet. rdar://8928086. I looked at the history of that code -- it goes all the way back to Dan's initial commit for tail duplication, so I doubt if anyone has ever looked at the effects of that heuristic in practice. If your change helps a test case, then let's do it. Could you update the comment, though? What it says now is wrong, and it would be good to mention what you said about spills around calls in the pre-RA pass. From david_dean at apple.com Wed Feb 2 13:29:33 2011 From: david_dean at apple.com (David Dean) Date: Wed, 02 Feb 2011 19:29:33 -0000 Subject: [llvm-commits] [zorg] r124740 - /zorg/trunk/buildbot/llvmlab/master/config/schedulers.py Message-ID: <20110202192933.6B0AC2A6C12C@llvm.org> Author: ddean Date: Wed Feb 2 13:29:33 2011 New Revision: 124740 URL: http://llvm.org/viewvc/llvm-project?rev=124740&view=rev Log: update schedulers for new builders Modified: zorg/trunk/buildbot/llvmlab/master/config/schedulers.py Modified: zorg/trunk/buildbot/llvmlab/master/config/schedulers.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/config/schedulers.py?rev=124740&r1=124739&r2=124740&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/config/schedulers.py (original) +++ zorg/trunk/buildbot/llvmlab/master/config/schedulers.py Wed Feb 2 13:29:33 2011 @@ -14,9 +14,10 @@ builderNames=['phase2 - living',], properties = {'revision':WithProperties('%(got_revision)s')}) startphase2 = triggerable.Triggerable(name='doPhase2', - builderNames=['clang-x86_64-osx10-DA', - 'clang-x86_64-osx10-RA', + builderNames=[ 'nightly_clang-x86_64-osx10-gcc42-RA', + 'clang-x86_64-osx10-DA', + 'clang-x86_64-osx10-RA', ], properties = {'revision':WithProperties('%(got_revision)s')}) @@ -24,7 +25,9 @@ builderNames=['phase3 - tree health',], properties = {'revision':WithProperties('%(got_revision)s')}) startphase3 = triggerable.Triggerable(name='doPhase3', - builderNames=['nightly_clang-x86_64-osx10-DA', + builderNames=[ + 'clang-i386-osx10-RA', + 'nightly_clang-x86_64-osx10-DA', 'nightly_clang-x86_64-osx10-RA', 'nightly_clang-x86_64-osx10-RA-O0', 'nightly_clang-x86_64-osx10-RA-Os', @@ -38,9 +41,13 @@ builderNames=['phase4 - validation',], properties = {'revision':WithProperties('%(got_revision)s')}) startphase4 = triggerable.Triggerable(name='doPhase4', - builderNames=['clang-x86_64-osx10-RA-stage3', + builderNames=[ + 'clang-x86_64-osx10-RA-stage3', + 'nightly_clang-i386-osx10-RA', 'gccTestSuite-clang-x86_64-osx10-RA', - 'libcxx-clang-x86_64-osx10-RA',], + 'libcxx-clang-x86_64-osx10-RA', + 'boost-trunk-clang-x86_64-osx10-RA', + ], properties = {'revision':WithProperties('%(got_revision)s')}) LastOne = triggerable.Triggerable(name='GoodBuild', From david_dean at apple.com Wed Feb 2 13:39:45 2011 From: david_dean at apple.com (David Dean) Date: Wed, 02 Feb 2011 19:39:45 -0000 Subject: [llvm-commits] [zorg] r124742 - in /zorg/trunk/buildbot/llvmlab/master: config/builders.py master.cfg Message-ID: <20110202193945.D12AD2A6C12C@llvm.org> Author: ddean Date: Wed Feb 2 13:39:45 2011 New Revision: 124742 URL: http://llvm.org/viewvc/llvm-project?rev=124742&view=rev Log: update upload/download to use rsync; add parameter to svn puller method which allows always pulling newest revision; nightly tests set up to always pull latest revision; reduced size of artifacts and removed need to keep track of debug/release; fixed to support multiple config_options correctly; added some new builders; added function to allow prioritizing builds if necessary Modified: zorg/trunk/buildbot/llvmlab/master/config/builders.py zorg/trunk/buildbot/llvmlab/master/master.cfg Modified: zorg/trunk/buildbot/llvmlab/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/config/builders.py?rev=124742&r1=124741&r2=124742&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/config/builders.py (original) +++ zorg/trunk/buildbot/llvmlab/master/config/builders.py Wed Feb 2 13:39:45 2011 @@ -4,17 +4,16 @@ from buildbot.steps.trigger import Trigger from buildbot.schedulers import basic, timed, triggerable from buildbot.steps import source -from buildbot.steps.transfer import FileUpload, FileDownload def setProperty(f, new_property, new_value): f.addStep(buildbot.steps.shell.SetProperty( command=['echo', new_value], property=new_property, description=['set property', new_property], - workdir='.')) + )) return f -def pullsrc(f, repo_name, URL, dir, pull_mode='clobber', def_branch='trunk'): +def pullsrc(f, repo_name, URL, dir, pull_mode='clobber', def_branch='trunk', UseLatest='False'): f.addStep(source.SVN(name='pull ' + repo_name, mode=pull_mode, baseURL=URL, @@ -24,24 +23,24 @@ def pullClang(f): - pullsrc(f, 'clang', 'http://llvm.org/svn/llvm-project/cfe/', 'llvm/tools/clang', 'update') - return f + pullsrc(f, 'clang', 'http://llvm.org/svn/llvm-project/cfe/', 'llvm/tools/clang', ) + return f def pullllvm(f): - pullsrc(f, 'llvm', 'http://llvm.org/svn/llvm-project/llvm/', 'llvm', 'update') - return f + pullsrc(f, 'llvm', 'http://llvm.org/svn/llvm-project/llvm/', 'llvm') + return f def pulltest_suite(f): - pullsrc(f, 'llvm tests', 'http://llvm.org/svn/llvm-project/test-suite/', 'test-suite', 'update') - return f + pullsrc(f, 'llvm tests', 'http://llvm.org/svn/llvm-project/test-suite/', 'test-suite', 'clobber', 'trunk', 'True') + return f def pullclang_tests(f): - pullsrc(f, 'clang tests', 'http://llvm.org/svn/llvm-project/clang-tests/', 'test-suite', 'update') - return f + pullsrc(f, 'clang tests', 'http://llvm.org/svn/llvm-project/clang-tests/', 'test-suite') + return f def pulllibcxx(f): - pullsrc(f, 'libc++', 'http://llvm.org/svn/llvm-project/libcxx/', 'libcxx') - return f + pullsrc(f, 'libc++', 'http://llvm.org/svn/llvm-project/libcxx/', 'libcxx') + return f def pullboostrunner(f): #alwaysUseLatest @@ -58,62 +57,66 @@ command=['pwd'], property='builddir', description='set build dir', - workdir='.')) + )) return f def GetCompilerArtifacts(f): if WithProperties('%(revision)s')=='None': - src_file = WithProperties('~/artifacts/%(use_builder)s/%(got_revision)s/%(use_compiler)s.tar.gz') + src_file = WithProperties('buildmaster at llvmlab.local:~/artifacts/%(use_builder)s/%(got_revision)s/clang-install.tar.gz') else: - src_file = WithProperties('~/artifacts/%(use_builder)s/%(revision)s/%(use_compiler)s.tar.gz') - f.addStep(FileDownload(mastersrc=src_file, - slavedest=WithProperties('%(builddir)s/%(use_compiler)s.tar.gz') - )) + src_file = WithProperties('buildmaster at llvmlab.local:~/artifacts/%(use_builder)s/%(revision)s/clang-install.tar.gz') + slavedest=WithProperties('%(builddir)s/clang-install.tar.gz') + f.addStep(buildbot.steps.shell.ShellCommand( + name='download_artifacts', + command=['rsync', '-ave', 'ssh', src_file, slavedest ], + haltOnFailure=True, + description=['download build artifacts'], + )) #extract compiler artifacts used for this build f.addStep(buildbot.steps.shell.ShellCommand( name='unzip', - command=['tar', '-zxvf', WithProperties('%(use_compiler)s.tar.gz'),], + command=['tar', '-zxvf', WithProperties('clang-install.tar.gz'),], haltOnFailure=True, - description=['extract', WithProperties('%(use_compiler)s')], - workdir='.', + description=['extract', WithProperties('clang-install')], )) return f def cleanCompilerDir(f): f.addStep(buildbot.steps.shell.ShellCommand( - command=['rm', '-rf', WithProperties('%(use_compiler:-)s')], + command=['rm', '-rf', 'clang-install'], haltOnFailure=False, - description=['rm dir', WithProperties('%(use_compiler:-)s')], - workdir='.',)) + description=['rm dir', 'clang-install'], + )) f.addStep(buildbot.steps.shell.ShellCommand( - command=['rm', '-rf', WithProperties('%(use_compiler:-)s.tar.gz')], + command=['rm', '-rf', 'clang-install.tar.gz'], haltOnFailure=False, - description=['rm archive', WithProperties('%(use_compiler:-)s')], - workdir='.',)) + description=['rm archive', 'clang-install.tar.gz'], + )) f.addStep(buildbot.steps.shell.ShellCommand( command=['rm', '-rf', WithProperties('%(compiler_built:-)s')], haltOnFailure=False, description=['rm dir', WithProperties('%(compiler_built:-)s')], - workdir='.',)) - f.addStep(buildbot.steps.shell.ShellCommand( - command=['rm', '-rf', WithProperties('%(compiler_built:-)s.tar.gz')], - haltOnFailure=False, - description=['rm archive', WithProperties('%(compiler_built:-)s')], - workdir='.',)) + )) return f def uploadArtifacts(f): f.addStep(buildbot.steps.shell.ShellCommand( name='tar_and_zip', - command=['tar', 'czvf', WithProperties('%(compiler_built)s.tar.gz'), - WithProperties('./%(compiler_built)s/')], + command=['tar', 'czvf', 'clang-install.tar.gz', + WithProperties('./clang-install/')], haltOnFailure=True, description=['tar', '&', 'zip'], - workdir='.', )) - archive_src = WithProperties('%(builddir)s/%(compiler_built)s.tar.gz') - archive_dest = WithProperties('~/artifacts/%(buildername)s/%(got_revision)s/%(compiler_built)s.tar.gz') - f.addStep(FileUpload(slavesrc=archive_src, masterdest=archive_dest)) + archive_src = WithProperties('%(builddir)s/clang-install.tar.gz') + f.addStep(buildbot.steps.shell.ShellCommand( + name='upload_artifacts', + command=['rsync', '-ave', 'ssh', archive_src, + WithProperties('buildmaster at llvmlab.local:~/artifacts/%(buildername)s/%(got_revision)s/') + ], + haltOnFailure=True, + description=['upload build artifacts'], + )) + return f def regressionTests(f): @@ -148,7 +151,7 @@ def clangStage1(f,config_options=''): # Determine the build directory. f = getBuildDir(f) - f = setProperty(f, 'compiler_built', 'stage1') + f = setProperty(f, 'compiler_built', 'clang-build') # clean out the directory used for the stage 1 compiler #f = cleanCompilerDir(f) # pull sources @@ -170,6 +173,13 @@ haltOnFailure=True, description=['make'], workdir=WithProperties('%(compiler_built)s'))) + f.addStep(buildbot.steps.shell.ShellCommand( + name='make install', + command=['make', 'install', '-j', WithProperties('%(jobs)s'), + WithProperties('DESTDIR=%(builddir)s/clang-install')], + haltOnFailure=True, + description=['make install'], + workdir=WithProperties('%(compiler_built)s'))) return f def clangHost(config_options): @@ -177,8 +187,8 @@ f = buildbot.process.factory.BuildFactory() # Determine the build directory. f = getBuildDir(f) - f = setProperty(f, 'compiler_built', 'stage2') - f = setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + f = setProperty(f, 'compiler_built', 'clang-build') + f = setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) # clean out the directory/archives used for the stage 1 compiler # clean out the directory used to build compiler f = cleanCompilerDir(f) @@ -188,17 +198,21 @@ #Download artifacts from phase 1 compiler build f = GetCompilerArtifacts(f) # configure to use stage1 compiler (artifacts from phase 1 build) + if config_options == (): + config_options = [] + else: + config_options = list(config_options) f.addStep(buildbot.steps.shell.ShellCommand( name='configure_with_host', command=[ - '../llvm/configure', '--disable-bindings', + '../llvm/configure',] + config_options + ['--disable-bindings', '--with-llvmcc=clang', '--without-llvmgcc', '--without-llvmgxx', - WithProperties('CC=%(use_path)s/bin/clang'), - WithProperties('CXX=%(use_path)s/bin/clang++'), - config_options], + WithProperties('CC=%(use_path)s/clang'), + WithProperties('CXX=%(use_path)s/clang++'), + ], haltOnFailure=True, description=['configure'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, workdir=WithProperties('%(compiler_built)s'))) # build stage 2 compiler f.addStep(buildbot.steps.shell.ShellCommand( @@ -206,7 +220,15 @@ command=['make', '-j', WithProperties('%(jobs)s')], haltOnFailure=True, description=['make'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + workdir=WithProperties('%(compiler_built)s'))) + f.addStep(buildbot.steps.shell.ShellCommand( + name='make install', + command=['make', '-j', WithProperties('%(jobs)s'), 'install-clang', + WithProperties('DESTDIR=%(builddir)s/clang-install')], + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + haltOnFailure=True, + description=['make install'], workdir=WithProperties('%(compiler_built)s'))) # save artifacts of thids build for use by other builders f = uploadArtifacts(f) @@ -246,73 +268,92 @@ 'category' : 'status', } -def HostedClang(myname, compiler_type, use_compiler, use_type, slaves, config_options=''): +def HostedClang(myname, compiler_type, use_compiler, slaves, *config_options): return { 'name' : myname, 'builddir' : 'build.'+myname, 'factory' : clangHost(config_options), 'slavenames' : slaves, 'category' : 'clang', 'properties' : {'compiler_type': compiler_type, 'use_builder': use_compiler, - 'use_type': use_type, 'use_compiler': 'stage1' }} -def NightlyFactory(compiler, compiler_dir, options): +def NightlyFactory(compiler, options): f = buildbot.process.factory.BuildFactory() # Determine the build directory. f = getBuildDir(f) f = setProperty(f, 'use_builder', compiler) - f = setProperty(f, 'use_compiler', compiler_dir) - f = setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + f = setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) #clean out the directory/archives prior to extracting compiler f = cleanCompilerDir(f) - # pull test-suite - f = pulltest_suite(f) #Download compiler artifacts to be used for this build f = GetCompilerArtifacts(f) f.addStep(buildbot.steps.shell.ShellCommand( name='sanity_test', - command=[WithProperties('%(use_path)s/bin/clang'), + command=[WithProperties('%(use_path)s/clang'), '--version'], haltOnFailure=True, description=['sanity test'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, - workdir='.')) + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + )) + # pull test-suite + f = pullllvm(f) + f = pullClang(f) + f = pulltest_suite(f) + # must build llvm utils, so configure llvm and build + # TODO: build less of llvm + f.addStep(buildbot.steps.shell.ShellCommand( + name='configure_with_host', + command=[ + '../llvm/configure', '--enable-optimized', '--disable-bindings', + '--with-llvmcc=clang', '--without-llvmgcc', '--without-llvmgxx', + WithProperties('CC=%(use_path)s/clang'), + WithProperties('CXX=%(use_path)s/clang++'), + ], + haltOnFailure=True, + description=['configure'], + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + workdir='llvm.obj')) + f.addStep(buildbot.steps.shell.ShellCommand( + name='make', + command=['make', 'tools-only', '-j', WithProperties('%(jobs)s'), + ], + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + haltOnFailure=True, + description=['make'], + workdir='llvm.obj')) # run tests f.addStep(buildbot.steps.shell.ShellCommand( name='configure_tests', command=['./configure', - WithProperties('CC=%(use_path)s/bin/clang'), - WithProperties('CXX=%(use_path)s/bin/clang++'), + WithProperties('CC=%(use_path)s/clang'), + WithProperties('CXX=%(use_path)s/clang++'), 'CFLAGS='+options, 'CXXFLAGS='+options, - # WithProperties('--with-llvmsrc=%(builddir)s/llvm'), - # WithProperties('--with-llvmobj=%(builddir)s/'+compiler_dir), - #options + WithProperties('--with-llvmsrc=%(builddir)s/llvm'), + WithProperties('--with-llvmobj=%(builddir)s/llvm.obj'), ], haltOnFailure=True, description=['configure tests'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + workdir='test-suite')) + f.addStep(buildbot.steps.shell.ShellCommand( + name='run_nightly_tests', + command=['make', WithProperties('-j%(jobs)s'), 'ENABLE_PARALLEL_REPORT=1', + 'DISABLE_CBE=1', 'DISABLE_JIT=1', 'TEST=nightly', 'report' + ], + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + haltOnFailure=True, + description=['run tests'], workdir='test-suite')) -# f.addStep(buildbot.steps.shell.ShellCommand( -# name='run_nightly_tests', -# command=['make', WithProperties('-j%(jobs)s'), 'ENABLE_PARALLEL_REPORT=1', -# 'DISABLE_CBE=1', 'DISABLE_JIT=1', 'TEST=nightly', 'report' -# ], -# haltOnFailure=True, -# env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, -# description=['run tests'], -# workdir='test-suite')) return f -def Nightly(compiler, compiler_type, compiler_dir, slaves, options=''): +def Nightly(compiler, slaves, options=''): return { 'name' : 'nightly_'+ compiler + options, 'builddir' : 'build.nightly.'+ compiler + options, - 'factory' : NightlyFactory(compiler, compiler_dir, options), + 'factory' : NightlyFactory(compiler, options), 'slavenames' : slaves, 'category' : 'tests', - 'properties' : {'use_builder': compiler, 'use_type': compiler_type, - 'use_compiler': compiler_dir - }} + 'properties' : {'use_builder': compiler }} def stage1Clang(compiler, compiler_type, slave): return { 'name' : compiler, @@ -328,8 +369,8 @@ f = buildbot.process.factory.BuildFactory() # Determine the build directory. f = getBuildDir(f) - f = setProperty(f, 'compiler_built', 'stage3') - f = setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + f = setProperty(f, 'compiler_built', 'clang-build') + f = setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) # clean out the directory/archives used for the stage 2 compiler # clean out the directory used to build compiler f = cleanCompilerDir(f) @@ -344,12 +385,13 @@ command=[ '../llvm/configure', '--enable-optimized', '--disable-bindings', '--with-llvmcc=clang', '--without-llvmgcc', '--without-llvmgxx', - WithProperties('CC=%(use_path)s/bin/clang'), - WithProperties('CXX=%(use_path)s/bin/clang++'), - config_options], + config_options, + WithProperties('CC=%(use_path)s/clang'), + WithProperties('CXX=%(use_path)s/clang++'), + ], haltOnFailure=True, description=['configure'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, workdir=WithProperties('%(compiler_built)s'))) # build stage 2 compiler f.addStep(buildbot.steps.shell.ShellCommand( @@ -357,7 +399,15 @@ command=['make', '-j', WithProperties('%(jobs)s')], haltOnFailure=True, description=['make'], - env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + workdir=WithProperties('%(compiler_built)s'))) + f.addStep(buildbot.steps.shell.ShellCommand( + name='make install', + command=['make', '-j', WithProperties('%(jobs)s'), 'install-clang', + WithProperties('DESTDIR=%(builddir)s/clang-install')], + env={'PATH': WithProperties('%(use_path)s:${PATH}')}, + haltOnFailure=True, + description=['make install'], workdir=WithProperties('%(compiler_built)s'))) # save artifacts of thids build for use by other builders f = uploadArtifacts(f) @@ -369,44 +419,40 @@ )) return f -def stage3Clang(use_compiler, use_type, slaves, config_options=''): +def stage3Clang(use_compiler, slaves, config_options=''): return { 'name' : use_compiler + '-stage3', 'builddir' : 'build.'+ use_compiler + '-stage3', 'factory' : HostStage3Clang(config_options), 'slavenames' : slaves, 'category' : 'clang', - 'properties' : {'compiler_type': use_type, 'use_builder': use_compiler, - 'use_type': use_type, 'use_compiler': 'stage2' + 'properties' : { 'use_builder': use_compiler, }} -def gccTestSuite(use_compiler, use_type, slaves, config_options=''): +def gccTestSuite(use_compiler, slaves, config_options=''): return { 'name' : 'gccTestSuite-'+ use_compiler, 'builddir' : 'build.'+ 'gccTestSuite-'+ use_compiler, 'factory' : gccRunSuite(config_options), 'slavenames' : slaves, 'category' : 'clang', - 'properties' : {'compiler_type': use_type, 'use_builder': use_compiler, - 'use_type': use_type, 'use_compiler': 'stage2' + 'properties' : { 'use_builder': use_compiler, }} -def libcxx(use_compiler, use_type, slaves, config_options=''): +def libcxx(use_compiler, slaves, config_options=''): return { 'name' : 'libcxx-'+ use_compiler, 'builddir' : 'build.'+ 'libcxx-'+ use_compiler, 'factory' : runlibcxx(config_options), 'slavenames' : slaves, 'category' : 'clang', - 'properties' : {'compiler_type': use_type, 'use_builder': use_compiler, - 'use_type': use_type, 'use_compiler': 'stage2' + 'properties' : { 'use_builder': use_compiler, }} -def boost(tag, use_compiler, use_type, slaves, config_options=''): +def boost(tag, use_compiler, slaves, config_options=''): return { 'name' : 'boost-' + tag + '-' + use_compiler, 'builddir' : 'build.'+ 'boost-' + tag + '-' + use_compiler, 'factory' : runboost(config_options), 'slavenames' : slaves, 'category' : 'clang', - 'properties' : {'compiler_type': use_type, 'use_builder': use_compiler, - 'use_type': use_type, 'use_compiler': 'stage2', + 'properties' : {'use_builder': use_compiler, 'boost_tag': tag }} @@ -414,7 +460,7 @@ f = buildbot.process.factory.BuildFactory() # Determine the build directory. getBuildDir(f) - setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) cleanCompilerDir(f) # pull test-suite pullclang_tests(f) @@ -424,11 +470,11 @@ # f.addStep(buildbot.steps.shell.ShellCommand( # name='make_check', # command=['make', 'check', -# WithProperties('CC_UNDER_TEST=%(use_path)s/bin/clang'), -# WithProperties('CXX_UNDER_TEST=%(use_path)s/bin/clang++'),], +# WithProperties('CC_UNDER_TEST=%(use_path)s/clang'), +# WithProperties('CXX_UNDER_TEST=%(use_path)s/clang++'),], # haltOnFailure=True, # description=['make check'], -# env={'PATH': WithProperties('/usr/local/bin/:%(use_path)s/bin:${PATH}')}, +# env={'PATH': WithProperties('/usr/local/bin/:%(use_path)s:${PATH}')}, # workdir='test-suite/gcc-4_2-testsuite')) return f @@ -436,7 +482,7 @@ f = buildbot.process.factory.BuildFactory() # Determine the build directory. getBuildDir(f) - setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) cleanCompilerDir(f) # pull test-suite pulllibcxx(f) @@ -448,14 +494,14 @@ # command=['./buildit',], # haltOnFailure=True, # description=['build libc++'], -# env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, +# env={'PATH': WithProperties('%(use_path)s:${PATH}')}, # workdir='libcxx/lib')) # f.addStep(buildbot.steps.shell.ShellCommand( # name='testit', # command=['testit',], # haltOnFailure=True, # description=['test libc++'], -# env={'PATH': WithProperties('%(use_path)s/bin:${PATH}')}, +# env={'PATH': WithProperties('%(use_path)s:${PATH}')}, # workdir='libcxx/test')) return f @@ -463,7 +509,7 @@ f = buildbot.process.factory.BuildFactory() # Determine the build directory. getBuildDir(f) - setProperty(f, 'use_path', WithProperties('%(builddir)s/%(use_compiler)s/%(use_type)s')) + f = setProperty(f, 'use_path', WithProperties('%(builddir)s/clang-install/usr/local/bin')) cleanCompilerDir(f) # pull test-suite pullboostrunner(f) @@ -476,11 +522,10 @@ f.addStep(buildbot.steps.shell.ShellCommand( name='user-config.jam', command=['echo', 'using', 'clang', ':', 'darwin-4.2.1', ':', - WithProperties('%(use_path)s/bin/clang'), ':', config_options, + WithProperties('%(use_path)s/clang'), ':', config_options, ';', '>', 'user-config.jam'], haltOnFailure=True, description=['create user-config.jam'], - workdir='.', )) #--bjam-options=target-os=windows --bjam-options=-l300 --bjam-options=--debug-level=3 --bjam-options=--user-config=%MYJAMFILE% --have-source --skip-script-download --ftp=ftp://boost:4peiV8Xwxfv9 at ftp.siliconman.net >runner.log f.addStep(buildbot.steps.shell.ShellCommand( @@ -492,7 +537,6 @@ WithProperties('--bjam-options=-j%(jobs)s'),'--user=""',], haltOnFailure=True, description=['boost regression harness'], - workdir='.', timeout=14400 )) return f @@ -506,7 +550,9 @@ phase1_slave = 'llvmlab.local' snow_leopard_slaves = all_slaves phaseRunners = [phase1_slave] - phase2_slaves = filter(lambda x:x not in [phase1_slave], snow_leopard_slaves) + reserved_phase3 = 'lab-mini-04.local' + phase2_slaves = filter(lambda x:x not in [phase1_slave, reserved_phase3], snow_leopard_slaves) + phase3_slaves = phase2_slaves + [reserved_phase3] return [ #Build to announce good build and prepare potential release candidate { 'name' : 'Validated Build', @@ -522,24 +568,28 @@ # phase 1 build stage1Clang(phase1, typeRA, phase1_slave), #phase 2 Builds - HostedClang ('clang-x86_64-osx10-DA', typeDA, phase1, typeRA, [phase1_slave]), - HostedClang (final_reference, typeRA, phase1, typeRA, phase2_slaves, '--enable-optimized'), - Nightly(phase1, typeRA, 'stage1', phase2_slaves), + HostedClang ('clang-x86_64-osx10-DA', typeDA, phase1, phase2_slaves), + HostedClang (final_reference, typeRA, phase1, phase2_slaves, '--enable-optimized'), + Nightly(phase1, phase2_slaves), #phase3 builds - Nightly('clang-x86_64-osx10-DA', typeDA, 'stage2', phase2_slaves), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves, '-O0'), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves, '-Os'), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves, '-O3'), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves, '-flto'), - Nightly(final_reference, typeRA, 'stage2', phase2_slaves, '-g'), + HostedClang ('clang-i386-osx10-RA', typeRA, phase1, phase3_slaves, '--enable-optimized', '--target=i386'), + Nightly('clang-x86_64-osx10-DA', phase3_slaves), + Nightly(final_reference, phase3_slaves), + Nightly(final_reference, phase3_slaves, '-O0'), + Nightly(final_reference, phase3_slaves, '-Os'), + Nightly(final_reference, phase3_slaves, '-O3'), + Nightly(final_reference, phase3_slaves, '-flto'), + Nightly(final_reference, phase3_slaves, '-g'), #phase4 builds - stage3Clang(final_reference, typeRA, phase2_slaves), - gccTestSuite(final_reference, typeRA, phase2_slaves), - Nightly(final_reference+ '-stage3', typeRA, 'stage3', all_slaves, '-g'), - libcxx(final_reference, typeRA, phase2_slaves), - boost('trunk', final_reference, typeRA, phase2_slaves), + Nightly('clang-i386-osx10-RA', phase3_slaves), + stage3Clang(final_reference, phase3_slaves), + gccTestSuite(final_reference, phase3_slaves), + Nightly(final_reference+ '-stage3', phase3_slaves, '-g'), + libcxx(final_reference, phase3_slaves), + boost('trunk', final_reference, phase3_slaves), +# boost('branches/release', final_reference, phase2_slaves), +# boost('tags/release/Boost_1_44_0', final_reference, phase2_slaves), #A Placeholder builder is required for triggers which haven't had builders #configured yet, otherwise build will hang # { 'name' : 'Placeholder', @@ -548,3 +598,33 @@ # 'category' : 'clang', # }, ] + +def prioritizeBuilders(buildmaster, builders): + builderPriorities = { + 'phase1 - sanity':0, + 'clang-x86_64-osx10-gcc42-RA':0, + 'phase2 - living':1, + 'nightly_clang-x86_64-osx10-gcc42-RA':1, + 'clang-x86_64-osx10-RA':1, + 'clang-x86_64-osx10-DA':1, + 'phase3 - tree health':2, + 'clang-i386-osx10-RA':2, + 'nightly_clang-x86_64-osx10-DA':3, + 'nightly_clang-x86_64-osx10-RA':3, + 'nightly_clang-x86_64-osx10-RA-O0':3, + 'nightly_clang-x86_64-osx10-RA-Os':3, + 'nightly_clang-x86_64-osx10-RA-O3':3, + 'nightly_clang-x86_64-osx10-RA-flto':3, + 'nightly_clang-x86_64-osx10-RA-g':3, + 'phase4 - validation':4, + 'nightly_clang-i386-osx10-RA':5, + 'clang-x86_64-osx10-RA-stage3':4, + 'gccTestSuite-clang-x86_64-osx10-RA':4, + 'nightly_clang-x86_64-osx10-RA-stage3-g':5, + 'libcxx-clang-x86_64-osx10-RA':4, + 'boost-trunk-clang-x86_64-osx10-RA':6, + 'Validated Build':7, + } + builders.sort(key=lambda b: builderPriorities.get(b.name, 0)) + return builders + Modified: zorg/trunk/buildbot/llvmlab/master/master.cfg URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/master.cfg?rev=124742&r1=124741&r2=124742&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/master.cfg (original) +++ zorg/trunk/buildbot/llvmlab/master/master.cfg Wed Feb 2 13:39:45 2011 @@ -105,3 +105,4 @@ c['projectURL'] = "http://lab.llvm.org/" c['buildbotURL'] = "http://lab.llvm.org:8013/" +#c['prioritizeBuilders'] = config.builders.prioritizeBuilders \ No newline at end of file From fvbommel at gmail.com Wed Feb 2 14:11:16 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Wed, 2 Feb 2011 21:11:16 +0100 Subject: [llvm-commits] [llvm] r124724 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll test/Transforms/SimplifyCFG/switch_formation.dbg.ll In-Reply-To: <20110202155622.9F92F2A6C12C@llvm.org> References: <20110202155622.9F92F2A6C12C@llvm.org> Message-ID: On Wed, Feb 2, 2011 at 4:56 PM, Benjamin Kramer wrote: > +/// TurnSwitchRangeIntoICmp - Turns a switch with that contains only a > +/// integer range comparison into a sub, an icmp and a branch. > +static bool TurnSwitchRangeIntoICmp(SwitchInst *SI) { > + ?assert(SI->getNumCases() > 2 && "Degenerate switch?"); > + ?// We can do this transform if the switch consists of an ascending series > + ?// and all cases point to the same destination. > + ?for (unsigned I = 2, E = SI->getNumCases(); I != E; ++I) > + ? ?if (SI->getSuccessor(I-1) != SI->getSuccessor(I) || > + ? ? ? ?SI->getCaseValue(I-1)->getValue()+1 != SI->getCaseValue(I)->getValue()) > + ? ? ?return false; What about out-of-order case values? For example: define zeroext i1 @quux(i32 %x) nounwind readnone ssp noredzone { entry: switch i32 %x, label %lor.rhs [ i32 1, label %lor.end i32 3, label %lor.end i32 2, label %lor.end ] lor.rhs: ; preds = %entry br label %lor.end lor.end: ; preds = %lor.rhs, %entry, %entry, %entry %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ] ret i1 %0 } This is supposed to be equivalent to using ordered case values, but your code doesn't touch this switch while it works fine if the case values are sorted. From david_dean at apple.com Wed Feb 2 14:14:28 2011 From: david_dean at apple.com (David Dean) Date: Wed, 02 Feb 2011 20:14:28 -0000 Subject: [llvm-commits] [zorg] r124744 - /zorg/trunk/buildbot/llvmlab/master/config/slaves.py Message-ID: <20110202201428.176992A6C12C@llvm.org> Author: ddean Date: Wed Feb 2 14:14:27 2011 New Revision: 124744 URL: http://llvm.org/viewvc/llvm-project?rev=124744&view=rev Log: set minis to only run one build at a time, they're two slow otherwise Modified: zorg/trunk/buildbot/llvmlab/master/config/slaves.py Modified: zorg/trunk/buildbot/llvmlab/master/config/slaves.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/config/slaves.py?rev=124744&r1=124743&r2=124744&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/config/slaves.py (original) +++ zorg/trunk/buildbot/llvmlab/master/config/slaves.py Wed Feb 2 14:14:27 2011 @@ -7,6 +7,7 @@ *args, **kwargs) def get_build_slaves(): + #phase runners yield create_slave("llvmlab.local", notify_on_missing="david_dean at apple.com", properties = { 'jobs' : 16 }, @@ -14,16 +15,16 @@ yield create_slave("lab-mini-01.local", notify_on_missing="david_dean at apple.com", properties = { 'jobs' : 2 }, - max_builds = 2) + max_builds = 1) yield create_slave("lab-mini-02.local", notify_on_missing="david_dean at apple.com", properties = { 'jobs' : 2 }, - max_builds = 2) + max_builds = 1) yield create_slave("lab-mini-03.local", notify_on_missing="david_dean at apple.com", properties = { 'jobs' : 2 }, - max_builds = 2) + max_builds = 1) yield create_slave("lab-mini-04.local", notify_on_missing="david_dean at apple.com", properties = { 'jobs' : 2 }, - max_builds = 2) + max_builds = 1) From baldrick at free.fr Wed Feb 2 14:49:41 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Feb 2011 20:49:41 -0000 Subject: [llvm-commits] [test-suite] r124745 - /test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile Message-ID: <20110202204941.2BC872A6C12C@llvm.org> Author: baldrick Date: Wed Feb 2 14:49:41 2011 New Revision: 124745 URL: http://llvm.org/viewvc/llvm-project?rev=124745&view=rev Log: This benchmark thinks overflow of signed multiplication is well defined. Add the -fwrapv flag to ensure that the compiler thinks so too. Modified: test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile Modified: test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile?rev=124745&r1=124744&r2=124745&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile Wed Feb 2 14:49:41 2011 @@ -16,3 +16,6 @@ else CPPFLAGS += -DSYS_IS_USG endif + +# 254.gap relies on signed arithmetic overflow being well-defined. +CFLAGS += -fwrapv From stoklund at 2pi.dk Wed Feb 2 14:55:13 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 2 Feb 2011 12:55:13 -0800 Subject: [llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/ In-Reply-To: References: <20110129044624.089B12A6C12C@llvm.org> <98FA08EF-B7E7-40A7-9877-F4639B7ACF21@apple.com> <5620CE67-7F6A-4CAE-BB90-8A7EA1DA62FC@apple.com> <626E12A1-C917-48E2-B89C-097DC8077CD0@2pi.dk> Message-ID: <84B244D2-77D4-4791-9C60-85538327DACE@2pi.dk> On Feb 2, 2011, at 10:51 AM, Evan Cheng wrote: > > On Feb 2, 2011, at 10:30 AM, Jakob Stoklund Olesen wrote: > >> After register allocation, a call still takes a long time to execute, so the relative benefit of duplicating the block is quite small. > > I don't get this argument. The call is going to be executed either way, we are only concerned about whether getting rid of the unconditional branch is worth the code size increase. Isn't a branch + call, which is just a branch to a branch, bad? The case I really want to get is duplicating a tail call into the predecessor. Apparently, there are not many blocks containing a call and just one other instruction. These are the only places your change has an effect in the test suite: Name: | #Insts Beta LLC/BETA | External/Nurbs/nurbs | 15216 15278 0.996 | External/SPEC/CFP2000/183.equake/183.equake | 2896 2898 0.999 | External/SPEC/CFP2006/447.dealII/447.dealII | 99881 99941 0.999 | External/SPEC/CINT2006/483.xalancbmk/483.xalancbmk | 589228 589530 0.999 | MultiSource/Benchmarks/Prolangs-C/assembler/assembler | 5223 5226 0.999 | MultiSource/Benchmarks/Prolangs-C/cdecl/cdecl | 3117 3123 0.998 | MultiSource/Benchmarks/Prolangs-C++/deriv1/deriv1 | 446 447 0.998 | MultiSource/Benchmarks/Prolangs-C++/ocean/ocean | 879 889 0.989 | MultiSource/Benchmarks/Prolangs-C++/trees/trees | 993 994 0.999 | SingleSource/Benchmarks/McGill/queens | 267 268 0.996 | SingleSource/Benchmarks/Misc-C++/bigfib | 2519 2523 0.998 | SingleSource/Benchmarks/Shootout-C++/ary | 136 137 0.993 | SingleSource/Benchmarks/Shootout-C++/ary2 | 173 174 0.994 | SingleSource/Benchmarks/Shootout-C++/ary3 | 159 160 0.994 | SingleSource/Benchmarks/Shootout-C++/lists | 321 322 0.997 | SingleSource/Benchmarks/Shootout-C++/reversefile | 607 608 0.998 | I was unable to measure any performance impact. From baldrick at free.fr Wed Feb 2 14:52:00 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Feb 2011 20:52:00 -0000 Subject: [llvm-commits] [llvm] r124746 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/2010-12-20-Reassociate.ll Message-ID: <20110202205200.2D0292A6C12C@llvm.org> Author: baldrick Date: Wed Feb 2 14:52:00 2011 New Revision: 124746 URL: http://llvm.org/viewvc/llvm-project?rev=124746&view=rev Log: Reenable the transform "(X*Y)/Y->X" when the multiplication is known not to overflow (nsw flag), which was disabled because it breaks 254.gap. I have informed the GAP authors of the mistake in their code, and arranged for the testsuite to use -fwrapv when compiling this benchmark. Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124746&r1=124745&r2=124746&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Wed Feb 2 14:52:00 2011 @@ -798,11 +798,11 @@ Value *X = 0, *Y = 0; if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) { if (Y != Op1) std::swap(X, Y); // Ensure expression is (X * Y) / Y, Y = Op1 -// BinaryOperator *Mul = cast(Op0); -// // If the Mul knows it does not overflow, then we are good to go. -// if ((isSigned && Mul->hasNoSignedWrap()) || -// (!isSigned && Mul->hasNoUnsignedWrap())) -// return X; + BinaryOperator *Mul = cast(Op0); + // If the Mul knows it does not overflow, then we are good to go. + if ((isSigned && Mul->hasNoSignedWrap()) || + (!isSigned && Mul->hasNoUnsignedWrap())) + return X; // If X has the form X = A / Y then X * Y cannot overflow. if (BinaryOperator *Div = dyn_cast(X)) if (Div->getOpcode() == Opcode && Div->getOperand(1) == Y) Modified: llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll?rev=124746&r1=124745&r2=124746&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll (original) +++ llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll Wed Feb 2 14:52:00 2011 @@ -92,10 +92,12 @@ } define i32 @sdiv1(i32 %x, i32 %y) { +; CHECK: @sdiv1 ; (no overflow X * Y) / Y -> X %mul = mul nsw i32 %x, %y %r = sdiv i32 %mul, %y ret i32 %r +; CHECK: ret i32 %x } define i32 @sdiv2(i32 %x, i32 %y) { @@ -136,10 +138,12 @@ } define i32 @udiv1(i32 %x, i32 %y) { +; CHECK: @udiv1 ; (no overflow X * Y) / Y -> X %mul = mul nuw i32 %x, %y %r = udiv i32 %mul, %y ret i32 %r +; CHECK: ret i32 %x } define i32 @udiv2(i32 %x, i32 %y) { From jmenon86 at gmail.com Wed Feb 2 12:58:57 2011 From: jmenon86 at gmail.com (Jai Menon) Date: Wed, 2 Feb 2011 12:58:57 -0600 Subject: [llvm-commits] [PATCH] CBackend inline asm fixes Message-ID: Hi, This fixes most cases for me. The patch isn't quite split up, I can do that if required. -- Jai Menon -------------- next part -------------- A non-text attachment was scrubbed... Name: cbe.patch Type: text/x-patch Size: 1545 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110202/0db27835/attachment.bin From david_dean at apple.com Wed Feb 2 14:12:45 2011 From: david_dean at apple.com (David Dean) Date: Wed, 02 Feb 2011 20:12:45 -0000 Subject: [llvm-commits] [zorg] r124743 - /zorg/trunk/buildbot/llvmlab/master/config/status.py Message-ID: <20110202201245.797462A6C12C@llvm.org> Author: ddean Date: Wed Feb 2 14:12:45 2011 New Revision: 124743 URL: http://llvm.org/viewvc/llvm-project?rev=124743&view=rev Log: setp email notifications for testing Modified: zorg/trunk/buildbot/llvmlab/master/config/status.py Modified: zorg/trunk/buildbot/llvmlab/master/config/status.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/config/status.py?rev=124743&r1=124742&r2=124743&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/config/status.py (original) +++ zorg/trunk/buildbot/llvmlab/master/config/status.py Wed Feb 2 14:12:45 2011 @@ -13,8 +13,9 @@ buildbot.status.html.WebStatus( http_port = 8013, allowForce = True), buildbot.status.mail.MailNotifier( - fromaddr = "daniel_dunbar at apple.com", - extraRecipients = [default_email], - mode = "all", - builders = standard_builders), + fromaddr = 'david_dean at apple.com', + extraRecipients = ['daniel_dunbar at apple.com','david_dean at apple.com'], + sendToInterestedUsers=False, + mode = 'problem', + relayhost="mail-in2.apple.com",), ] From dpatel at apple.com Wed Feb 2 15:38:25 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Feb 2011 21:38:25 -0000 Subject: [llvm-commits] [llvm] r124752 - in /llvm/trunk: include/llvm/Analysis/DIBuilder.h include/llvm/Analysis/DebugInfo.h lib/Analysis/DIBuilder.cpp lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h Message-ID: <20110202213825.6589A2A6C12C@llvm.org> Author: dpatel Date: Wed Feb 2 15:38:25 2011 New Revision: 124752 URL: http://llvm.org/viewvc/llvm-project?rev=124752&view=rev Log: Add support to describe template parameter type in debug info. Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DIBuilder.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DIBuilder.h?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DIBuilder.h (original) +++ llvm/trunk/include/llvm/Analysis/DIBuilder.h Wed Feb 2 15:38:25 2011 @@ -38,6 +38,7 @@ class DISubrange; class DILexicalBlock; class DISubprogram; + class DITemplateTypeParameter; class DIBuilder { private: @@ -157,11 +158,13 @@ /// for this type. This is used in /// DW_AT_containing_type. See DWARF documentation /// for more info. + /// @param TemplateParms Template type parameters. DIType CreateClassType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom, - DIArray Elements, MDNode *VTableHolder = 0); + DIArray Elements, MDNode *VTableHolder = 0, + MDNode *TemplateParms = 0); /// CreateStructType - Create debugging information entry for a struct. /// @param Scope Scope in which this struct is defined. @@ -193,6 +196,19 @@ uint64_t AlignInBits, unsigned Flags, DIArray Elements, unsigned RunTimeLang = 0); + /// CreateTemplateTypeParameter - Create debugging information for template + /// type parameter. + /// @param Scope Scope in which this type is dfiend + /// @param Name Type parameter name. + /// @param Ty Parameter type. + /// @param File File where this type parameter is defined. + /// @param LineNo Line number. + /// @param ColumnNo Column Number. + DITemplateTypeParameter + CreateTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty, + MDNode *File = 0, unsigned LineNo = 0, + unsigned ColumnNo = 0); + /// CreateArrayType - Create debugging information entry for an array. /// @param Size Array size. /// @param AlignInBits Alignment. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Wed Feb 2 15:38:25 2011 @@ -122,6 +122,7 @@ bool isType() const; bool isGlobal() const; bool isUnspecifiedParameter() const; + bool isTemplateTypeParameter() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -356,6 +357,7 @@ DICompositeType getContainingType() const { return getFieldAs(12); } + DIArray getTemplateParams() const { return getFieldAs(13); } /// Verify - Verify that a composite type descriptor is well formed. bool Verify() const; @@ -367,6 +369,24 @@ void dump() const; }; + /// DITemplateTypeParameter - This is a wrapper for template type parameter. + class DITemplateTypeParameter : public DIDescriptor { + public: + explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {} + + DIScope getContext() const { return getFieldAs(1); } + StringRef getName() const { return getStringField(2); } + DIType getType() const { return getFieldAs(3); } + StringRef getFilename() const { + return getFieldAs(4).getFilename(); + } + StringRef getDirectory() const { + return getFieldAs(4).getDirectory(); + } + unsigned getLineNumber() const { return getUnsignedField(5); } + unsigned getColumnNumber() const { return getUnsignedField(6); } + }; + /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). class DISubprogram : public DIScope { public: Modified: llvm/trunk/lib/Analysis/DIBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DIBuilder.cpp?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DIBuilder.cpp (original) +++ llvm/trunk/lib/Analysis/DIBuilder.cpp Wed Feb 2 15:38:25 2011 @@ -242,7 +242,7 @@ uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom, DIArray Elements, - MDNode *VTableHoder) { + MDNode *VTableHoder, MDNode *TemplateParams) { // TAG_class_type is encoded in DICompositeType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_class_type), @@ -257,11 +257,31 @@ DerivedFrom, Elements, ConstantInt::get(Type::getInt32Ty(VMContext), 0), - VTableHoder + VTableHoder, + TemplateParams }; return DIType(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } +/// CreateTemplateTypeParameter - Create debugging information for template +/// type parameter. +DITemplateTypeParameter +DIBuilder::CreateTemplateTypeParameter(DIDescriptor Context, StringRef Name, + DIType Ty, MDNode *File, unsigned LineNo, + unsigned ColumnNo) { + Value *Elts[] = { + GetTagConstant(VMContext, dwarf::DW_TAG_template_type_parameter), + Context, + MDString::get(VMContext, Name), + Ty, + File, + ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), + ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo) + }; + return DITemplateTypeParameter(MDNode::get(VMContext, &Elts[0], + array_lengthof(Elts))); +} + /// CreateStructType - Create debugging information entry for a struct. DIType DIBuilder::CreateStructType(DIDescriptor Context, StringRef Name, DIFile File, unsigned LineNumber, Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Feb 2 15:38:25 2011 @@ -221,6 +221,12 @@ return false; } +/// isTemplateTypeParameter - Return true if the specified tag is +/// DW_TAG_template_type_parameter. +bool DIDescriptor::isTemplateTypeParameter() const { + return DbgNode && getTag() == dwarf::DW_TAG_template_type_parameter; +} + /// isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit. bool DIDescriptor::isCompileUnit() const { return DbgNode && getTag() == dwarf::DW_TAG_compile_unit; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 2 15:38:25 2011 @@ -1151,6 +1151,18 @@ DIDescriptor Context = CTy.getContext(); addToContextOwner(&Buffer, Context); } + + if (Tag == dwarf::DW_TAG_class_type) { + DIArray TParams = CTy.getTemplateParams(); + unsigned N = TParams.getNumElements(); + // Add template parameters. + for (unsigned i = 0; i < N; ++i) { + DIDescriptor Element = TParams.getElement(i); + if (Element.isTemplateTypeParameter()) + Buffer.addChild(getOrCreateTemplateTypeParameterDIE( + DITemplateTypeParameter(Element))); + } + } break; } default: @@ -1181,6 +1193,21 @@ } } +/// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create new DIE +/// for the given DITemplateTypeParameter. +DIE * +DwarfDebug::getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP) { + CompileUnit *TypeCU = getCompileUnit(TP); + DIE *ParamDIE = TypeCU->getDIE(TP); + if (ParamDIE) + return ParamDIE; + + ParamDIE = new DIE(dwarf::DW_TAG_template_type_parameter); + addType(ParamDIE, TP.getType()); + addString(ParamDIE, dwarf::DW_AT_name, dwarf::DW_FORM_string, TP.getName()); + return ParamDIE; +} + /// constructSubrangeDIE - Construct subrange DIE from DISubrange. void DwarfDebug::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy){ int64_t L = SR.getLo(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=124752&r1=124751&r2=124752&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 2 15:38:25 2011 @@ -52,6 +52,7 @@ class DINameSpace; class DISubrange; class DICompositeType; +class DITemplateTypeParameter; //===----------------------------------------------------------------------===// /// SrcLineInfo - This class is used to record source line correspondence. @@ -342,6 +343,10 @@ /// given DIType. DIE *getOrCreateTypeDIE(DIType Ty); + /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create new DIE + /// for the given DITemplateTypeParameter. + DIE *getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP); + void addPubTypes(DISubprogram SP); /// constructTypeDIE - Construct basic type die from DIBasicType. From dpatel at apple.com Wed Feb 2 16:35:54 2011 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Feb 2011 22:35:54 -0000 Subject: [llvm-commits] [llvm] r124755 - in /llvm/trunk: include/llvm/Analysis/DIBuilder.h include/llvm/Analysis/DebugInfo.h lib/Analysis/DIBuilder.cpp lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h Message-ID: <20110202223554.1E31B2A6C12C@llvm.org> Author: dpatel Date: Wed Feb 2 16:35:53 2011 New Revision: 124755 URL: http://llvm.org/viewvc/llvm-project?rev=124755&view=rev Log: Add support to describe template value parameter in debug info. Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DIBuilder.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DIBuilder.h?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DIBuilder.h (original) +++ llvm/trunk/include/llvm/Analysis/DIBuilder.h Wed Feb 2 16:35:53 2011 @@ -39,6 +39,7 @@ class DILexicalBlock; class DISubprogram; class DITemplateTypeParameter; + class DITemplateValueParameter; class DIBuilder { private: @@ -198,7 +199,7 @@ /// CreateTemplateTypeParameter - Create debugging information for template /// type parameter. - /// @param Scope Scope in which this type is dfiend + /// @param Scope Scope in which this type is defined. /// @param Name Type parameter name. /// @param Ty Parameter type. /// @param File File where this type parameter is defined. @@ -209,6 +210,21 @@ MDNode *File = 0, unsigned LineNo = 0, unsigned ColumnNo = 0); + /// CreateTemplateValueParameter - Create debugging information for template + /// value parameter. + /// @param Scope Scope in which this type is defined. + /// @param Name Value parameter name. + /// @param Ty Parameter type. + /// @param Value Constant parameter value. + /// @param File File where this type parameter is defined. + /// @param LineNo Line number. + /// @param ColumnNo Column Number. + DITemplateValueParameter + CreateTemplateValueParameter(DIDescriptor Scope, StringRef Name, DIType Ty, + uint64_t Value, + MDNode *File = 0, unsigned LineNo = 0, + unsigned ColumnNo = 0); + /// CreateArrayType - Create debugging information entry for an array. /// @param Size Array size. /// @param AlignInBits Alignment. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Wed Feb 2 16:35:53 2011 @@ -123,6 +123,7 @@ bool isGlobal() const; bool isUnspecifiedParameter() const; bool isTemplateTypeParameter() const; + bool isTemplateValueParameter() const; }; /// DISubrange - This is used to represent ranges, for array bounds. @@ -387,6 +388,25 @@ unsigned getColumnNumber() const { return getUnsignedField(6); } }; + /// DITemplateValueParameter - This is a wrapper for template value parameter. + class DITemplateValueParameter : public DIDescriptor { + public: + explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {} + + DIScope getContext() const { return getFieldAs(1); } + StringRef getName() const { return getStringField(2); } + DIType getType() const { return getFieldAs(3); } + uint64_t getValue() const { return getUInt64Field(4); } + StringRef getFilename() const { + return getFieldAs(5).getFilename(); + } + StringRef getDirectory() const { + return getFieldAs(5).getDirectory(); + } + unsigned getLineNumber() const { return getUnsignedField(6); } + unsigned getColumnNumber() const { return getUnsignedField(7); } + }; + /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). class DISubprogram : public DIScope { public: Modified: llvm/trunk/lib/Analysis/DIBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DIBuilder.cpp?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DIBuilder.cpp (original) +++ llvm/trunk/lib/Analysis/DIBuilder.cpp Wed Feb 2 16:35:53 2011 @@ -282,6 +282,27 @@ array_lengthof(Elts))); } +/// CreateTemplateValueParameter - Create debugging information for template +/// value parameter. +DITemplateValueParameter +DIBuilder::CreateTemplateValueParameter(DIDescriptor Context, StringRef Name, + DIType Ty, uint64_t Val, + MDNode *File, unsigned LineNo, + unsigned ColumnNo) { + Value *Elts[] = { + GetTagConstant(VMContext, dwarf::DW_TAG_template_value_parameter), + Context, + MDString::get(VMContext, Name), + Ty, + ConstantInt::get(Type::getInt64Ty(VMContext), Val), + File, + ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), + ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo) + }; + return DITemplateValueParameter(MDNode::get(VMContext, &Elts[0], + array_lengthof(Elts))); +} + /// CreateStructType - Create debugging information entry for a struct. DIType DIBuilder::CreateStructType(DIDescriptor Context, StringRef Name, DIFile File, unsigned LineNumber, Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Feb 2 16:35:53 2011 @@ -227,6 +227,12 @@ return DbgNode && getTag() == dwarf::DW_TAG_template_type_parameter; } +/// isTemplateValueParameter - Return true if the specified tag is +/// DW_TAG_template_value_parameter. +bool DIDescriptor::isTemplateValueParameter() const { + return DbgNode && getTag() == dwarf::DW_TAG_template_value_parameter; +} + /// isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit. bool DIDescriptor::isCompileUnit() const { return DbgNode && getTag() == dwarf::DW_TAG_compile_unit; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 2 16:35:53 2011 @@ -1161,6 +1161,9 @@ if (Element.isTemplateTypeParameter()) Buffer.addChild(getOrCreateTemplateTypeParameterDIE( DITemplateTypeParameter(Element))); + else if (Element.isTemplateValueParameter()) + Buffer.addChild(getOrCreateTemplateValueParameterDIE( + DITemplateValueParameter(Element))); } } break; @@ -1208,6 +1211,23 @@ return ParamDIE; } +/// getOrCreateTemplateValueParameterDIE - Find existing DIE or create new DIE +/// for the given DITemplateValueParameter. +DIE * +DwarfDebug::getOrCreateTemplateValueParameterDIE(DITemplateValueParameter TPV) { + CompileUnit *TVCU = getCompileUnit(TPV); + DIE *ParamDIE = TVCU->getDIE(TPV); + if (ParamDIE) + return ParamDIE; + + ParamDIE = new DIE(dwarf::DW_TAG_template_value_parameter); + addType(ParamDIE, TPV.getType()); + addString(ParamDIE, dwarf::DW_AT_name, dwarf::DW_FORM_string, TPV.getName()); + addUInt(ParamDIE, dwarf::DW_AT_const_value, dwarf::DW_FORM_udata, + TPV.getValue()); + return ParamDIE; +} + /// constructSubrangeDIE - Construct subrange DIE from DISubrange. void DwarfDebug::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy){ int64_t L = SR.getLo(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=124755&r1=124754&r2=124755&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 2 16:35:53 2011 @@ -53,6 +53,7 @@ class DISubrange; class DICompositeType; class DITemplateTypeParameter; +class DITemplateValueParameter; //===----------------------------------------------------------------------===// /// SrcLineInfo - This class is used to record source line correspondence. @@ -347,6 +348,10 @@ /// for the given DITemplateTypeParameter. DIE *getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP); + /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create new DIE + /// for the given DITemplateValueParameter. + DIE *getOrCreateTemplateValueParameterDIE(DITemplateValueParameter TVP); + void addPubTypes(DISubprogram SP); /// constructTypeDIE - Construct basic type die from DIBasicType. From dpatel at apple.com Wed Feb 2 18:13:47 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Feb 2011 00:13:47 -0000 Subject: [llvm-commits] [llvm] r124759 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <20110203001347.C46F52A6C12C@llvm.org> Author: dpatel Date: Wed Feb 2 18:13:47 2011 New Revision: 124759 URL: http://llvm.org/viewvc/llvm-project?rev=124759&view=rev Log: Fix typo in comment. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=124759&r1=124758&r2=124759&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Feb 2 18:13:47 2011 @@ -199,7 +199,7 @@ return isGlobalVariable(); } -/// isUnspecifiedParmeter - Return true if the specified tab is +/// isUnspecifiedParmeter - Return true if the specified tag is /// DW_TAG_unspecified_parameters. bool DIDescriptor::isUnspecifiedParameter() const { return DbgNode && getTag() == dwarf::DW_TAG_unspecified_parameters; From dpatel at apple.com Wed Feb 2 18:22:17 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Feb 2011 00:22:17 -0000 Subject: [llvm-commits] [llvm] r124761 - /llvm/trunk/docs/SourceLevelDebugging.html Message-ID: <20110203002217.554C22A6C12C@llvm.org> Author: dpatel Date: Wed Feb 2 18:22:17 2011 New Revision: 124761 URL: http://llvm.org/viewvc/llvm-project?rev=124761&view=rev Log: Update docs to match reality. Modified: llvm/trunk/docs/SourceLevelDebugging.html Modified: llvm/trunk/docs/SourceLevelDebugging.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/SourceLevelDebugging.html?rev=124761&r1=124760&r2=124761&view=diff ============================================================================== --- llvm/trunk/docs/SourceLevelDebugging.html (original) +++ llvm/trunk/docs/SourceLevelDebugging.html Wed Feb 2 18:22:17 2011 @@ -588,9 +588,8 @@ the bit offset if embedded in a composite type.

    -

    Note that the void * type is expressed as a - llvm.dbg.derivedtype.type with tag of DW_TAG_pointer_type - and NULL derived type.

    +

    Note that the void * type is expressed as a type derived from NULL. +

    @@ -689,7 +688,7 @@
    -%llvm.dbg.subrange.type = type {
    +!42 = metadata !{
       i32,    ;; Tag = 33 + LLVMDebugVersion (DW_TAG_subrange_type)
       i64,    ;; Low value
       i64     ;; High value
    @@ -859,13 +858,13 @@
       %Y = alloca i32, align 4                        ; <i32*> [#uses=4]
       %Z = alloca i32, align 4                        ; <i32*> [#uses=3]
       %0 = bitcast i32* %X to {}*                     ; <{}*> [#uses=1]
    -  call void @llvm.dbg.declare({}* %0, metadata !0), !dbg !7
    +  call void @llvm.dbg.declare(metadata !{i32 * %X}, metadata !0), !dbg !7
       store i32 21, i32* %X, !dbg !8
       %1 = bitcast i32* %Y to {}*                     ; <{}*> [#uses=1]
    -  call void @llvm.dbg.declare({}* %1, metadata !9), !dbg !10
    +  call void @llvm.dbg.declare(metadata !{i32 * %Y}, metadata !9), !dbg !10
       store i32 22, i32* %Y, !dbg !11
       %2 = bitcast i32* %Z to {}*                     ; <{}*> [#uses=1]
    -  call void @llvm.dbg.declare({}* %2, metadata !12), !dbg !14
    +  call void @llvm.dbg.declare(metadata !{i32 * %Z}, metadata !12), !dbg !14
       store i32 23, i32* %Z, !dbg !15
       %tmp = load i32* %X, !dbg !16                   ; <i32> [#uses=1]
       %tmp1 = load i32* %Y, !dbg !16                  ; <i32> [#uses=1]
    @@ -876,7 +875,7 @@
       ret void, !dbg !18
     }
     
    -declare void @llvm.dbg.declare({}*, metadata) nounwind readnone
    +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
     
     !0 = metadata !{i32 459008, metadata !1, metadata !"X", 
                     metadata !3, i32 2, metadata !6}; [ DW_TAG_auto_variable ]
    @@ -918,7 +917,7 @@
     
     
    -call void @llvm.dbg.declare({}* %0, metadata !0), !dbg !7   
    +call void @llvm.dbg.declare(metadata, metadata !0), !dbg !7   
     
    @@ -953,7 +952,7 @@
    -call void @llvm.dbg.declare({}* %2, metadata !12), !dbg !14
    +call void @llvm.dbg.declare(metadata, metadata !12), !dbg !14
     
    From stoklund at 2pi.dk Wed Feb 2 18:54:23 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 00:54:23 -0000 Subject: [llvm-commits] [llvm] r124765 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveRangeEdit.h lib/CodeGen/RegAllocGreedy.cpp lib/CodeGen/SplitKit.cpp lib/CodeGen/SplitKit.h Message-ID: <20110203005424.28E242A6C12C@llvm.org> Author: stoklund Date: Wed Feb 2 18:54:23 2011 New Revision: 124765 URL: http://llvm.org/viewvc/llvm-project?rev=124765&view=rev Log: Defer SplitKit value mapping until all defs are available. The greedy register allocator revealed some problems with the value mapping in SplitKit. We would sometimes start mapping values before all defs were known, and that could change a value from a simple 1-1 mapping to a multi-def mapping that requires ssa update. The new approach collects all defs and register assignments first without filling in any live intervals. Only when finish() is called, do we compute liveness and mapped values. At this time we know with certainty which values map to multiple values in a split range. This also has the advantage that we can compute live ranges based on the remaining uses after rematerializing at split points. The current implementation has many opportunities for compile time optimization. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/lib/CodeGen/LiveRangeEdit.h llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=124765&r1=124764&r2=124765&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 2 18:54:23 2011 @@ -560,7 +560,7 @@ /// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// the equivalence class assigned the VNI. - unsigned getEqClass(const VNInfo *VNI) { return eqClass_[VNI->id]; } + unsigned getEqClass(const VNInfo *VNI) const { return eqClass_[VNI->id]; } /// Distribute - Distribute values in LIV[0] into a separate LiveInterval /// for each connected component. LIV must have a LiveInterval for each Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.h?rev=124765&r1=124764&r2=124765&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveRangeEdit.h (original) +++ llvm/trunk/lib/CodeGen/LiveRangeEdit.h Wed Feb 2 18:54:23 2011 @@ -78,6 +78,7 @@ iterator begin() const { return newRegs_.begin()+firstNew_; } iterator end() const { return newRegs_.end(); } unsigned size() const { return newRegs_.size()-firstNew_; } + bool empty() const { return size() == 0; } LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; } /// create - Create a new register with the same class and stack slot as Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124765&r1=124764&r2=124765&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Wed Feb 2 18:54:23 2011 @@ -645,9 +645,6 @@ LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); SplitEditor SE(*SA, *LIS, *VRM, *DomTree, LREdit); - // Ranges to add to the register interval after all defs are in place. - SmallVector UseRanges; - // Create the main cross-block interval. SE.openIntv(); @@ -684,7 +681,7 @@ if (!BI.LiveThrough) { DEBUG(dbgs() << ", not live-through.\n"); SE.enterIntvBefore(BI.Def); - UseRanges.push_back(IndexPair(BI.Def, Stop)); + SE.useIntv(BI.Def, Stop); continue; } if (!RegIn) { @@ -692,7 +689,7 @@ // Reload just before the first use. DEBUG(dbgs() << ", not live-in, enter before first use.\n"); SE.enterIntvBefore(BI.FirstUse); - UseRanges.push_back(IndexPair(BI.FirstUse, Stop)); + SE.useIntv(BI.FirstUse, Stop); continue; } DEBUG(dbgs() << ", live-through.\n"); @@ -717,7 +714,7 @@ DEBUG(dbgs() << ", free use at " << Use << ".\n"); assert(Use <= BI.LastUse && "Couldn't find last use"); SE.enterIntvBefore(Use); - UseRanges.push_back(IndexPair(Use, Stop)); + SE.useIntv(Use, Stop); continue; } @@ -726,12 +723,6 @@ SE.enterIntvAtEnd(*BI.MBB); } - // Add the live-out ranges following the defs. - // We must wait until all defs have been inserted, otherwise SplitKit gets - // confused about the value mapping. - for (unsigned i = 0, e = UseRanges.size(); i != e; ++i) - SE.useIntv(UseRanges[i].first, UseRanges[i].second); - // Now all defs leading to live bundles are handled, do everything else. for (unsigned i = 0, e = LiveBlocks.size(); i != e; ++i) { BlockInfo &BI = LiveBlocks[i]; Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124765&r1=124764&r2=124765&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Wed Feb 2 18:54:23 2011 @@ -449,7 +449,6 @@ // VNInfo. Insert phi-def VNInfos along the path back to IdxMBB. DEBUG(dbgs() << "\n Reaching defs for BB#" << IdxMBB->getNumber() << " at " << Idx << " in " << *LI << '\n'); - DEBUG(dumpCache()); // Blocks where LI should be live-in. SmallVector LiveIn; @@ -587,7 +586,6 @@ assert(IdxVNI && "Didn't find value for Idx"); #ifndef NDEBUG - DEBUG(dumpCache()); // Check the LiveOutCache invariants. for (LiveOutMap::iterator I = LiveOutCache.begin(), E = LiveOutCache.end(); I != E; ++I) { @@ -729,69 +727,86 @@ LiveRangeEdit &edit) : sa_(sa), LIS(lis), VRM(vrm), MRI(vrm.getMachineFunction().getRegInfo()), + MDT(mdt), TII(*vrm.getMachineFunction().getTarget().getInstrInfo()), TRI(*vrm.getMachineFunction().getTarget().getRegisterInfo()), Edit(edit), - DupLI(LIS, mdt, edit.getParent()), - OpenLI(LIS, mdt, edit.getParent()) + OpenIdx(0), + RegAssign(Allocator) { // We don't need an AliasAnalysis since we will only be performing // cheap-as-a-copy remats anyway. Edit.anyRematerializable(LIS, TII, 0); } -bool SplitEditor::intervalsLiveAt(SlotIndex Idx) const { - for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) - if (*I != DupLI.getLI() && (*I)->liveAt(Idx)) - return true; - return false; +void SplitEditor::dump() const { + if (RegAssign.empty()) { + dbgs() << " empty\n"; + return; + } + + for (RegAssignMap::const_iterator I = RegAssign.begin(); I.valid(); ++I) + dbgs() << " [" << I.start() << ';' << I.stop() << "):" << I.value(); + dbgs() << '\n'; } -VNInfo *SplitEditor::defFromParent(LiveIntervalMap &Reg, +VNInfo *SplitEditor::defFromParent(unsigned RegIdx, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) { - VNInfo *VNI = 0; MachineInstr *CopyMI = 0; SlotIndex Def; + LiveInterval *LI = Edit.get(RegIdx); // Attempt cheap-as-a-copy rematerialization. LiveRangeEdit::Remat RM(ParentVNI); if (Edit.canRematerializeAt(RM, UseIdx, true, LIS)) { - Def = Edit.rematerializeAt(MBB, I, Reg.getLI()->reg, RM, - LIS, TII, TRI); + Def = Edit.rematerializeAt(MBB, I, LI->reg, RM, LIS, TII, TRI); } else { // Can't remat, just insert a copy from parent. - CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), - Reg.getLI()->reg).addReg(Edit.getReg()); + CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), LI->reg) + .addReg(Edit.getReg()); Def = LIS.InsertMachineInstrInMaps(CopyMI).getDefIndex(); } // Define the value in Reg. - VNI = Reg.defValue(ParentVNI, Def); + VNInfo *VNI = LIMappers[RegIdx].defValue(ParentVNI, Def); VNI->setCopy(CopyMI); // Add minimal liveness for the new value. - if (UseIdx < Def) - UseIdx = Def; - Reg.getLI()->addRange(LiveRange(Def, UseIdx.getNextSlot(), VNI)); + Edit.get(RegIdx)->addRange(LiveRange(Def, Def.getNextSlot(), VNI)); + + if (RegIdx) { + if (UseIdx < Def) + UseIdx = Def; + RegAssign.insert(Def, UseIdx.getNextSlot(), RegIdx); + } return VNI; } /// Create a new virtual register and live interval. void SplitEditor::openIntv() { - assert(!OpenLI.getLI() && "Previous LI not closed before openIntv"); - if (!DupLI.getLI()) - DupLI.reset(&Edit.create(MRI, LIS, VRM)); + assert(!OpenIdx && "Previous LI not closed before openIntv"); - OpenLI.reset(&Edit.create(MRI, LIS, VRM)); + // Create the complement as index 0. + if (Edit.empty()) { + Edit.create(MRI, LIS, VRM); + LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); + LIMappers.back().reset(Edit.get(0)); + } + + // Create the open interval. + OpenIdx = Edit.size(); + Edit.create(MRI, LIS, VRM); + LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); + LIMappers[OpenIdx].reset(Edit.get(OpenIdx)); } /// enterIntvBefore - Enter OpenLI before the instruction at Idx. If CurLI is /// not live before Idx, a COPY is not inserted. void SplitEditor::enterIntvBefore(SlotIndex Idx) { - assert(OpenLI.getLI() && "openIntv not called before enterIntvBefore"); + assert(OpenIdx && "openIntv not called before enterIntvBefore"); Idx = Idx.getUseIndex(); DEBUG(dbgs() << " enterIntvBefore " << Idx); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); @@ -800,18 +815,16 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - truncatedValues.insert(ParentVNI); MachineInstr *MI = LIS.getInstructionFromIndex(Idx); assert(MI && "enterIntvBefore called with invalid index"); - defFromParent(OpenLI, ParentVNI, Idx, *MI->getParent(), MI); - - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + defFromParent(OpenIdx, ParentVNI, Idx, *MI->getParent(), MI); + DEBUG(dump()); } /// enterIntvAtEnd - Enter OpenLI at the end of MBB. void SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) { - assert(OpenLI.getLI() && "openIntv not called before enterIntvAtEnd"); + assert(OpenIdx && "openIntv not called before enterIntvAtEnd"); SlotIndex End = LIS.getMBBEndIdx(&MBB).getPrevSlot(); DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << End); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(End); @@ -820,9 +833,8 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - truncatedValues.insert(ParentVNI); - defFromParent(OpenLI, ParentVNI, End, MBB, MBB.getFirstTerminator()); - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + defFromParent(OpenIdx, ParentVNI, End, MBB, MBB.getFirstTerminator()); + DEBUG(dump()); } /// useIntv - indicate that all instructions in MBB should use OpenLI. @@ -831,15 +843,15 @@ } void SplitEditor::useIntv(SlotIndex Start, SlotIndex End) { - assert(OpenLI.getLI() && "openIntv not called before useIntv"); - OpenLI.addRange(Start, End); - DEBUG(dbgs() << " use [" << Start << ';' << End << "): " - << *OpenLI.getLI() << '\n'); + assert(OpenIdx && "openIntv not called before useIntv"); + DEBUG(dbgs() << " useIntv [" << Start << ';' << End << "):"); + RegAssign.insert(Start, End, OpenIdx); + DEBUG(dump()); } /// leaveIntvAfter - Leave OpenLI after the instruction at Idx. void SplitEditor::leaveIntvAfter(SlotIndex Idx) { - assert(OpenLI.getLI() && "openIntv not called before leaveIntvAfter"); + assert(OpenIdx && "openIntv not called before leaveIntvAfter"); DEBUG(dbgs() << " leaveIntvAfter " << Idx); // The interval must be live beyond the instruction at Idx. @@ -852,20 +864,17 @@ DEBUG(dbgs() << ": valno " << ParentVNI->id); MachineBasicBlock::iterator MII = LIS.getInstructionFromIndex(Idx); - VNInfo *VNI = defFromParent(DupLI, ParentVNI, Idx, + VNInfo *VNI = defFromParent(0, ParentVNI, Idx, *MII->getParent(), llvm::next(MII)); - // Make sure that OpenLI is properly extended from Idx to the new copy. - // FIXME: This shouldn't be necessary for remats. - OpenLI.addSimpleRange(Idx, VNI->def, ParentVNI); - - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + RegAssign.insert(Idx, VNI->def, OpenIdx); + DEBUG(dump()); } /// leaveIntvAtTop - Leave the interval at the top of MBB. /// Currently, only one value can leave the interval. void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { - assert(OpenLI.getLI() && "openIntv not called before leaveIntvAtTop"); + assert(OpenIdx && "openIntv not called before leaveIntvAtTop"); SlotIndex Start = LIS.getMBBStartIdx(&MBB); DEBUG(dbgs() << " leaveIntvAtTop BB#" << MBB.getNumber() << ", " << Start); @@ -875,179 +884,130 @@ return; } - VNInfo *VNI = defFromParent(DupLI, ParentVNI, Start, MBB, + VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB, MBB.SkipPHIsAndLabels(MBB.begin())); - - // Finally we must make sure that OpenLI is properly extended from Start to - // the new copy. - OpenLI.addSimpleRange(Start, VNI->def, ParentVNI); - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + RegAssign.insert(Start, VNI->def, OpenIdx); + DEBUG(dump()); } /// closeIntv - Indicate that we are done editing the currently open /// LiveInterval, and ranges can be trimmed. void SplitEditor::closeIntv() { - assert(OpenLI.getLI() && "openIntv not called before closeIntv"); - DEBUG(dbgs() << " closeIntv " << *OpenLI.getLI() << '\n'); - OpenLI.reset(0); + assert(OpenIdx && "openIntv not called before closeIntv"); + OpenIdx = 0; } -/// rewrite - Rewrite all uses of reg to use the new registers. -void SplitEditor::rewrite(unsigned reg) { - for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(reg), +/// rewriteAssigned - Rewrite all uses of Edit.getReg(). +void SplitEditor::rewriteAssigned() { + for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Edit.getReg()), RE = MRI.reg_end(); RI != RE;) { MachineOperand &MO = RI.getOperand(); - unsigned OpNum = RI.getOperandNo(); MachineInstr *MI = MO.getParent(); ++RI; + // LiveDebugVariables should have handled all DBG_VALUE instructions. if (MI->isDebugValue()) { DEBUG(dbgs() << "Zapping " << *MI); - // FIXME: We can do much better with debug values. MO.setReg(0); continue; } SlotIndex Idx = LIS.getInstructionIndex(MI); Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); - LiveInterval *LI = 0; - for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; - ++I) { - LiveInterval *testli = *I; - if (testli->liveAt(Idx)) { - LI = testli; - break; - } - } - DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t'<< Idx); - assert(LI && "No register was live at use"); - MO.setReg(LI->reg); - if (MO.isUse() && !MI->isRegTiedToDefOperand(OpNum)) - MO.setIsKill(LI->killedAt(Idx.getDefIndex())); - DEBUG(dbgs() << '\t' << *MI); + + // Rewrite to the mapped register at Idx. + unsigned RegIdx = RegAssign.lookup(Idx); + MO.setReg(Edit.get(RegIdx)->reg); + DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' + << Idx << ':' << RegIdx << '\t' << *MI); + + // Extend liveness to Idx. + const VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); + LIMappers[RegIdx].mapValue(ParentVNI, Idx); } } -void -SplitEditor::addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI) { - // Build vector of iterator pairs from the intervals. - typedef std::pair IIPair; - SmallVector Iters; - for (LiveRangeEdit::iterator LI = Edit.begin(), LE = Edit.end(); LI != LE; - ++LI) { - if (*LI == DupLI.getLI()) +/// rewriteSplit - Rewrite uses of Intvs[0] according to the ConEQ mapping. +void SplitEditor::rewriteComponents(const SmallVectorImpl &Intvs, + const ConnectedVNInfoEqClasses &ConEq) { + for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Intvs[0]->reg), + RE = MRI.reg_end(); RI != RE;) { + MachineOperand &MO = RI.getOperand(); + MachineInstr *MI = MO.getParent(); + ++RI; + if (MO.isUse() && MO.isUndef()) continue; - LiveInterval::const_iterator I = (*LI)->find(Start); - LiveInterval::const_iterator E = (*LI)->end(); - if (I != E) - Iters.push_back(std::make_pair(I, E)); - } - - SlotIndex sidx = Start; - // Break [Start;End) into segments that don't overlap any intervals. - for (;;) { - SlotIndex next = sidx, eidx = End; - // Find overlapping intervals. - for (unsigned i = 0; i != Iters.size() && sidx < eidx; ++i) { - LiveInterval::const_iterator I = Iters[i].first; - // Interval I is overlapping [sidx;eidx). Trim sidx. - if (I->start <= sidx) { - sidx = I->end; - // Move to the next run, remove iters when all are consumed. - I = ++Iters[i].first; - if (I == Iters[i].second) { - Iters.erase(Iters.begin() + i); - --i; - continue; - } - } - // Trim eidx too if needed. - if (I->start >= eidx) - continue; - eidx = I->start; - next = I->end; - } - // Now, [sidx;eidx) doesn't overlap anything in intervals_. - if (sidx < eidx) - DupLI.addSimpleRange(sidx, eidx, VNI); - // If the interval end was truncated, we can try again from next. - if (next <= sidx) - break; - sidx = next; + // DBG_VALUE instructions should have been eliminated earlier. + SlotIndex Idx = LIS.getInstructionIndex(MI); + Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); + DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' + << Idx << ':'); + const VNInfo *VNI = Intvs[0]->getVNInfoAt(Idx); + assert(VNI && "Interval not live at use."); + MO.setReg(Intvs[ConEq.getEqClass(VNI)]->reg); + DEBUG(dbgs() << VNI->id << '\t' << *MI); } } -void SplitEditor::computeRemainder() { - // First we need to fill in the live ranges in dupli. - // If values were redefined, we need a full recoloring with SSA update. - // If values were truncated, we only need to truncate the ranges. - // If values were partially rematted, we should shrink to uses. - // If values were fully rematted, they should be omitted. - // FIXME: If a single value is redefined, just move the def and truncate. - LiveInterval &parent = Edit.getParent(); - - DEBUG(dbgs() << "computeRemainder from " << parent << '\n'); - - // Values that are fully contained in the split intervals. - SmallPtrSet deadValues; - // Map all CurLI values that should have live defs in dupli. - for (LiveInterval::const_vni_iterator I = parent.vni_begin(), - E = parent.vni_end(); I != E; ++I) { - const VNInfo *VNI = *I; - // Don't transfer unused values to the new intervals. - if (VNI->isUnused()) - continue; - // Original def is contained in the split intervals. - if (intervalsLiveAt(VNI->def)) { - // Did this value escape? - if (DupLI.isMapped(VNI)) - truncatedValues.insert(VNI); - else - deadValues.insert(VNI); - continue; - } - // Add minimal live range at the definition. - VNInfo *DVNI = DupLI.defValue(VNI, VNI->def); - DupLI.getLI()->addRange(LiveRange(VNI->def, VNI->def.getNextSlot(), DVNI)); +void SplitEditor::finish() { + assert(OpenIdx == 0 && "Previous LI not closed before rewrite"); + + // At this point, the live intervals in Edit contain VNInfos corresponding to + // the inserted copies. + + // Add the original defs from the parent interval. + for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), + E = Edit.getParent().vni_end(); I != E; ++I) { + const VNInfo *ParentVNI = *I; + LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(ParentVNI->def)]; + VNInfo *VNI = LIM.defValue(ParentVNI, ParentVNI->def); + LIM.getLI()->addRange(LiveRange(ParentVNI->def, + ParentVNI->def.getNextSlot(), VNI)); + // Mark all values as complex to force liveness computation. + // This should really only be necessary for remat victims, but we are lazy. + LIM.markComplexMapped(ParentVNI); } - // Add all ranges to dupli. - for (LiveInterval::const_iterator I = parent.begin(), E = parent.end(); - I != E; ++I) { - const LiveRange &LR = *I; - if (truncatedValues.count(LR.valno)) { - // recolor after removing intervals_. - addTruncSimpleRange(LR.start, LR.end, LR.valno); - } else if (!deadValues.count(LR.valno)) { - // recolor without truncation. - DupLI.addSimpleRange(LR.start, LR.end, LR.valno); +#ifndef NDEBUG + // Every new interval must have a def by now, otherwise the split is bogus. + for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) + assert((*I)->hasAtLeastOneValue() && "Split interval has no value"); +#endif + + // FIXME: Don't recompute the liveness of all values, infer it from the + // overlaps between the parent live interval and RegAssign. + // The mapValue algorithm is only necessary when: + // - The parent value maps to multiple defs, and new phis are needed, or + // - The value has been rematerialized before some uses, and we want to + // minimize the live range so it only reaches the remaining uses. + // All other values have simple liveness that can be computed from RegAssign + // and the parent live interval. + + // Extend live ranges to be live-out for successor PHI values. + for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), + E = Edit.getParent().vni_end(); I != E; ++I) { + const VNInfo *PHIVNI = *I; + if (!PHIVNI->isPHIDef()) + continue; + LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(PHIVNI->def)]; + MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); + for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), + PE = MBB->pred_end(); PI != PE; ++PI) { + SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); + // The predecessor may not have a live-out value. That is OK, like an + // undef PHI operand. + if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) + LIM.mapValue(VNI, End); } } - // Extend DupLI to be live out of any critical loop predecessors. - // This means we have multiple registers live out of those blocks. - // The alternative would be to split the critical edges. - if (criticalPreds_.empty()) - return; - for (SplitAnalysis::BlockPtrSet::iterator I = criticalPreds_.begin(), - E = criticalPreds_.end(); I != E; ++I) - DupLI.extendTo(*I, LIS.getMBBEndIdx(*I).getPrevSlot()); - criticalPreds_.clear(); -} - -void SplitEditor::finish() { - assert(!OpenLI.getLI() && "Previous LI not closed before rewrite"); - assert(DupLI.getLI() && "No dupli for rewrite. Noop spilt?"); + // Rewrite instructions. + rewriteAssigned(); - // Complete dupli liveness. - computeRemainder(); + // FIXME: Delete defs that were rematted everywhere. // Get rid of unused values and set phi-kill flags. for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) (*I)->RenumberValues(LIS); - // Rewrite instructions. - rewrite(Edit.getReg()); - // Now check if any registers were separated into multiple components. ConnectedVNInfoEqClasses ConEQ(LIS); for (unsigned i = 0, e = Edit.size(); i != e; ++i) { @@ -1061,9 +1021,8 @@ dups.push_back(li); for (unsigned i = 1; i != NumComp; ++i) dups.push_back(&Edit.create(MRI, LIS, VRM)); + rewriteComponents(dups, ConEQ); ConEQ.Distribute(&dups[0]); - // Rewrite uses to the new regs. - rewrite(li->reg); } // Calculate spill weight and allocation hints for new intervals. @@ -1095,9 +1054,6 @@ sa_.getCriticalExits(Blocks, CriticalExits); assert(CriticalExits.empty() && "Cannot break critical exits yet"); - // Get critical predecessors so computeRemainder can deal with them. - sa_.getCriticalPreds(Blocks, criticalPreds_); - // Create new live interval for the loop. openIntv(); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=124765&r1=124764&r2=124765&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Wed Feb 2 18:54:23 2011 @@ -13,11 +13,13 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/SlotIndexes.h" namespace llvm { +class ConnectedVNInfoEqClasses; class LiveInterval; class LiveIntervals; class LiveRangeEdit; @@ -263,6 +265,10 @@ /// with defValue. bool isComplexMapped(const VNInfo *ParentVNI) const; + /// markComplexMapped - Mark ParentVNI as complex mapped regardless of the + /// number of definitions. + void markComplexMapped(const VNInfo *ParentVNI) { Values[ParentVNI] = 0; } + // addSimpleRange - Add a simple range from ParentLI to LI. // ParentVNI must be live in the [Start;End) interval. void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI); @@ -290,49 +296,49 @@ LiveIntervals &LIS; VirtRegMap &VRM; MachineRegisterInfo &MRI; + MachineDominatorTree &MDT; const TargetInstrInfo &TII; const TargetRegisterInfo &TRI; /// Edit - The current parent register and new intervals created. LiveRangeEdit &Edit; - /// DupLI - Created as a copy of CurLI, ranges are carved out as new - /// intervals get added through openIntv / closeIntv. This is used to avoid - /// editing CurLI. - LiveIntervalMap DupLI; + /// Index into Edit of the currently open interval. + /// The index 0 is used for the complement, so the first interval started by + /// openIntv will be 1. + unsigned OpenIdx; + + typedef IntervalMap RegAssignMap; + + /// Allocator for the interval map. This will eventually be shared with + /// SlotIndexes and LiveIntervals. + RegAssignMap::Allocator Allocator; + + /// RegAssign - Map of the assigned register indexes. + /// Edit.get(RegAssign.lookup(Idx)) is the register that should be live at + /// Idx. + RegAssignMap RegAssign; - /// Currently open LiveInterval. - LiveIntervalMap OpenLI; + /// LIMappers - One LiveIntervalMap or each interval in Edit. + SmallVector LIMappers; /// defFromParent - Define Reg from ParentVNI at UseIdx using either /// rematerialization or a COPY from parent. Return the new value. - VNInfo *defFromParent(LiveIntervalMap &Reg, + VNInfo *defFromParent(unsigned RegIdx, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I); - /// intervalsLiveAt - Return true if any member of intervals_ is live at Idx. - bool intervalsLiveAt(SlotIndex Idx) const; + /// rewriteAssigned - Rewrite all uses of Edit.getReg() to assigned registers. + void rewriteAssigned(); - /// Values in CurLI whose live range has been truncated when entering an open - /// li. - SmallPtrSet truncatedValues; - - /// addTruncSimpleRange - Add the given simple range to DupLI after - /// truncating any overlap with intervals_. - void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI); - - /// criticalPreds_ - Set of basic blocks where both dupli and OpenLI should be - /// live out because of a critical edge. - SplitAnalysis::BlockPtrSet criticalPreds_; - - /// computeRemainder - Compute the dupli liveness as the complement of all the - /// new intervals. - void computeRemainder(); - - /// rewrite - Rewrite all uses of reg to use the new registers. - void rewrite(unsigned reg); + /// rewriteComponents - Rewrite all uses of Intv[0] according to the eq + /// classes in ConEQ. + /// This must be done when Intvs[0] is styill live at all uses, before calling + /// ConEq.Distribute(). + void rewriteComponents(const SmallVectorImpl &Intvs, + const ConnectedVNInfoEqClasses &ConEq); public: /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. @@ -374,6 +380,9 @@ /// remaining live range, and rewrite instructions to use the new registers. void finish(); + /// dump - print the current interval maping to dbgs(). + void dump() const; + // ===--- High level methods ---=== /// splitAroundLoop - Split CurLI into a separate live interval inside From geek4civic at gmail.com Wed Feb 2 19:22:57 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 3 Feb 2011 10:22:57 +0900 Subject: [llvm-commits] [PATCH] report_fatal_error() issue In-Reply-To: <58C3D007-6443-40B5-A2AB-F1938D0CC5AC@apple.com> References: <58C3D007-6443-40B5-A2AB-F1938D0CC5AC@apple.com> Message-ID: Dan, thank you to comment me! I met this issue with test/Others/close-stderr.ll on mingw MSYS bash shell. 2011/2/3 Dan Gohman : > If there's a real bug here, please explain it. ?Otherwise, this seems to be > some Windows quirk, so it should be conditionalized with #if accordingly. > ?In either case, please add a comment in the code. I was dubious to invoke exit() in global dtors. I have reconfirmed "exit() in global dtor" works on glibc2 linux. I have to conditionalize when we can expect it above. eg. #ifdef __MINGW32__ // Mingw is not expected to call exit() in dtor context. return; #endif if (has_error()) report_fatal_error(...); On mingw, global dtors are called as atexit handlers. (not cxa_atexit) And it seems atexit() would not be re-entrant. Anyway I thought report_fatal_error() would be futile when stderr got fault (FD == 2). ...Takumi From daniel at zuster.org Wed Feb 2 20:39:58 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 03 Feb 2011 02:39:58 -0000 Subject: [llvm-commits] [llvm] r124769 - /llvm/trunk/autoconf/configure.ac Message-ID: <20110203023958.C71E42A6C12C@llvm.org> Author: ddunbar Date: Wed Feb 2 20:39:58 2011 New Revision: 124769 URL: http://llvm.org/viewvc/llvm-project?rev=124769&view=rev Log: configure: Add checks for and writev(). Modified: llvm/trunk/autoconf/configure.ac Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=124769&r1=124768&r2=124769&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Wed Feb 2 20:39:58 2011 @@ -1328,7 +1328,7 @@ AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h]) AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h]) AC_CHECK_HEADERS([utime.h windows.h]) -AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h]) +AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h]) AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h]) AC_CHECK_HEADERS([valgrind/valgrind.h]) AC_CHECK_HEADERS([fenv.h]) @@ -1393,7 +1393,7 @@ AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) -AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) +AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) AC_C_PRINTF_A AC_FUNC_RAND48 From daniel at zuster.org Wed Feb 2 20:40:02 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 03 Feb 2011 02:40:02 -0000 Subject: [llvm-commits] [llvm] r124770 - in /llvm/trunk: configure include/llvm/Config/config.h.in Message-ID: <20110203024002.9C9B52A6C12D@llvm.org> Author: ddunbar Date: Wed Feb 2 20:40:02 2011 New Revision: 124770 URL: http://llvm.org/viewvc/llvm-project?rev=124770&view=rev Log: Regenerate configure. Modified: llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=124770&r1=124769&r2=124770&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Wed Feb 2 20:40:02 2011 @@ -16262,7 +16262,8 @@ -for ac_header in sys/mman.h sys/param.h sys/resource.h sys/time.h + +for ac_header in sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -18905,7 +18906,8 @@ -for ac_func in setjmp longjmp sigsetjmp siglongjmp + +for ac_func in setjmp longjmp sigsetjmp siglongjmp writev do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=124770&r1=124769&r2=124770&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Wed Feb 2 20:40:02 2011 @@ -440,6 +440,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H @@ -467,6 +470,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H +/* Define to 1 if you have the `writev' function. */ +#undef HAVE_WRITEV + /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY From daniel at zuster.org Wed Feb 2 21:32:32 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 03 Feb 2011 03:32:32 -0000 Subject: [llvm-commits] [llvm] r124771 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <20110203033232.95F772A6C12C@llvm.org> Author: ddunbar Date: Wed Feb 2 21:32:32 2011 New Revision: 124771 URL: http://llvm.org/viewvc/llvm-project?rev=124771&view=rev Log: raw_fd_ostream: Add a SetUseAtomicWrites() method (uses writev). Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=124771&r1=124770&r2=124771&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Feb 2 21:32:32 2011 @@ -301,6 +301,10 @@ /// bool Error; + /// Controls whether the stream should attempt to use atomic writes, when + /// possible. + bool UseAtomicWrites; + uint64_t pos; /// write_impl - See raw_ostream::write_impl. @@ -361,6 +365,16 @@ /// position to the offset specified from the beginning of the file. uint64_t seek(uint64_t off); + /// SetUseAtomicWrite - Set the stream to attempt to use atomic writes for + /// individual output routines where possible. + /// + /// Note that because raw_ostream's are typically buffered, this flag is only + /// sensible when used on unbuffered streams which will flush their output + /// immediately. + void SetUseAtomicWrites(bool Value) { + UseAtomicWrites = Value; + } + virtual raw_ostream &changeColor(enum Colors colors, bool bold=false, bool bg=false); virtual raw_ostream &resetColor(); Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=124771&r1=124770&r2=124771&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Feb 2 21:32:32 2011 @@ -32,6 +32,9 @@ #if defined(HAVE_FCNTL_H) # include #endif +#if defined(HAVE_SYS_UIO_H) && defined(HAVE_WRITEV) +# include +#endif #if defined(__CYGWIN__) #include @@ -375,7 +378,9 @@ /// stream should be immediately destroyed; the string will be empty /// if no error occurred. raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo, - unsigned Flags) : Error(false), pos(0) { + unsigned Flags) + : Error(false), UseAtomicWrites(false), pos(0) +{ assert(Filename != 0 && "Filename is null"); // Verify that we don't have both "append" and "excl". assert((!(Flags & F_Excl) || !(Flags & F_Append)) && @@ -426,7 +431,7 @@ /// ShouldClose is true, this closes the file when the stream is destroyed. raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered) : raw_ostream(unbuffered), FD(fd), - ShouldClose(shouldClose), Error(false) { + ShouldClose(shouldClose), Error(false), UseAtomicWrites(false) { #ifdef O_BINARY // Setting STDOUT and STDERR to binary mode is necessary in Win32 // to avoid undesirable linefeed conversion. @@ -467,7 +472,20 @@ pos += Size; do { - ssize_t ret = ::write(FD, Ptr, Size); + ssize_t ret; + + // Check whether we should attempt to use atomic writes. + if (BUILTIN_EXPECT(!UseAtomicWrites, true)) { + ret = ::write(FD, Ptr, Size); + } else { + // Use ::writev() where available. +#if defined(HAVE_WRITEV) + struct iovec IOV = { (void*) Ptr, Size }; + ret = ::writev(FD, &IOV, 1); +#else + ret = ::write(FD, Ptr, Size); +#endif + } if (ret < 0) { // If it's a recoverable error, swallow it and retry the write. From rafael.espindola at gmail.com Wed Feb 2 21:58:05 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 03 Feb 2011 03:58:05 -0000 Subject: [llvm-commits] [llvm] r124773 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/pr9127.ll Message-ID: <20110203035805.5CEFF2A6C12C@llvm.org> Author: rafael Date: Wed Feb 2 21:58:05 2011 New Revision: 124773 URL: http://llvm.org/viewvc/llvm-project?rev=124773&view=rev Log: Fix PR9127 by reversing the operands even if they have more then one use. Reversing the operands allows us to fold, but doesn't force us to. Also, at this point the DAG is still being optimized, so the check for hasOneUse is not very precise. Added: llvm/trunk/test/CodeGen/X86/pr9127.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124773&r1=124772&r2=124773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 2 21:58:05 2011 @@ -2712,8 +2712,8 @@ // First determine if it is required or is profitable to flip the operands. // If LHS is a foldable load, but RHS is not, flip the condition. - if ((ISD::isNON_EXTLoad(LHS.getNode()) && LHS.hasOneUse()) && - !(ISD::isNON_EXTLoad(RHS.getNode()) && RHS.hasOneUse())) { + if (ISD::isNON_EXTLoad(LHS.getNode()) && + !ISD::isNON_EXTLoad(RHS.getNode())) { SetCCOpcode = getSetCCSwappedOperands(SetCCOpcode); std::swap(LHS, RHS); } Added: llvm/trunk/test/CodeGen/X86/pr9127.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr9127.ll?rev=124773&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr9127.ll (added) +++ llvm/trunk/test/CodeGen/X86/pr9127.ll Wed Feb 2 21:58:05 2011 @@ -0,0 +1,12 @@ +; RUN: llc < %s | FileCheck %s + +define i8 @foobar(double %d, double* %x) { +entry: + %tmp2 = load double* %x, align 8 + %cmp = fcmp oeq double %tmp2, %d + %conv3 = zext i1 %cmp to i8 + ret i8 %conv3 +} + +; test that the load is folded. +; CHECK: ucomisd (%rdi), %xmm0 From rafael.espindola at gmail.com Wed Feb 2 22:21:01 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 03 Feb 2011 04:21:01 -0000 Subject: [llvm-commits] [llvm] r124774 - /llvm/trunk/test/CodeGen/X86/pr9127.ll Message-ID: <20110203042101.C739D2A6C12C@llvm.org> Author: rafael Date: Wed Feb 2 22:21:01 2011 New Revision: 124774 URL: http://llvm.org/viewvc/llvm-project?rev=124774&view=rev Log: Add -march to fix the bots. Modified: llvm/trunk/test/CodeGen/X86/pr9127.ll Modified: llvm/trunk/test/CodeGen/X86/pr9127.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr9127.ll?rev=124774&r1=124773&r2=124774&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr9127.ll (original) +++ llvm/trunk/test/CodeGen/X86/pr9127.ll Wed Feb 2 22:21:01 2011 @@ -1,4 +1,4 @@ -; RUN: llc < %s | FileCheck %s +; RUN: llc -march=x86-64 < %s | FileCheck %s define i8 @foobar(double %d, double* %x) { entry: From ofv at wanadoo.es Wed Feb 2 22:23:07 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 03 Feb 2011 04:23:07 -0000 Subject: [llvm-commits] [llvm] r124775 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake Message-ID: <20110203042307.56D2C2A6C12C@llvm.org> Author: ofv Date: Wed Feb 2 22:23:07 2011 New Revision: 124775 URL: http://llvm.org/viewvc/llvm-project?rev=124775&view=rev Log: Platform tests for `sys/uio.h' header and `writev' function. This is the cmake equivalent for r124769. Modified: llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/Config/config.h.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=124775&r1=124774&r2=124775&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Wed Feb 2 22:23:07 2011 @@ -66,6 +66,7 @@ check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(sys/uio.h HAVE_SYS_UIO_H) check_include_file(sys/wait.h HAVE_SYS_WAIT_H) check_include_file(termios.h HAVE_TERMIOS_H) check_include_file(unistd.h HAVE_UNISTD_H) @@ -104,6 +105,9 @@ check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP) check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) endif() +if( HAVE_SYS_UIO_H ) + check_symbol_exists(writev sys/uio.h HAVE_WRITEV) +endif() check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=124775&r1=124774&r2=124775&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Wed Feb 2 22:23:07 2011 @@ -442,6 +442,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UIO_H ${HAVE_SYS_UIO_H} + /* Define to 1 if you have that is POSIX.1 compatible. */ #cmakedefine HAVE_SYS_WAIT_H ${HAVE_SYS_WAIT_H} @@ -463,6 +466,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_WINDOWS_H ${HAVE_WINDOWS_H} +/* Define to 1 if you have the `writev' function. */ +#cmakedefine HAVE_WRITEV ${HAVE_WRITEV} + /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY From echristo at apple.com Wed Feb 2 23:40:54 2011 From: echristo at apple.com (Eric Christopher) Date: Thu, 03 Feb 2011 05:40:54 -0000 Subject: [llvm-commits] [llvm] r124778 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveRangeEdit.h lib/CodeGen/RegAllocGreedy.cpp lib/CodeGen/SplitKit.cpp lib/CodeGen/SplitKit.h Message-ID: <20110203054054.F046A2A6C12C@llvm.org> Author: echristo Date: Wed Feb 2 23:40:54 2011 New Revision: 124778 URL: http://llvm.org/viewvc/llvm-project?rev=124778&view=rev Log: Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/lib/CodeGen/LiveRangeEdit.h llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=124778&r1=124777&r2=124778&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 2 23:40:54 2011 @@ -560,7 +560,7 @@ /// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// the equivalence class assigned the VNI. - unsigned getEqClass(const VNInfo *VNI) const { return eqClass_[VNI->id]; } + unsigned getEqClass(const VNInfo *VNI) { return eqClass_[VNI->id]; } /// Distribute - Distribute values in LIV[0] into a separate LiveInterval /// for each connected component. LIV must have a LiveInterval for each Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.h?rev=124778&r1=124777&r2=124778&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveRangeEdit.h (original) +++ llvm/trunk/lib/CodeGen/LiveRangeEdit.h Wed Feb 2 23:40:54 2011 @@ -78,7 +78,6 @@ iterator begin() const { return newRegs_.begin()+firstNew_; } iterator end() const { return newRegs_.end(); } unsigned size() const { return newRegs_.size()-firstNew_; } - bool empty() const { return size() == 0; } LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; } /// create - Create a new register with the same class and stack slot as Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124778&r1=124777&r2=124778&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Wed Feb 2 23:40:54 2011 @@ -645,6 +645,9 @@ LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); SplitEditor SE(*SA, *LIS, *VRM, *DomTree, LREdit); + // Ranges to add to the register interval after all defs are in place. + SmallVector UseRanges; + // Create the main cross-block interval. SE.openIntv(); @@ -681,7 +684,7 @@ if (!BI.LiveThrough) { DEBUG(dbgs() << ", not live-through.\n"); SE.enterIntvBefore(BI.Def); - SE.useIntv(BI.Def, Stop); + UseRanges.push_back(IndexPair(BI.Def, Stop)); continue; } if (!RegIn) { @@ -689,7 +692,7 @@ // Reload just before the first use. DEBUG(dbgs() << ", not live-in, enter before first use.\n"); SE.enterIntvBefore(BI.FirstUse); - SE.useIntv(BI.FirstUse, Stop); + UseRanges.push_back(IndexPair(BI.FirstUse, Stop)); continue; } DEBUG(dbgs() << ", live-through.\n"); @@ -714,7 +717,7 @@ DEBUG(dbgs() << ", free use at " << Use << ".\n"); assert(Use <= BI.LastUse && "Couldn't find last use"); SE.enterIntvBefore(Use); - SE.useIntv(Use, Stop); + UseRanges.push_back(IndexPair(Use, Stop)); continue; } @@ -723,6 +726,12 @@ SE.enterIntvAtEnd(*BI.MBB); } + // Add the live-out ranges following the defs. + // We must wait until all defs have been inserted, otherwise SplitKit gets + // confused about the value mapping. + for (unsigned i = 0, e = UseRanges.size(); i != e; ++i) + SE.useIntv(UseRanges[i].first, UseRanges[i].second); + // Now all defs leading to live bundles are handled, do everything else. for (unsigned i = 0, e = LiveBlocks.size(); i != e; ++i) { BlockInfo &BI = LiveBlocks[i]; Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124778&r1=124777&r2=124778&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Wed Feb 2 23:40:54 2011 @@ -449,6 +449,7 @@ // VNInfo. Insert phi-def VNInfos along the path back to IdxMBB. DEBUG(dbgs() << "\n Reaching defs for BB#" << IdxMBB->getNumber() << " at " << Idx << " in " << *LI << '\n'); + DEBUG(dumpCache()); // Blocks where LI should be live-in. SmallVector LiveIn; @@ -586,6 +587,7 @@ assert(IdxVNI && "Didn't find value for Idx"); #ifndef NDEBUG + DEBUG(dumpCache()); // Check the LiveOutCache invariants. for (LiveOutMap::iterator I = LiveOutCache.begin(), E = LiveOutCache.end(); I != E; ++I) { @@ -727,86 +729,69 @@ LiveRangeEdit &edit) : sa_(sa), LIS(lis), VRM(vrm), MRI(vrm.getMachineFunction().getRegInfo()), - MDT(mdt), TII(*vrm.getMachineFunction().getTarget().getInstrInfo()), TRI(*vrm.getMachineFunction().getTarget().getRegisterInfo()), Edit(edit), - OpenIdx(0), - RegAssign(Allocator) + DupLI(LIS, mdt, edit.getParent()), + OpenLI(LIS, mdt, edit.getParent()) { // We don't need an AliasAnalysis since we will only be performing // cheap-as-a-copy remats anyway. Edit.anyRematerializable(LIS, TII, 0); } -void SplitEditor::dump() const { - if (RegAssign.empty()) { - dbgs() << " empty\n"; - return; - } - - for (RegAssignMap::const_iterator I = RegAssign.begin(); I.valid(); ++I) - dbgs() << " [" << I.start() << ';' << I.stop() << "):" << I.value(); - dbgs() << '\n'; +bool SplitEditor::intervalsLiveAt(SlotIndex Idx) const { + for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) + if (*I != DupLI.getLI() && (*I)->liveAt(Idx)) + return true; + return false; } -VNInfo *SplitEditor::defFromParent(unsigned RegIdx, +VNInfo *SplitEditor::defFromParent(LiveIntervalMap &Reg, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) { + VNInfo *VNI = 0; MachineInstr *CopyMI = 0; SlotIndex Def; - LiveInterval *LI = Edit.get(RegIdx); // Attempt cheap-as-a-copy rematerialization. LiveRangeEdit::Remat RM(ParentVNI); if (Edit.canRematerializeAt(RM, UseIdx, true, LIS)) { - Def = Edit.rematerializeAt(MBB, I, LI->reg, RM, LIS, TII, TRI); + Def = Edit.rematerializeAt(MBB, I, Reg.getLI()->reg, RM, + LIS, TII, TRI); } else { // Can't remat, just insert a copy from parent. - CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), LI->reg) - .addReg(Edit.getReg()); + CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), + Reg.getLI()->reg).addReg(Edit.getReg()); Def = LIS.InsertMachineInstrInMaps(CopyMI).getDefIndex(); } // Define the value in Reg. - VNInfo *VNI = LIMappers[RegIdx].defValue(ParentVNI, Def); + VNI = Reg.defValue(ParentVNI, Def); VNI->setCopy(CopyMI); // Add minimal liveness for the new value. - Edit.get(RegIdx)->addRange(LiveRange(Def, Def.getNextSlot(), VNI)); - - if (RegIdx) { - if (UseIdx < Def) - UseIdx = Def; - RegAssign.insert(Def, UseIdx.getNextSlot(), RegIdx); - } + if (UseIdx < Def) + UseIdx = Def; + Reg.getLI()->addRange(LiveRange(Def, UseIdx.getNextSlot(), VNI)); return VNI; } /// Create a new virtual register and live interval. void SplitEditor::openIntv() { - assert(!OpenIdx && "Previous LI not closed before openIntv"); + assert(!OpenLI.getLI() && "Previous LI not closed before openIntv"); + if (!DupLI.getLI()) + DupLI.reset(&Edit.create(MRI, LIS, VRM)); - // Create the complement as index 0. - if (Edit.empty()) { - Edit.create(MRI, LIS, VRM); - LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); - LIMappers.back().reset(Edit.get(0)); - } - - // Create the open interval. - OpenIdx = Edit.size(); - Edit.create(MRI, LIS, VRM); - LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); - LIMappers[OpenIdx].reset(Edit.get(OpenIdx)); + OpenLI.reset(&Edit.create(MRI, LIS, VRM)); } /// enterIntvBefore - Enter OpenLI before the instruction at Idx. If CurLI is /// not live before Idx, a COPY is not inserted. void SplitEditor::enterIntvBefore(SlotIndex Idx) { - assert(OpenIdx && "openIntv not called before enterIntvBefore"); + assert(OpenLI.getLI() && "openIntv not called before enterIntvBefore"); Idx = Idx.getUseIndex(); DEBUG(dbgs() << " enterIntvBefore " << Idx); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); @@ -815,16 +800,18 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); + truncatedValues.insert(ParentVNI); MachineInstr *MI = LIS.getInstructionFromIndex(Idx); assert(MI && "enterIntvBefore called with invalid index"); - defFromParent(OpenIdx, ParentVNI, Idx, *MI->getParent(), MI); - DEBUG(dump()); + defFromParent(OpenLI, ParentVNI, Idx, *MI->getParent(), MI); + + DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); } /// enterIntvAtEnd - Enter OpenLI at the end of MBB. void SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) { - assert(OpenIdx && "openIntv not called before enterIntvAtEnd"); + assert(OpenLI.getLI() && "openIntv not called before enterIntvAtEnd"); SlotIndex End = LIS.getMBBEndIdx(&MBB).getPrevSlot(); DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << End); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(End); @@ -833,8 +820,9 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - defFromParent(OpenIdx, ParentVNI, End, MBB, MBB.getFirstTerminator()); - DEBUG(dump()); + truncatedValues.insert(ParentVNI); + defFromParent(OpenLI, ParentVNI, End, MBB, MBB.getFirstTerminator()); + DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); } /// useIntv - indicate that all instructions in MBB should use OpenLI. @@ -843,15 +831,15 @@ } void SplitEditor::useIntv(SlotIndex Start, SlotIndex End) { - assert(OpenIdx && "openIntv not called before useIntv"); - DEBUG(dbgs() << " useIntv [" << Start << ';' << End << "):"); - RegAssign.insert(Start, End, OpenIdx); - DEBUG(dump()); + assert(OpenLI.getLI() && "openIntv not called before useIntv"); + OpenLI.addRange(Start, End); + DEBUG(dbgs() << " use [" << Start << ';' << End << "): " + << *OpenLI.getLI() << '\n'); } /// leaveIntvAfter - Leave OpenLI after the instruction at Idx. void SplitEditor::leaveIntvAfter(SlotIndex Idx) { - assert(OpenIdx && "openIntv not called before leaveIntvAfter"); + assert(OpenLI.getLI() && "openIntv not called before leaveIntvAfter"); DEBUG(dbgs() << " leaveIntvAfter " << Idx); // The interval must be live beyond the instruction at Idx. @@ -864,17 +852,20 @@ DEBUG(dbgs() << ": valno " << ParentVNI->id); MachineBasicBlock::iterator MII = LIS.getInstructionFromIndex(Idx); - VNInfo *VNI = defFromParent(0, ParentVNI, Idx, + VNInfo *VNI = defFromParent(DupLI, ParentVNI, Idx, *MII->getParent(), llvm::next(MII)); - RegAssign.insert(Idx, VNI->def, OpenIdx); - DEBUG(dump()); + // Make sure that OpenLI is properly extended from Idx to the new copy. + // FIXME: This shouldn't be necessary for remats. + OpenLI.addSimpleRange(Idx, VNI->def, ParentVNI); + + DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); } /// leaveIntvAtTop - Leave the interval at the top of MBB. /// Currently, only one value can leave the interval. void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { - assert(OpenIdx && "openIntv not called before leaveIntvAtTop"); + assert(OpenLI.getLI() && "openIntv not called before leaveIntvAtTop"); SlotIndex Start = LIS.getMBBStartIdx(&MBB); DEBUG(dbgs() << " leaveIntvAtTop BB#" << MBB.getNumber() << ", " << Start); @@ -884,130 +875,179 @@ return; } - VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB, + VNInfo *VNI = defFromParent(DupLI, ParentVNI, Start, MBB, MBB.SkipPHIsAndLabels(MBB.begin())); - RegAssign.insert(Start, VNI->def, OpenIdx); - DEBUG(dump()); + + // Finally we must make sure that OpenLI is properly extended from Start to + // the new copy. + OpenLI.addSimpleRange(Start, VNI->def, ParentVNI); + DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); } /// closeIntv - Indicate that we are done editing the currently open /// LiveInterval, and ranges can be trimmed. void SplitEditor::closeIntv() { - assert(OpenIdx && "openIntv not called before closeIntv"); - OpenIdx = 0; + assert(OpenLI.getLI() && "openIntv not called before closeIntv"); + DEBUG(dbgs() << " closeIntv " << *OpenLI.getLI() << '\n'); + OpenLI.reset(0); } -/// rewriteAssigned - Rewrite all uses of Edit.getReg(). -void SplitEditor::rewriteAssigned() { - for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Edit.getReg()), +/// rewrite - Rewrite all uses of reg to use the new registers. +void SplitEditor::rewrite(unsigned reg) { + for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(reg), RE = MRI.reg_end(); RI != RE;) { MachineOperand &MO = RI.getOperand(); + unsigned OpNum = RI.getOperandNo(); MachineInstr *MI = MO.getParent(); ++RI; - // LiveDebugVariables should have handled all DBG_VALUE instructions. if (MI->isDebugValue()) { DEBUG(dbgs() << "Zapping " << *MI); + // FIXME: We can do much better with debug values. MO.setReg(0); continue; } SlotIndex Idx = LIS.getInstructionIndex(MI); Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); - - // Rewrite to the mapped register at Idx. - unsigned RegIdx = RegAssign.lookup(Idx); - MO.setReg(Edit.get(RegIdx)->reg); - DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' - << Idx << ':' << RegIdx << '\t' << *MI); - - // Extend liveness to Idx. - const VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); - LIMappers[RegIdx].mapValue(ParentVNI, Idx); + LiveInterval *LI = 0; + for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; + ++I) { + LiveInterval *testli = *I; + if (testli->liveAt(Idx)) { + LI = testli; + break; + } + } + DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t'<< Idx); + assert(LI && "No register was live at use"); + MO.setReg(LI->reg); + if (MO.isUse() && !MI->isRegTiedToDefOperand(OpNum)) + MO.setIsKill(LI->killedAt(Idx.getDefIndex())); + DEBUG(dbgs() << '\t' << *MI); } } -/// rewriteSplit - Rewrite uses of Intvs[0] according to the ConEQ mapping. -void SplitEditor::rewriteComponents(const SmallVectorImpl &Intvs, - const ConnectedVNInfoEqClasses &ConEq) { - for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Intvs[0]->reg), - RE = MRI.reg_end(); RI != RE;) { - MachineOperand &MO = RI.getOperand(); - MachineInstr *MI = MO.getParent(); - ++RI; - if (MO.isUse() && MO.isUndef()) +void +SplitEditor::addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI) { + // Build vector of iterator pairs from the intervals. + typedef std::pair IIPair; + SmallVector Iters; + for (LiveRangeEdit::iterator LI = Edit.begin(), LE = Edit.end(); LI != LE; + ++LI) { + if (*LI == DupLI.getLI()) continue; - // DBG_VALUE instructions should have been eliminated earlier. - SlotIndex Idx = LIS.getInstructionIndex(MI); - Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); - DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' - << Idx << ':'); - const VNInfo *VNI = Intvs[0]->getVNInfoAt(Idx); - assert(VNI && "Interval not live at use."); - MO.setReg(Intvs[ConEq.getEqClass(VNI)]->reg); - DEBUG(dbgs() << VNI->id << '\t' << *MI); + LiveInterval::const_iterator I = (*LI)->find(Start); + LiveInterval::const_iterator E = (*LI)->end(); + if (I != E) + Iters.push_back(std::make_pair(I, E)); + } + + SlotIndex sidx = Start; + // Break [Start;End) into segments that don't overlap any intervals. + for (;;) { + SlotIndex next = sidx, eidx = End; + // Find overlapping intervals. + for (unsigned i = 0; i != Iters.size() && sidx < eidx; ++i) { + LiveInterval::const_iterator I = Iters[i].first; + // Interval I is overlapping [sidx;eidx). Trim sidx. + if (I->start <= sidx) { + sidx = I->end; + // Move to the next run, remove iters when all are consumed. + I = ++Iters[i].first; + if (I == Iters[i].second) { + Iters.erase(Iters.begin() + i); + --i; + continue; + } + } + // Trim eidx too if needed. + if (I->start >= eidx) + continue; + eidx = I->start; + next = I->end; + } + // Now, [sidx;eidx) doesn't overlap anything in intervals_. + if (sidx < eidx) + DupLI.addSimpleRange(sidx, eidx, VNI); + // If the interval end was truncated, we can try again from next. + if (next <= sidx) + break; + sidx = next; } } -void SplitEditor::finish() { - assert(OpenIdx == 0 && "Previous LI not closed before rewrite"); - - // At this point, the live intervals in Edit contain VNInfos corresponding to - // the inserted copies. - - // Add the original defs from the parent interval. - for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), - E = Edit.getParent().vni_end(); I != E; ++I) { - const VNInfo *ParentVNI = *I; - LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(ParentVNI->def)]; - VNInfo *VNI = LIM.defValue(ParentVNI, ParentVNI->def); - LIM.getLI()->addRange(LiveRange(ParentVNI->def, - ParentVNI->def.getNextSlot(), VNI)); - // Mark all values as complex to force liveness computation. - // This should really only be necessary for remat victims, but we are lazy. - LIM.markComplexMapped(ParentVNI); +void SplitEditor::computeRemainder() { + // First we need to fill in the live ranges in dupli. + // If values were redefined, we need a full recoloring with SSA update. + // If values were truncated, we only need to truncate the ranges. + // If values were partially rematted, we should shrink to uses. + // If values were fully rematted, they should be omitted. + // FIXME: If a single value is redefined, just move the def and truncate. + LiveInterval &parent = Edit.getParent(); + + DEBUG(dbgs() << "computeRemainder from " << parent << '\n'); + + // Values that are fully contained in the split intervals. + SmallPtrSet deadValues; + // Map all CurLI values that should have live defs in dupli. + for (LiveInterval::const_vni_iterator I = parent.vni_begin(), + E = parent.vni_end(); I != E; ++I) { + const VNInfo *VNI = *I; + // Don't transfer unused values to the new intervals. + if (VNI->isUnused()) + continue; + // Original def is contained in the split intervals. + if (intervalsLiveAt(VNI->def)) { + // Did this value escape? + if (DupLI.isMapped(VNI)) + truncatedValues.insert(VNI); + else + deadValues.insert(VNI); + continue; + } + // Add minimal live range at the definition. + VNInfo *DVNI = DupLI.defValue(VNI, VNI->def); + DupLI.getLI()->addRange(LiveRange(VNI->def, VNI->def.getNextSlot(), DVNI)); } -#ifndef NDEBUG - // Every new interval must have a def by now, otherwise the split is bogus. - for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) - assert((*I)->hasAtLeastOneValue() && "Split interval has no value"); -#endif - - // FIXME: Don't recompute the liveness of all values, infer it from the - // overlaps between the parent live interval and RegAssign. - // The mapValue algorithm is only necessary when: - // - The parent value maps to multiple defs, and new phis are needed, or - // - The value has been rematerialized before some uses, and we want to - // minimize the live range so it only reaches the remaining uses. - // All other values have simple liveness that can be computed from RegAssign - // and the parent live interval. - - // Extend live ranges to be live-out for successor PHI values. - for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), - E = Edit.getParent().vni_end(); I != E; ++I) { - const VNInfo *PHIVNI = *I; - if (!PHIVNI->isPHIDef()) - continue; - LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(PHIVNI->def)]; - MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); - for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), - PE = MBB->pred_end(); PI != PE; ++PI) { - SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); - // The predecessor may not have a live-out value. That is OK, like an - // undef PHI operand. - if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) - LIM.mapValue(VNI, End); + // Add all ranges to dupli. + for (LiveInterval::const_iterator I = parent.begin(), E = parent.end(); + I != E; ++I) { + const LiveRange &LR = *I; + if (truncatedValues.count(LR.valno)) { + // recolor after removing intervals_. + addTruncSimpleRange(LR.start, LR.end, LR.valno); + } else if (!deadValues.count(LR.valno)) { + // recolor without truncation. + DupLI.addSimpleRange(LR.start, LR.end, LR.valno); } } - // Rewrite instructions. - rewriteAssigned(); + // Extend DupLI to be live out of any critical loop predecessors. + // This means we have multiple registers live out of those blocks. + // The alternative would be to split the critical edges. + if (criticalPreds_.empty()) + return; + for (SplitAnalysis::BlockPtrSet::iterator I = criticalPreds_.begin(), + E = criticalPreds_.end(); I != E; ++I) + DupLI.extendTo(*I, LIS.getMBBEndIdx(*I).getPrevSlot()); + criticalPreds_.clear(); +} - // FIXME: Delete defs that were rematted everywhere. +void SplitEditor::finish() { + assert(!OpenLI.getLI() && "Previous LI not closed before rewrite"); + assert(DupLI.getLI() && "No dupli for rewrite. Noop spilt?"); + + // Complete dupli liveness. + computeRemainder(); // Get rid of unused values and set phi-kill flags. for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) (*I)->RenumberValues(LIS); + // Rewrite instructions. + rewrite(Edit.getReg()); + // Now check if any registers were separated into multiple components. ConnectedVNInfoEqClasses ConEQ(LIS); for (unsigned i = 0, e = Edit.size(); i != e; ++i) { @@ -1021,8 +1061,9 @@ dups.push_back(li); for (unsigned i = 1; i != NumComp; ++i) dups.push_back(&Edit.create(MRI, LIS, VRM)); - rewriteComponents(dups, ConEQ); ConEQ.Distribute(&dups[0]); + // Rewrite uses to the new regs. + rewrite(li->reg); } // Calculate spill weight and allocation hints for new intervals. @@ -1054,6 +1095,9 @@ sa_.getCriticalExits(Blocks, CriticalExits); assert(CriticalExits.empty() && "Cannot break critical exits yet"); + // Get critical predecessors so computeRemainder can deal with them. + sa_.getCriticalPreds(Blocks, criticalPreds_); + // Create new live interval for the loop. openIntv(); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=124778&r1=124777&r2=124778&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Wed Feb 2 23:40:54 2011 @@ -13,13 +13,11 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/SlotIndexes.h" namespace llvm { -class ConnectedVNInfoEqClasses; class LiveInterval; class LiveIntervals; class LiveRangeEdit; @@ -265,10 +263,6 @@ /// with defValue. bool isComplexMapped(const VNInfo *ParentVNI) const; - /// markComplexMapped - Mark ParentVNI as complex mapped regardless of the - /// number of definitions. - void markComplexMapped(const VNInfo *ParentVNI) { Values[ParentVNI] = 0; } - // addSimpleRange - Add a simple range from ParentLI to LI. // ParentVNI must be live in the [Start;End) interval. void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI); @@ -296,49 +290,49 @@ LiveIntervals &LIS; VirtRegMap &VRM; MachineRegisterInfo &MRI; - MachineDominatorTree &MDT; const TargetInstrInfo &TII; const TargetRegisterInfo &TRI; /// Edit - The current parent register and new intervals created. LiveRangeEdit &Edit; - /// Index into Edit of the currently open interval. - /// The index 0 is used for the complement, so the first interval started by - /// openIntv will be 1. - unsigned OpenIdx; - - typedef IntervalMap RegAssignMap; - - /// Allocator for the interval map. This will eventually be shared with - /// SlotIndexes and LiveIntervals. - RegAssignMap::Allocator Allocator; - - /// RegAssign - Map of the assigned register indexes. - /// Edit.get(RegAssign.lookup(Idx)) is the register that should be live at - /// Idx. - RegAssignMap RegAssign; + /// DupLI - Created as a copy of CurLI, ranges are carved out as new + /// intervals get added through openIntv / closeIntv. This is used to avoid + /// editing CurLI. + LiveIntervalMap DupLI; - /// LIMappers - One LiveIntervalMap or each interval in Edit. - SmallVector LIMappers; + /// Currently open LiveInterval. + LiveIntervalMap OpenLI; /// defFromParent - Define Reg from ParentVNI at UseIdx using either /// rematerialization or a COPY from parent. Return the new value. - VNInfo *defFromParent(unsigned RegIdx, + VNInfo *defFromParent(LiveIntervalMap &Reg, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I); - /// rewriteAssigned - Rewrite all uses of Edit.getReg() to assigned registers. - void rewriteAssigned(); + /// intervalsLiveAt - Return true if any member of intervals_ is live at Idx. + bool intervalsLiveAt(SlotIndex Idx) const; - /// rewriteComponents - Rewrite all uses of Intv[0] according to the eq - /// classes in ConEQ. - /// This must be done when Intvs[0] is styill live at all uses, before calling - /// ConEq.Distribute(). - void rewriteComponents(const SmallVectorImpl &Intvs, - const ConnectedVNInfoEqClasses &ConEq); + /// Values in CurLI whose live range has been truncated when entering an open + /// li. + SmallPtrSet truncatedValues; + + /// addTruncSimpleRange - Add the given simple range to DupLI after + /// truncating any overlap with intervals_. + void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI); + + /// criticalPreds_ - Set of basic blocks where both dupli and OpenLI should be + /// live out because of a critical edge. + SplitAnalysis::BlockPtrSet criticalPreds_; + + /// computeRemainder - Compute the dupli liveness as the complement of all the + /// new intervals. + void computeRemainder(); + + /// rewrite - Rewrite all uses of reg to use the new registers. + void rewrite(unsigned reg); public: /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. @@ -380,9 +374,6 @@ /// remaining live range, and rewrite instructions to use the new registers. void finish(); - /// dump - print the current interval maping to dbgs(). - void dump() const; - // ===--- High level methods ---=== /// splitAroundLoop - Split CurLI into a separate live interval inside From echristo at apple.com Thu Feb 3 00:18:29 2011 From: echristo at apple.com (Eric Christopher) Date: Thu, 03 Feb 2011 06:18:29 -0000 Subject: [llvm-commits] [llvm] r124779 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveRangeEdit.h lib/CodeGen/RegAllocGreedy.cpp lib/CodeGen/SplitKit.cpp lib/CodeGen/SplitKit.h Message-ID: <20110203061829.BFD0E2A6C12C@llvm.org> Author: echristo Date: Thu Feb 3 00:18:29 2011 New Revision: 124779 URL: http://llvm.org/viewvc/llvm-project?rev=124779&view=rev Log: Reapply this. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/lib/CodeGen/LiveRangeEdit.h llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=124779&r1=124778&r2=124779&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Thu Feb 3 00:18:29 2011 @@ -560,7 +560,7 @@ /// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// the equivalence class assigned the VNI. - unsigned getEqClass(const VNInfo *VNI) { return eqClass_[VNI->id]; } + unsigned getEqClass(const VNInfo *VNI) const { return eqClass_[VNI->id]; } /// Distribute - Distribute values in LIV[0] into a separate LiveInterval /// for each connected component. LIV must have a LiveInterval for each Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.h?rev=124779&r1=124778&r2=124779&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveRangeEdit.h (original) +++ llvm/trunk/lib/CodeGen/LiveRangeEdit.h Thu Feb 3 00:18:29 2011 @@ -78,6 +78,7 @@ iterator begin() const { return newRegs_.begin()+firstNew_; } iterator end() const { return newRegs_.end(); } unsigned size() const { return newRegs_.size()-firstNew_; } + bool empty() const { return size() == 0; } LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; } /// create - Create a new register with the same class and stack slot as Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124779&r1=124778&r2=124779&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 3 00:18:29 2011 @@ -645,9 +645,6 @@ LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); SplitEditor SE(*SA, *LIS, *VRM, *DomTree, LREdit); - // Ranges to add to the register interval after all defs are in place. - SmallVector UseRanges; - // Create the main cross-block interval. SE.openIntv(); @@ -684,7 +681,7 @@ if (!BI.LiveThrough) { DEBUG(dbgs() << ", not live-through.\n"); SE.enterIntvBefore(BI.Def); - UseRanges.push_back(IndexPair(BI.Def, Stop)); + SE.useIntv(BI.Def, Stop); continue; } if (!RegIn) { @@ -692,7 +689,7 @@ // Reload just before the first use. DEBUG(dbgs() << ", not live-in, enter before first use.\n"); SE.enterIntvBefore(BI.FirstUse); - UseRanges.push_back(IndexPair(BI.FirstUse, Stop)); + SE.useIntv(BI.FirstUse, Stop); continue; } DEBUG(dbgs() << ", live-through.\n"); @@ -717,7 +714,7 @@ DEBUG(dbgs() << ", free use at " << Use << ".\n"); assert(Use <= BI.LastUse && "Couldn't find last use"); SE.enterIntvBefore(Use); - UseRanges.push_back(IndexPair(Use, Stop)); + SE.useIntv(Use, Stop); continue; } @@ -726,12 +723,6 @@ SE.enterIntvAtEnd(*BI.MBB); } - // Add the live-out ranges following the defs. - // We must wait until all defs have been inserted, otherwise SplitKit gets - // confused about the value mapping. - for (unsigned i = 0, e = UseRanges.size(); i != e; ++i) - SE.useIntv(UseRanges[i].first, UseRanges[i].second); - // Now all defs leading to live bundles are handled, do everything else. for (unsigned i = 0, e = LiveBlocks.size(); i != e; ++i) { BlockInfo &BI = LiveBlocks[i]; Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124779&r1=124778&r2=124779&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb 3 00:18:29 2011 @@ -449,7 +449,6 @@ // VNInfo. Insert phi-def VNInfos along the path back to IdxMBB. DEBUG(dbgs() << "\n Reaching defs for BB#" << IdxMBB->getNumber() << " at " << Idx << " in " << *LI << '\n'); - DEBUG(dumpCache()); // Blocks where LI should be live-in. SmallVector LiveIn; @@ -587,7 +586,6 @@ assert(IdxVNI && "Didn't find value for Idx"); #ifndef NDEBUG - DEBUG(dumpCache()); // Check the LiveOutCache invariants. for (LiveOutMap::iterator I = LiveOutCache.begin(), E = LiveOutCache.end(); I != E; ++I) { @@ -729,69 +727,86 @@ LiveRangeEdit &edit) : sa_(sa), LIS(lis), VRM(vrm), MRI(vrm.getMachineFunction().getRegInfo()), + MDT(mdt), TII(*vrm.getMachineFunction().getTarget().getInstrInfo()), TRI(*vrm.getMachineFunction().getTarget().getRegisterInfo()), Edit(edit), - DupLI(LIS, mdt, edit.getParent()), - OpenLI(LIS, mdt, edit.getParent()) + OpenIdx(0), + RegAssign(Allocator) { // We don't need an AliasAnalysis since we will only be performing // cheap-as-a-copy remats anyway. Edit.anyRematerializable(LIS, TII, 0); } -bool SplitEditor::intervalsLiveAt(SlotIndex Idx) const { - for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) - if (*I != DupLI.getLI() && (*I)->liveAt(Idx)) - return true; - return false; +void SplitEditor::dump() const { + if (RegAssign.empty()) { + dbgs() << " empty\n"; + return; + } + + for (RegAssignMap::const_iterator I = RegAssign.begin(); I.valid(); ++I) + dbgs() << " [" << I.start() << ';' << I.stop() << "):" << I.value(); + dbgs() << '\n'; } -VNInfo *SplitEditor::defFromParent(LiveIntervalMap &Reg, +VNInfo *SplitEditor::defFromParent(unsigned RegIdx, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) { - VNInfo *VNI = 0; MachineInstr *CopyMI = 0; SlotIndex Def; + LiveInterval *LI = Edit.get(RegIdx); // Attempt cheap-as-a-copy rematerialization. LiveRangeEdit::Remat RM(ParentVNI); if (Edit.canRematerializeAt(RM, UseIdx, true, LIS)) { - Def = Edit.rematerializeAt(MBB, I, Reg.getLI()->reg, RM, - LIS, TII, TRI); + Def = Edit.rematerializeAt(MBB, I, LI->reg, RM, LIS, TII, TRI); } else { // Can't remat, just insert a copy from parent. - CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), - Reg.getLI()->reg).addReg(Edit.getReg()); + CopyMI = BuildMI(MBB, I, DebugLoc(), TII.get(TargetOpcode::COPY), LI->reg) + .addReg(Edit.getReg()); Def = LIS.InsertMachineInstrInMaps(CopyMI).getDefIndex(); } // Define the value in Reg. - VNI = Reg.defValue(ParentVNI, Def); + VNInfo *VNI = LIMappers[RegIdx].defValue(ParentVNI, Def); VNI->setCopy(CopyMI); // Add minimal liveness for the new value. - if (UseIdx < Def) - UseIdx = Def; - Reg.getLI()->addRange(LiveRange(Def, UseIdx.getNextSlot(), VNI)); + Edit.get(RegIdx)->addRange(LiveRange(Def, Def.getNextSlot(), VNI)); + + if (RegIdx) { + if (UseIdx < Def) + UseIdx = Def; + RegAssign.insert(Def, UseIdx.getNextSlot(), RegIdx); + } return VNI; } /// Create a new virtual register and live interval. void SplitEditor::openIntv() { - assert(!OpenLI.getLI() && "Previous LI not closed before openIntv"); - if (!DupLI.getLI()) - DupLI.reset(&Edit.create(MRI, LIS, VRM)); + assert(!OpenIdx && "Previous LI not closed before openIntv"); - OpenLI.reset(&Edit.create(MRI, LIS, VRM)); + // Create the complement as index 0. + if (Edit.empty()) { + Edit.create(MRI, LIS, VRM); + LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); + LIMappers.back().reset(Edit.get(0)); + } + + // Create the open interval. + OpenIdx = Edit.size(); + Edit.create(MRI, LIS, VRM); + LIMappers.push_back(LiveIntervalMap(LIS, MDT, Edit.getParent())); + LIMappers[OpenIdx].reset(Edit.get(OpenIdx)); } /// enterIntvBefore - Enter OpenLI before the instruction at Idx. If CurLI is /// not live before Idx, a COPY is not inserted. void SplitEditor::enterIntvBefore(SlotIndex Idx) { - assert(OpenLI.getLI() && "openIntv not called before enterIntvBefore"); + assert(OpenIdx && "openIntv not called before enterIntvBefore"); Idx = Idx.getUseIndex(); DEBUG(dbgs() << " enterIntvBefore " << Idx); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); @@ -800,18 +815,16 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - truncatedValues.insert(ParentVNI); MachineInstr *MI = LIS.getInstructionFromIndex(Idx); assert(MI && "enterIntvBefore called with invalid index"); - defFromParent(OpenLI, ParentVNI, Idx, *MI->getParent(), MI); - - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + defFromParent(OpenIdx, ParentVNI, Idx, *MI->getParent(), MI); + DEBUG(dump()); } /// enterIntvAtEnd - Enter OpenLI at the end of MBB. void SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) { - assert(OpenLI.getLI() && "openIntv not called before enterIntvAtEnd"); + assert(OpenIdx && "openIntv not called before enterIntvAtEnd"); SlotIndex End = LIS.getMBBEndIdx(&MBB).getPrevSlot(); DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << End); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(End); @@ -820,9 +833,8 @@ return; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - truncatedValues.insert(ParentVNI); - defFromParent(OpenLI, ParentVNI, End, MBB, MBB.getFirstTerminator()); - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + defFromParent(OpenIdx, ParentVNI, End, MBB, MBB.getFirstTerminator()); + DEBUG(dump()); } /// useIntv - indicate that all instructions in MBB should use OpenLI. @@ -831,15 +843,15 @@ } void SplitEditor::useIntv(SlotIndex Start, SlotIndex End) { - assert(OpenLI.getLI() && "openIntv not called before useIntv"); - OpenLI.addRange(Start, End); - DEBUG(dbgs() << " use [" << Start << ';' << End << "): " - << *OpenLI.getLI() << '\n'); + assert(OpenIdx && "openIntv not called before useIntv"); + DEBUG(dbgs() << " useIntv [" << Start << ';' << End << "):"); + RegAssign.insert(Start, End, OpenIdx); + DEBUG(dump()); } /// leaveIntvAfter - Leave OpenLI after the instruction at Idx. void SplitEditor::leaveIntvAfter(SlotIndex Idx) { - assert(OpenLI.getLI() && "openIntv not called before leaveIntvAfter"); + assert(OpenIdx && "openIntv not called before leaveIntvAfter"); DEBUG(dbgs() << " leaveIntvAfter " << Idx); // The interval must be live beyond the instruction at Idx. @@ -852,20 +864,17 @@ DEBUG(dbgs() << ": valno " << ParentVNI->id); MachineBasicBlock::iterator MII = LIS.getInstructionFromIndex(Idx); - VNInfo *VNI = defFromParent(DupLI, ParentVNI, Idx, + VNInfo *VNI = defFromParent(0, ParentVNI, Idx, *MII->getParent(), llvm::next(MII)); - // Make sure that OpenLI is properly extended from Idx to the new copy. - // FIXME: This shouldn't be necessary for remats. - OpenLI.addSimpleRange(Idx, VNI->def, ParentVNI); - - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + RegAssign.insert(Idx, VNI->def, OpenIdx); + DEBUG(dump()); } /// leaveIntvAtTop - Leave the interval at the top of MBB. /// Currently, only one value can leave the interval. void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { - assert(OpenLI.getLI() && "openIntv not called before leaveIntvAtTop"); + assert(OpenIdx && "openIntv not called before leaveIntvAtTop"); SlotIndex Start = LIS.getMBBStartIdx(&MBB); DEBUG(dbgs() << " leaveIntvAtTop BB#" << MBB.getNumber() << ", " << Start); @@ -875,179 +884,130 @@ return; } - VNInfo *VNI = defFromParent(DupLI, ParentVNI, Start, MBB, + VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB, MBB.SkipPHIsAndLabels(MBB.begin())); - - // Finally we must make sure that OpenLI is properly extended from Start to - // the new copy. - OpenLI.addSimpleRange(Start, VNI->def, ParentVNI); - DEBUG(dbgs() << ": " << *OpenLI.getLI() << '\n'); + RegAssign.insert(Start, VNI->def, OpenIdx); + DEBUG(dump()); } /// closeIntv - Indicate that we are done editing the currently open /// LiveInterval, and ranges can be trimmed. void SplitEditor::closeIntv() { - assert(OpenLI.getLI() && "openIntv not called before closeIntv"); - DEBUG(dbgs() << " closeIntv " << *OpenLI.getLI() << '\n'); - OpenLI.reset(0); + assert(OpenIdx && "openIntv not called before closeIntv"); + OpenIdx = 0; } -/// rewrite - Rewrite all uses of reg to use the new registers. -void SplitEditor::rewrite(unsigned reg) { - for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(reg), +/// rewriteAssigned - Rewrite all uses of Edit.getReg(). +void SplitEditor::rewriteAssigned() { + for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Edit.getReg()), RE = MRI.reg_end(); RI != RE;) { MachineOperand &MO = RI.getOperand(); - unsigned OpNum = RI.getOperandNo(); MachineInstr *MI = MO.getParent(); ++RI; + // LiveDebugVariables should have handled all DBG_VALUE instructions. if (MI->isDebugValue()) { DEBUG(dbgs() << "Zapping " << *MI); - // FIXME: We can do much better with debug values. MO.setReg(0); continue; } SlotIndex Idx = LIS.getInstructionIndex(MI); Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); - LiveInterval *LI = 0; - for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; - ++I) { - LiveInterval *testli = *I; - if (testli->liveAt(Idx)) { - LI = testli; - break; - } - } - DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t'<< Idx); - assert(LI && "No register was live at use"); - MO.setReg(LI->reg); - if (MO.isUse() && !MI->isRegTiedToDefOperand(OpNum)) - MO.setIsKill(LI->killedAt(Idx.getDefIndex())); - DEBUG(dbgs() << '\t' << *MI); + + // Rewrite to the mapped register at Idx. + unsigned RegIdx = RegAssign.lookup(Idx); + MO.setReg(Edit.get(RegIdx)->reg); + DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' + << Idx << ':' << RegIdx << '\t' << *MI); + + // Extend liveness to Idx. + const VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); + LIMappers[RegIdx].mapValue(ParentVNI, Idx); } } -void -SplitEditor::addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI) { - // Build vector of iterator pairs from the intervals. - typedef std::pair IIPair; - SmallVector Iters; - for (LiveRangeEdit::iterator LI = Edit.begin(), LE = Edit.end(); LI != LE; - ++LI) { - if (*LI == DupLI.getLI()) +/// rewriteSplit - Rewrite uses of Intvs[0] according to the ConEQ mapping. +void SplitEditor::rewriteComponents(const SmallVectorImpl &Intvs, + const ConnectedVNInfoEqClasses &ConEq) { + for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Intvs[0]->reg), + RE = MRI.reg_end(); RI != RE;) { + MachineOperand &MO = RI.getOperand(); + MachineInstr *MI = MO.getParent(); + ++RI; + if (MO.isUse() && MO.isUndef()) continue; - LiveInterval::const_iterator I = (*LI)->find(Start); - LiveInterval::const_iterator E = (*LI)->end(); - if (I != E) - Iters.push_back(std::make_pair(I, E)); - } - - SlotIndex sidx = Start; - // Break [Start;End) into segments that don't overlap any intervals. - for (;;) { - SlotIndex next = sidx, eidx = End; - // Find overlapping intervals. - for (unsigned i = 0; i != Iters.size() && sidx < eidx; ++i) { - LiveInterval::const_iterator I = Iters[i].first; - // Interval I is overlapping [sidx;eidx). Trim sidx. - if (I->start <= sidx) { - sidx = I->end; - // Move to the next run, remove iters when all are consumed. - I = ++Iters[i].first; - if (I == Iters[i].second) { - Iters.erase(Iters.begin() + i); - --i; - continue; - } - } - // Trim eidx too if needed. - if (I->start >= eidx) - continue; - eidx = I->start; - next = I->end; - } - // Now, [sidx;eidx) doesn't overlap anything in intervals_. - if (sidx < eidx) - DupLI.addSimpleRange(sidx, eidx, VNI); - // If the interval end was truncated, we can try again from next. - if (next <= sidx) - break; - sidx = next; + // DBG_VALUE instructions should have been eliminated earlier. + SlotIndex Idx = LIS.getInstructionIndex(MI); + Idx = MO.isUse() ? Idx.getUseIndex() : Idx.getDefIndex(); + DEBUG(dbgs() << " rewr BB#" << MI->getParent()->getNumber() << '\t' + << Idx << ':'); + const VNInfo *VNI = Intvs[0]->getVNInfoAt(Idx); + assert(VNI && "Interval not live at use."); + MO.setReg(Intvs[ConEq.getEqClass(VNI)]->reg); + DEBUG(dbgs() << VNI->id << '\t' << *MI); } } -void SplitEditor::computeRemainder() { - // First we need to fill in the live ranges in dupli. - // If values were redefined, we need a full recoloring with SSA update. - // If values were truncated, we only need to truncate the ranges. - // If values were partially rematted, we should shrink to uses. - // If values were fully rematted, they should be omitted. - // FIXME: If a single value is redefined, just move the def and truncate. - LiveInterval &parent = Edit.getParent(); - - DEBUG(dbgs() << "computeRemainder from " << parent << '\n'); - - // Values that are fully contained in the split intervals. - SmallPtrSet deadValues; - // Map all CurLI values that should have live defs in dupli. - for (LiveInterval::const_vni_iterator I = parent.vni_begin(), - E = parent.vni_end(); I != E; ++I) { - const VNInfo *VNI = *I; - // Don't transfer unused values to the new intervals. - if (VNI->isUnused()) - continue; - // Original def is contained in the split intervals. - if (intervalsLiveAt(VNI->def)) { - // Did this value escape? - if (DupLI.isMapped(VNI)) - truncatedValues.insert(VNI); - else - deadValues.insert(VNI); - continue; - } - // Add minimal live range at the definition. - VNInfo *DVNI = DupLI.defValue(VNI, VNI->def); - DupLI.getLI()->addRange(LiveRange(VNI->def, VNI->def.getNextSlot(), DVNI)); +void SplitEditor::finish() { + assert(OpenIdx == 0 && "Previous LI not closed before rewrite"); + + // At this point, the live intervals in Edit contain VNInfos corresponding to + // the inserted copies. + + // Add the original defs from the parent interval. + for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), + E = Edit.getParent().vni_end(); I != E; ++I) { + const VNInfo *ParentVNI = *I; + LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(ParentVNI->def)]; + VNInfo *VNI = LIM.defValue(ParentVNI, ParentVNI->def); + LIM.getLI()->addRange(LiveRange(ParentVNI->def, + ParentVNI->def.getNextSlot(), VNI)); + // Mark all values as complex to force liveness computation. + // This should really only be necessary for remat victims, but we are lazy. + LIM.markComplexMapped(ParentVNI); } - // Add all ranges to dupli. - for (LiveInterval::const_iterator I = parent.begin(), E = parent.end(); - I != E; ++I) { - const LiveRange &LR = *I; - if (truncatedValues.count(LR.valno)) { - // recolor after removing intervals_. - addTruncSimpleRange(LR.start, LR.end, LR.valno); - } else if (!deadValues.count(LR.valno)) { - // recolor without truncation. - DupLI.addSimpleRange(LR.start, LR.end, LR.valno); +#ifndef NDEBUG + // Every new interval must have a def by now, otherwise the split is bogus. + for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) + assert((*I)->hasAtLeastOneValue() && "Split interval has no value"); +#endif + + // FIXME: Don't recompute the liveness of all values, infer it from the + // overlaps between the parent live interval and RegAssign. + // The mapValue algorithm is only necessary when: + // - The parent value maps to multiple defs, and new phis are needed, or + // - The value has been rematerialized before some uses, and we want to + // minimize the live range so it only reaches the remaining uses. + // All other values have simple liveness that can be computed from RegAssign + // and the parent live interval. + + // Extend live ranges to be live-out for successor PHI values. + for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), + E = Edit.getParent().vni_end(); I != E; ++I) { + const VNInfo *PHIVNI = *I; + if (!PHIVNI->isPHIDef()) + continue; + LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(PHIVNI->def)]; + MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); + for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), + PE = MBB->pred_end(); PI != PE; ++PI) { + SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); + // The predecessor may not have a live-out value. That is OK, like an + // undef PHI operand. + if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) + LIM.mapValue(VNI, End); } } - // Extend DupLI to be live out of any critical loop predecessors. - // This means we have multiple registers live out of those blocks. - // The alternative would be to split the critical edges. - if (criticalPreds_.empty()) - return; - for (SplitAnalysis::BlockPtrSet::iterator I = criticalPreds_.begin(), - E = criticalPreds_.end(); I != E; ++I) - DupLI.extendTo(*I, LIS.getMBBEndIdx(*I).getPrevSlot()); - criticalPreds_.clear(); -} - -void SplitEditor::finish() { - assert(!OpenLI.getLI() && "Previous LI not closed before rewrite"); - assert(DupLI.getLI() && "No dupli for rewrite. Noop spilt?"); + // Rewrite instructions. + rewriteAssigned(); - // Complete dupli liveness. - computeRemainder(); + // FIXME: Delete defs that were rematted everywhere. // Get rid of unused values and set phi-kill flags. for (LiveRangeEdit::iterator I = Edit.begin(), E = Edit.end(); I != E; ++I) (*I)->RenumberValues(LIS); - // Rewrite instructions. - rewrite(Edit.getReg()); - // Now check if any registers were separated into multiple components. ConnectedVNInfoEqClasses ConEQ(LIS); for (unsigned i = 0, e = Edit.size(); i != e; ++i) { @@ -1061,9 +1021,8 @@ dups.push_back(li); for (unsigned i = 1; i != NumComp; ++i) dups.push_back(&Edit.create(MRI, LIS, VRM)); + rewriteComponents(dups, ConEQ); ConEQ.Distribute(&dups[0]); - // Rewrite uses to the new regs. - rewrite(li->reg); } // Calculate spill weight and allocation hints for new intervals. @@ -1095,9 +1054,6 @@ sa_.getCriticalExits(Blocks, CriticalExits); assert(CriticalExits.empty() && "Cannot break critical exits yet"); - // Get critical predecessors so computeRemainder can deal with them. - sa_.getCriticalPreds(Blocks, criticalPreds_); - // Create new live interval for the loop. openIntv(); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=124779&r1=124778&r2=124779&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Thu Feb 3 00:18:29 2011 @@ -13,11 +13,13 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/SlotIndexes.h" namespace llvm { +class ConnectedVNInfoEqClasses; class LiveInterval; class LiveIntervals; class LiveRangeEdit; @@ -263,6 +265,10 @@ /// with defValue. bool isComplexMapped(const VNInfo *ParentVNI) const; + /// markComplexMapped - Mark ParentVNI as complex mapped regardless of the + /// number of definitions. + void markComplexMapped(const VNInfo *ParentVNI) { Values[ParentVNI] = 0; } + // addSimpleRange - Add a simple range from ParentLI to LI. // ParentVNI must be live in the [Start;End) interval. void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI); @@ -290,49 +296,49 @@ LiveIntervals &LIS; VirtRegMap &VRM; MachineRegisterInfo &MRI; + MachineDominatorTree &MDT; const TargetInstrInfo &TII; const TargetRegisterInfo &TRI; /// Edit - The current parent register and new intervals created. LiveRangeEdit &Edit; - /// DupLI - Created as a copy of CurLI, ranges are carved out as new - /// intervals get added through openIntv / closeIntv. This is used to avoid - /// editing CurLI. - LiveIntervalMap DupLI; + /// Index into Edit of the currently open interval. + /// The index 0 is used for the complement, so the first interval started by + /// openIntv will be 1. + unsigned OpenIdx; + + typedef IntervalMap RegAssignMap; + + /// Allocator for the interval map. This will eventually be shared with + /// SlotIndexes and LiveIntervals. + RegAssignMap::Allocator Allocator; + + /// RegAssign - Map of the assigned register indexes. + /// Edit.get(RegAssign.lookup(Idx)) is the register that should be live at + /// Idx. + RegAssignMap RegAssign; - /// Currently open LiveInterval. - LiveIntervalMap OpenLI; + /// LIMappers - One LiveIntervalMap or each interval in Edit. + SmallVector LIMappers; /// defFromParent - Define Reg from ParentVNI at UseIdx using either /// rematerialization or a COPY from parent. Return the new value. - VNInfo *defFromParent(LiveIntervalMap &Reg, + VNInfo *defFromParent(unsigned RegIdx, VNInfo *ParentVNI, SlotIndex UseIdx, MachineBasicBlock &MBB, MachineBasicBlock::iterator I); - /// intervalsLiveAt - Return true if any member of intervals_ is live at Idx. - bool intervalsLiveAt(SlotIndex Idx) const; + /// rewriteAssigned - Rewrite all uses of Edit.getReg() to assigned registers. + void rewriteAssigned(); - /// Values in CurLI whose live range has been truncated when entering an open - /// li. - SmallPtrSet truncatedValues; - - /// addTruncSimpleRange - Add the given simple range to DupLI after - /// truncating any overlap with intervals_. - void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI); - - /// criticalPreds_ - Set of basic blocks where both dupli and OpenLI should be - /// live out because of a critical edge. - SplitAnalysis::BlockPtrSet criticalPreds_; - - /// computeRemainder - Compute the dupli liveness as the complement of all the - /// new intervals. - void computeRemainder(); - - /// rewrite - Rewrite all uses of reg to use the new registers. - void rewrite(unsigned reg); + /// rewriteComponents - Rewrite all uses of Intv[0] according to the eq + /// classes in ConEQ. + /// This must be done when Intvs[0] is styill live at all uses, before calling + /// ConEq.Distribute(). + void rewriteComponents(const SmallVectorImpl &Intvs, + const ConnectedVNInfoEqClasses &ConEq); public: /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. @@ -374,6 +380,9 @@ /// remaining live range, and rewrite instructions to use the new registers. void finish(); + /// dump - print the current interval maping to dbgs(). + void dump() const; + // ===--- High level methods ---=== /// splitAroundLoop - Split CurLI into a separate live interval inside From kirk.beitz at nokia.com Wed Feb 2 21:42:30 2011 From: kirk.beitz at nokia.com (kirk.beitz at nokia.com) Date: Thu, 3 Feb 2011 03:42:30 +0000 Subject: [llvm-commits] PATCH : change clang Attrs.td to avoid conflict w/MinGW basetyps.h Message-ID: <68FF85B1-015A-4963-9DAA-65FAF8837E91@nokia.com> Attached, please find a patch to tools/clang/include/clang/Basic/Attrs.td It is used to generate tools/clang/includes/clang/AST/Attrs.inc, which gets #included by Attr.h (which in turn is getting #included several nested levels deep in our effort to build lldb under MinGW ). Before the change, one of the classes to be generated defines "Args=>Interface". This causes a class with a private member variable named "interface" to get generated, and under MinGW, when code pulls in both this and basetyps.h before it, a conflict results, because basetyps.h will (under most circumstances) generate a line that essentially performs #define interface struct The change in the patch simply changes "Args=>Interface" to "Args=>InterFace" so that the private member variable that gets generated is "interFace". This mimics the style elsewhere in this file (e.g. "Args=>FormatIdx" generates a private member variable "formatIdx"). And with the capitalization difference, the conflict with MinGW basetyps.h is avoided. Thanks in advance for any review/comments/feedback. Index: include/clang/Basic/Attr.td =================================================================== --- include/clang/Basic/Attr.td (revision 123723) +++ include/clang/Basic/Attr.td (working copy) @@ -258,7 +258,7 @@ def IBOutletCollection : Attr { let Spellings = ["iboutletcollection"]; - let Args = [TypeArgument<"Interface">]; + let Args = [TypeArgument<"InterFace">]; } def Malloc : Attr { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/16876488/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Attr.td.patch Type: application/octet-stream Size: 415 bytes Desc: Attr.td.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/16876488/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/16876488/attachment.htm From kirk.beitz at nokia.com Wed Feb 2 23:55:06 2011 From: kirk.beitz at nokia.com (kirk.beitz at nokia.com) Date: Thu, 3 Feb 2011 05:55:06 +0000 Subject: [llvm-commits] PATCH : change clang Attrs.td to avoid conflict w/MinGW basetyps.h Message-ID: <62141A17-6C69-4F80-BAF2-3647E37359A8@nokia.com> Attached, please find a patch to tools/clang/include/clang/Basic/Attrs.td It is used to generate tools/clang/includes/clang/AST/Attrs.inc, which gets #included by Attr.h (which in turn is getting #included several nested levels deep in our effort to build lldb under MinGW ). Before the change, one of the classes to be generated defines "Args=>Interface". This causes a class with a private member variable named "interface" to get generated, and under MinGW, when code pulls in both this and basetyps.h before it, a conflict results, because basetyps.h will (under most circumstances) generate a line that essentially performs #define interface struct The change in the patch simply changes "Args=>Interface" to "Args=>InterFace" so that the private member variable that gets generated is "interFace". This mimics the style elsewhere in this file (e.g. "Args=>FormatIdx" generates a private member variable "formatIdx"). And with the capitalization difference, the conflict with MinGW basetyps.h is avoided. Thanks in advance for any review/comments/feedback. Index: include/clang/Basic/Attr.td =================================================================== --- include/clang/Basic/Attr.td (revision 123723) +++ include/clang/Basic/Attr.td (working copy) @@ -258,7 +258,7 @@ def IBOutletCollection : Attr { let Spellings = ["iboutletcollection"]; - let Args = [TypeArgument<"Interface">]; + let Args = [TypeArgument<"InterFace">]; } def Malloc : Attr { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/b55d2981/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Attr.td.patch Type: application/octet-stream Size: 415 bytes Desc: Attr.td.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/b55d2981/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/b55d2981/attachment.htm From geek4civic at gmail.com Thu Feb 3 01:36:02 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 03 Feb 2011 07:36:02 -0000 Subject: [llvm-commits] [llvm] r124783 - /llvm/trunk/test/Makefile Message-ID: <20110203073602.91D972A6C12C@llvm.org> Author: chapuni Date: Thu Feb 3 01:36:02 2011 New Revision: 124783 URL: http://llvm.org/viewvc/llvm-project?rev=124783&view=rev Log: test/Makefile: "check-all" should update tools/clang/test/Unit/lit.site.cfg, too. Follow up to clang r124777. Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=124783&r1=124782&r2=124783&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Thu Feb 3 01:36:02 2011 @@ -64,7 +64,7 @@ # Force creation of Clang's lit.site.cfg. clang-lit-site-cfg: FORCE - $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg + $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg Unit/lit.site.cfg extra-lit-site-cfgs:: clang-lit-site-cfg endif endif From baldrick at free.fr Thu Feb 3 02:14:04 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 03 Feb 2011 08:14:04 -0000 Subject: [llvm-commits] [llvm] r124784 - /llvm/trunk/unittests/ADT/TripleTest.cpp Message-ID: <20110203081404.52DD02A6C12C@llvm.org> Author: baldrick Date: Thu Feb 3 02:14:04 2011 New Revision: 124784 URL: http://llvm.org/viewvc/llvm-project?rev=124784&view=rev Log: Part of this test is invariant inside the inner loop - move it outside the loop. Modified: llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=124784&r1=124783&r2=124784&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Thu Feb 3 02:14:04 2011 @@ -161,27 +161,29 @@ C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor)); for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) { C[2] = Triple::getOSTypeName(Triple::OSType(OS)); + + // If a value has multiple interpretations, then the permutation + // test will inevitably fail. Currently this is only the case for + // "psp" which parses as both an architecture and an O/S. + if (OS == Triple::Psp) + continue; + + std::string E = Join(C[0], C[1], C[2]); + EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2]))); + + EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1]))); + EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0]))); + EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2]))); + EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1]))); + EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0]))); + for (int Env = 1+Triple::UnknownEnvironment; Env <= Triple::MachO; ++Env) { C[3] = Triple::getEnvironmentTypeName(Triple::EnvironmentType(Env)); - std::string E = Join(C[0], C[1], C[2]); std::string F = Join(C[0], C[1], C[2], C[3]); - EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2]))); EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[2], C[3]))); - // If a value has multiple interpretations, then the permutation - // test will inevitably fail. Currently this is only the case for - // "psp" which parses as both an architecture and an O/S. - if (OS == Triple::Psp) - continue; - - EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1]))); - EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0]))); - EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2]))); - EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1]))); - EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0]))); - EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[3], C[2]))); EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[3], C[1]))); EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[1], C[3]))); From baldrick at free.fr Thu Feb 3 03:37:39 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 03 Feb 2011 09:37:39 -0000 Subject: [llvm-commits] [llvm] r124788 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/2011-01-18-Compare.ll Message-ID: <20110203093739.330932A6C12C@llvm.org> Author: baldrick Date: Thu Feb 3 03:37:39 2011 New Revision: 124788 URL: http://llvm.org/viewvc/llvm-project?rev=124788&view=rev Log: Improve threading of comparisons over select instructions (spotted by my auto-simplifier). This has a big impact on Ada code, but not much else. Unfortunately the impact is mostly negative! This is due to PR9004 (aka SCCP failing to resolve conditional branch conditions in the destination blocks of the branch), in which simple correlated expressions are not resolved but complicated ones are, so simplifying has a bad effect! Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124788&r1=124787&r2=124788&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Thu Feb 3 03:37:39 2011 @@ -395,17 +395,39 @@ assert(isa(LHS) && "Not comparing with a select instruction!"); SelectInst *SI = cast(LHS); - // Now that we have "cmp select(cond, TV, FV), RHS", analyse it. + // Now that we have "cmp select(Cond, TV, FV), RHS", analyse it. // Does "cmp TV, RHS" simplify? if (Value *TCmp = SimplifyCmpInst(Pred, SI->getTrueValue(), RHS, TD, DT, - MaxRecurse)) + MaxRecurse)) { // It does! Does "cmp FV, RHS" simplify? if (Value *FCmp = SimplifyCmpInst(Pred, SI->getFalseValue(), RHS, TD, DT, - MaxRecurse)) + MaxRecurse)) { // It does! If they simplified to the same value, then use it as the // result of the original comparison. if (TCmp == FCmp) return TCmp; + Value *Cond = SI->getCondition(); + // If the false value simplified to false, then the result of the compare + // is equal to "Cond && TCmp". This also catches the case when the false + // value simplified to false and the true value to true, returning "Cond". + if (match(FCmp, m_Zero())) + if (Value *V = SimplifyAndInst(Cond, TCmp, TD, DT, MaxRecurse)) + return V; + // If the true value simplified to true, then the result of the compare + // is equal to "Cond || FCmp". + if (match(TCmp, m_One())) + if (Value *V = SimplifyOrInst(Cond, FCmp, TD, DT, MaxRecurse)) + return V; + // Finally, if the false value simplified to true and the true value to + // false, then the result of the compare is equal to "!Cond". + if (match(FCmp, m_One()) && match(TCmp, m_Zero())) + if (Value *V = + SimplifyXorInst(Cond, Constant::getAllOnesValue(Cond->getType()), + TD, DT, MaxRecurse)) + return V; + } + } + return 0; } Modified: llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll?rev=124788&r1=124787&r2=124788&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll (original) +++ llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll Thu Feb 3 03:37:39 2011 @@ -132,3 +132,38 @@ ret i1 %c ; CHECK: ret i1 false } + +define i1 @select1(i1 %cond) { +; CHECK: @select1 + %s = select i1 %cond, i32 1, i32 0 + %c = icmp eq i32 %s, 1 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select2(i1 %cond) { +; CHECK: @select2 + %x = zext i1 %cond to i32 + %s = select i1 %cond, i32 %x, i32 0 + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select3(i1 %cond) { +; CHECK: @select3 + %x = zext i1 %cond to i32 + %s = select i1 %cond, i32 1, i32 %x + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} + +define i1 @select4(i1 %cond) { +; CHECK: @select4 + %invert = xor i1 %cond, 1 + %s = select i1 %invert, i32 0, i32 1 + %c = icmp ne i32 %s, 0 + ret i1 %c +; CHECK: ret i1 %cond +} From geek4civic at gmail.com Thu Feb 3 05:41:27 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 03 Feb 2011 11:41:27 -0000 Subject: [llvm-commits] [llvm] r124793 - in /llvm/trunk/cmake: README config-ix.cmake modules/AddLLVM.cmake modules/AddLLVMDefinitions.cmake modules/CheckAtomic.cmake modules/ChooseMSVCCRT.cmake modules/CrossCompileLLVM.cmake modules/FindBison.cmake modules/GetTargetTriple.cmake modules/LLVM.cmake modules/LLVMConfig.cmake modules/LLVMLibDeps.cmake modules/LLVMProcessSources.cmake modules/TableGen.cmake modules/VersionFromVCS.cmake Message-ID: <20110203114127.DA99C2A6C12C@llvm.org> Author: chapuni Date: Thu Feb 3 05:41:27 2011 New Revision: 124793 URL: http://llvm.org/viewvc/llvm-project?rev=124793&view=rev Log: cmake/*: Add svn:eol-style=native and fix CRLF. Modified: llvm/trunk/cmake/README (props changed) llvm/trunk/cmake/config-ix.cmake (props changed) llvm/trunk/cmake/modules/AddLLVM.cmake (props changed) llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake (contents, props changed) llvm/trunk/cmake/modules/CheckAtomic.cmake (props changed) llvm/trunk/cmake/modules/ChooseMSVCCRT.cmake (props changed) llvm/trunk/cmake/modules/CrossCompileLLVM.cmake (contents, props changed) llvm/trunk/cmake/modules/FindBison.cmake (props changed) llvm/trunk/cmake/modules/GetTargetTriple.cmake (props changed) llvm/trunk/cmake/modules/LLVM.cmake (props changed) llvm/trunk/cmake/modules/LLVMConfig.cmake (props changed) llvm/trunk/cmake/modules/LLVMLibDeps.cmake (props changed) llvm/trunk/cmake/modules/LLVMProcessSources.cmake (props changed) llvm/trunk/cmake/modules/TableGen.cmake (props changed) llvm/trunk/cmake/modules/VersionFromVCS.cmake (props changed) Propchange: llvm/trunk/cmake/README ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/config-ix.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/AddLLVM.cmake ------------------------------------------------------------------------------ svn:eol-style = native Modified: llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake?rev=124793&r1=124792&r2=124793&view=diff ============================================================================== --- llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake (original) +++ llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake Thu Feb 3 05:41:27 2011 @@ -1,14 +1,13 @@ -# There is no clear way of keeping track of compiler command-line -# options chosen via `add_definitions', so we need our own method for -# using it on tools/llvm-config/CMakeLists.txt. - -# Beware that there is no implementation of remove_llvm_definitions. - -macro(add_llvm_definitions) - # We don't want no semicolons on LLVM_DEFINITIONS: - foreach(arg ${ARGN}) - set(LLVM_DEFINITIONS "${LLVM_DEFINITIONS} ${arg}") - endforeach(arg) - add_definitions( ${ARGN} ) -endmacro(add_llvm_definitions) - +# There is no clear way of keeping track of compiler command-line +# options chosen via `add_definitions', so we need our own method for +# using it on tools/llvm-config/CMakeLists.txt. + +# Beware that there is no implementation of remove_llvm_definitions. + +macro(add_llvm_definitions) + # We don't want no semicolons on LLVM_DEFINITIONS: + foreach(arg ${ARGN}) + set(LLVM_DEFINITIONS "${LLVM_DEFINITIONS} ${arg}") + endforeach(arg) + add_definitions( ${ARGN} ) +endmacro(add_llvm_definitions) Propchange: llvm/trunk/cmake/modules/AddLLVMDefinitions.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/CheckAtomic.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/ChooseMSVCCRT.cmake ------------------------------------------------------------------------------ svn:eol-style = native Modified: llvm/trunk/cmake/modules/CrossCompileLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CrossCompileLLVM.cmake?rev=124793&r1=124792&r2=124793&view=diff ============================================================================== --- llvm/trunk/cmake/modules/CrossCompileLLVM.cmake (original) +++ llvm/trunk/cmake/modules/CrossCompileLLVM.cmake Thu Feb 3 05:41:27 2011 @@ -1,26 +1,26 @@ - -if( ${LLVM_TABLEGEN} STREQUAL "tblgen" ) - set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native") - set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen") - - add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR} - COMMENT "Creating ${CX_NATIVE_TG_DIR}...") - - add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt - COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} - WORKING_DIRECTORY ${CX_NATIVE_TG_DIR} - DEPENDS ${CX_NATIVE_TG_DIR} - COMMENT "Configuring native TableGen...") - - add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE} - COMMAND ${CMAKE_BUILD_TOOL} - DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt - WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen - COMMENT "Building native TableGen...") - add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE}) - - add_dependencies(tblgen NativeTableGen) - - set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR}) -endif() + +if( ${LLVM_TABLEGEN} STREQUAL "tblgen" ) + set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native") + set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen") + + add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR} + COMMENT "Creating ${CX_NATIVE_TG_DIR}...") + + add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt + COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${CX_NATIVE_TG_DIR} + DEPENDS ${CX_NATIVE_TG_DIR} + COMMENT "Configuring native TableGen...") + + add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE} + COMMAND ${CMAKE_BUILD_TOOL} + DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt + WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen + COMMENT "Building native TableGen...") + add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE}) + + add_dependencies(tblgen NativeTableGen) + + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR}) +endif() Propchange: llvm/trunk/cmake/modules/CrossCompileLLVM.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/FindBison.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/GetTargetTriple.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/LLVM.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/LLVMConfig.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/LLVMLibDeps.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/LLVMProcessSources.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/TableGen.cmake ------------------------------------------------------------------------------ svn:eol-style = native Propchange: llvm/trunk/cmake/modules/VersionFromVCS.cmake ------------------------------------------------------------------------------ svn:eol-style = native From richard at xmos.com Thu Feb 3 07:14:25 2011 From: richard at xmos.com (Richard Osborne) Date: Thu, 03 Feb 2011 13:14:25 -0000 Subject: [llvm-commits] [llvm] r124794 - in /llvm/trunk: include/llvm/IntrinsicsXCore.td lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/resources.ll Message-ID: <20110203131425.9669D2A6C12C@llvm.org> Author: friedgold Date: Thu Feb 3 07:14:25 2011 New Revision: 124794 URL: http://llvm.org/viewvc/llvm-project?rev=124794&view=rev Log: Add XCore intrinsics for resource instructions. Added: llvm/trunk/test/CodeGen/XCore/resources.ll Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Modified: llvm/trunk/include/llvm/IntrinsicsXCore.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsXCore.td?rev=124794&r1=124793&r2=124794&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsXCore.td (original) +++ llvm/trunk/include/llvm/IntrinsicsXCore.td Thu Feb 3 07:14:25 2011 @@ -11,4 +11,24 @@ let TargetPrefix = "xcore" in { // All intrinsics start with "llvm.xcore.". def int_xcore_bitrev : Intrinsic<[llvm_i32_ty],[llvm_i32_ty],[IntrNoMem]>; def int_xcore_getid : Intrinsic<[llvm_i32_ty],[],[IntrNoMem]>; + + // Resource instructions. + def int_xcore_getr : Intrinsic<[llvm_anyptr_ty],[llvm_i32_ty]>; + def int_xcore_freer : Intrinsic<[],[llvm_anyptr_ty], + [NoCapture<0>]>; + def int_xcore_in : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty],[NoCapture<0>]>; + def int_xcore_int : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty], + [NoCapture<0>]>; + def int_xcore_inct : Intrinsic<[llvm_i32_ty],[llvm_anyptr_ty], + [NoCapture<0>]>; + def int_xcore_out : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_outt : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_outct : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_chkct : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; + def int_xcore_setd : Intrinsic<[],[llvm_anyptr_ty, llvm_i32_ty], + [NoCapture<0>]>; } Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=124794&r1=124793&r2=124794&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Thu Feb 3 07:14:25 2011 @@ -720,9 +720,8 @@ "neg $dst, $b", [(set GRRegs:$dst, (ineg GRRegs:$b))]>; -// TODO setd, eet, eef, getts, setpt, outct, inct, chkct, outt, intt, out, -// in, outshr, inshr, testct, testwct, tinitpc, tinitdp, tinitsp, tinitcp, -// tsetmr, sext (reg), zext (reg) +// TODO setd, eet, eef, getts, setpt, outshr, inshr, testwct, tinitpc, tinitdp, +// tinitsp, tinitcp, tsetmr, sext (reg), zext (reg) let Constraints = "$src1 = $dst" in { let neverHasSideEffects = 1 in def SEXT_rus : _FRUS<(outs GRRegs:$dst), (ins GRRegs:$src1, i32imm:$src2), @@ -748,6 +747,50 @@ "mkmsk $dst, $size", [(set GRRegs:$dst, (add (shl 1, GRRegs:$size), 0xffffffff))]>; +def GETR_rus : _FRUS<(outs GRRegs:$dst), (ins i32imm:$type), + "getr $dst, $type", + [(set GRRegs:$dst, (int_xcore_getr immUs:$type))]>; + +def OUTCT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "outct res[$r], $val", + [(int_xcore_outct GRRegs:$r, GRRegs:$val)]>; + +def OUTCT_rus : _F2R<(outs), (ins GRRegs:$r, i32imm:$val), + "outct res[$r], $val", + [(int_xcore_outct GRRegs:$r, immUs:$val)]>; + +def OUTT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "outt res[$r], $val", + [(int_xcore_outt GRRegs:$r, GRRegs:$val)]>; + +def OUT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "out res[$r], $val", + [(int_xcore_out GRRegs:$r, GRRegs:$val)]>; + +def INCT_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r), + "inct $dst, res[$r]", + [(set GRRegs:$dst, (int_xcore_inct GRRegs:$r))]>; + +def INT_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r), + "int $dst, res[$r]", + [(set GRRegs:$dst, (int_xcore_int GRRegs:$r))]>; + +def IN_2r : _F2R<(outs GRRegs:$dst), (ins GRRegs:$r), + "in $dst, res[$r]", + [(set GRRegs:$dst, (int_xcore_in GRRegs:$r))]>; + +def CHKCT_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "chkct res[$r], $val", + [(int_xcore_chkct GRRegs:$r, GRRegs:$val)]>; + +def CHKCT_rus : _F2R<(outs), (ins GRRegs:$r, i32imm:$val), + "chkct res[$r], $val", + [(int_xcore_chkct GRRegs:$r, immUs:$val)]>; + +def SETD_2r : _F2R<(outs), (ins GRRegs:$r, GRRegs:$val), + "setd res[$r], $val", + [(int_xcore_setd GRRegs:$r, GRRegs:$val)]>; + // Two operand long // TODO settw, setclk, setrdy, setpsc, endin, peek, // getd, testlcl, tinitlr, getps, setps @@ -764,7 +807,7 @@ [(set GRRegs:$dst, (ctlz GRRegs:$src))]>; // One operand short -// TODO edu, eeu, waitet, waitef, freer, tstart, msync, mjoin, syncr, clrtp +// TODO edu, eeu, waitet, waitef, tstart, msync, mjoin, syncr, clrtp // setdp, setcp, setv, setev, kcall // dgetreg let isBranch=1, isIndirectBranch=1, isTerminator=1, isBarrier = 1 in @@ -805,6 +848,10 @@ [(XCoreBranchLink GRRegs:$addr)]>; } +def FREER_1r : _F1R<(outs), (ins GRRegs:$r), + "freer res[$r]", + [(int_xcore_freer GRRegs:$r)]>; + // Zero operand short // TODO waiteu, clre, ssync, freet, ldspc, stspc, ldssr, stssr, ldsed, stsed, // stet, geted, getet, getkep, getksp, setkep, getid, kret, dcall, dret, Added: llvm/trunk/test/CodeGen/XCore/resources.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/resources.ll?rev=124794&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/resources.ll (added) +++ llvm/trunk/test/CodeGen/XCore/resources.ll Thu Feb 3 07:14:25 2011 @@ -0,0 +1,97 @@ +; RUN: llc -march=xcore < %s | FileCheck %s + +declare i8 addrspace(1)* @llvm.xcore.getr.p1i8(i32 %type) +declare void @llvm.xcore.freer.p1i8(i8 addrspace(1)* %r) +declare i32 @llvm.xcore.in.p1i8(i8 addrspace(1)* %r) +declare i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r) +declare i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r) +declare void @llvm.xcore.out.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.setd.p1i8(i8 addrspace(1)* %r, i32 %value) +declare void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 %value) + +define i8 addrspace(1)* @getr() { +; CHECK: getr: +; CHECK: getr r0, 5 + %result = call i8 addrspace(1)* @llvm.xcore.getr.p1i8(i32 5) + ret i8 addrspace(1)* %result +} + +define void @freer(i8 addrspace(1)* %r) { +; CHECK: freer: +; CHECK: freer res[r0] + call void @llvm.xcore.freer.p1i8(i8 addrspace(1)* %r) + ret void +} + +define i32 @in(i8 addrspace(1)* %r) { +; CHECK: in: +; CHECK: in r0, res[r0] + %result = call i32 @llvm.xcore.in.p1i8(i8 addrspace(1)* %r) + ret i32 %result +} + +define i32 @int(i8 addrspace(1)* %r) { +; CHECK: int: +; CHECK: int r0, res[r0] + %result = call i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r) + ret i32 %result +} + +define i32 @inct(i8 addrspace(1)* %r) { +; CHECK: inct: +; CHECK: inct r0, res[r0] + %result = call i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r) + ret i32 %result +} + +define void @out(i8 addrspace(1)* %r, i32 %value) { +; CHECK: out: +; CHECK: out res[r0], r1 + call void @llvm.xcore.out.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} + +define void @outt(i8 addrspace(1)* %r, i32 %value) { +; CHECK: outt: +; CHECK: outt res[r0], r1 + call void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} + +define void @outct(i8 addrspace(1)* %r, i32 %value) { +; CHECK: outct: +; CHECK: outct res[r0], r1 + call void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} + +define void @outcti(i8 addrspace(1)* %r) { +; CHECK: outcti: +; CHECK: outct res[r0], 11 + call void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 11) + ret void +} + +define void @chkct(i8 addrspace(1)* %r, i32 %value) { +; CHECK: chkct: +; CHECK: chkct res[r0], r1 + call void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} + +define void @chkcti(i8 addrspace(1)* %r) { +; CHECK: chkcti: +; CHECK: chkct res[r0], 11 + call void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 11) + ret void +} + +define void @setd(i8 addrspace(1)* %r, i32 %value) { +; CHECK: setd: +; CHECK: setd res[r0], r1 + call void @llvm.xcore.setd.p1i8(i8 addrspace(1)* %r, i32 %value) + ret void +} From greened at obbligato.org Thu Feb 3 09:50:00 2011 From: greened at obbligato.org (David Greene) Date: Thu, 03 Feb 2011 15:50:00 -0000 Subject: [llvm-commits] [llvm] r124797 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h X86InstrFragmentsSIMD.td X86InstrSSE.td Message-ID: <20110203155001.2A8772A6C12C@llvm.org> Author: greened Date: Thu Feb 3 09:50:00 2011 New Revision: 124797 URL: http://llvm.org/viewvc/llvm-project?rev=124797&view=rev Log: [AVX] VEXTRACTF128 support. This commit includes patterns for matching EXTRACT_SUBVECTOR to VEXTRACTF128 along with support routines to examine and translate index values. VINSERTF128 comes next. With these two in place we can begin supporting more AVX operations as INSERT/EXTRACT can be used as a fallback when 256-bit support is not available. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124797&r1=124796&r2=124797&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 3 09:50:00 2011 @@ -3262,6 +3262,25 @@ return true; } +/// isVEXTRACTF128Index - Return true if the specified +/// EXTRACT_SUBVECTOR operand specifies a vector extract that is +/// suitable for input to VEXTRACTF128. +bool X86::isVEXTRACTF128Index(SDNode *N) { + if (!isa(N->getOperand(1).getNode())) + return false; + + // The index should be aligned on a 128-bit boundary. + uint64_t Index = + cast(N->getOperand(1).getNode())->getZExtValue(); + + unsigned VL = N->getValueType(0).getVectorNumElements(); + unsigned VBits = N->getValueType(0).getSizeInBits(); + unsigned ElSize = VBits / VL; + bool Result = (Index * ElSize) % 128 == 0; + + return Result; +} + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified VECTOR_SHUFFLE mask with PSHUF* and SHUFP* instructions. unsigned X86::getShuffleSHUFImmediate(SDNode *N) { @@ -3330,6 +3349,24 @@ return (Val - i) * EltSize; } +/// getExtractVEXTRACTF128Immediate - Return the appropriate immediate +/// to extract the specified EXTRACT_SUBVECTOR index with VEXTRACTF128 +/// instructions. +unsigned X86::getExtractVEXTRACTF128Immediate(SDNode *N) { + if (!isa(N->getOperand(1).getNode())) + llvm_unreachable("Illegal extract subvector for VEXTRACTF128"); + + uint64_t Index = + cast(N->getOperand(1).getNode())->getZExtValue(); + + EVT VecVT = N->getOperand(0).getValueType(); + EVT ElVT = VecVT.getVectorElementType(); + + unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits(); + + return Index / NumElemsPerChunk; +} + /// isZeroNode - Returns true if Elt is a constant zero or a floating point /// constant +0.0. bool X86::isZeroNode(SDValue Elt) { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=124797&r1=124796&r2=124797&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Feb 3 09:50:00 2011 @@ -408,6 +408,11 @@ /// specifies a shuffle of elements that is suitable for input to PALIGNR. bool isPALIGNRMask(ShuffleVectorSDNode *N); + /// isVEXTRACTF128Index - Return true if the specified + /// EXTRACT_SUBVECTOR operand specifies a vector extract that is + /// suitable for input to VEXTRACTF128. + bool isVEXTRACTF128Index(SDNode *N); + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP* /// instructions. @@ -425,6 +430,11 @@ /// the specified VECTOR_SHUFFLE mask with the PALIGNR instruction. unsigned getShufflePALIGNRImmediate(SDNode *N); + /// getExtractVEXTRACTF128Immediate - Return the appropriate + /// immediate to extract the specified EXTRACT_SUBVECTOR index + /// with VEXTRACTF128 instructions. + unsigned getExtractVEXTRACTF128Immediate(SDNode *N); + /// isZeroNode - Returns true if Elt is a constant zero or a floating point /// constant +0.0. bool isZeroNode(SDValue Elt); Modified: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td?rev=124797&r1=124796&r2=124797&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Thu Feb 3 09:50:00 2011 @@ -342,6 +342,12 @@ return getI8Imm(X86::getShufflePALIGNRImmediate(N)); }]>; +// EXTRACT_get_vextractf128_imm xform function: convert extract_subvector index +// to VEXTRACTF128 imm. +def EXTRACT_get_vextractf128_imm : SDNodeXForm; + def splat_lo : PatFrag<(ops node:$lhs, node:$rhs), (vector_shuffle node:$lhs, node:$rhs), [{ ShuffleVectorSDNode *SVOp = cast(N); @@ -432,3 +438,9 @@ (vector_shuffle node:$lhs, node:$rhs), [{ return X86::isPALIGNRMask(cast(N)); }], SHUFFLE_get_palign_imm>; + +def vextractf128_extract : PatFrag<(ops node:$bigvec, node:$index), + (extract_subvector node:$bigvec, + node:$index), [{ + return X86::isVEXTRACTF128Index(N); +}], EXTRACT_get_vextractf128_imm>; Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=124797&r1=124796&r2=124797&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Feb 3 09:50:00 2011 @@ -5443,6 +5443,23 @@ def : Pat<(int_x86_avx_vextractf128_si_256 VR256:$src1, imm:$src2), (VEXTRACTF128rr VR256:$src1, imm:$src2)>; +def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)), + (v4f32 (VEXTRACTF128rr + (v8f32 VR256:$src1), + (EXTRACT_get_vextractf128_imm VR128:$ext)))>; +def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)), + (v2f64 (VEXTRACTF128rr + (v4f64 VR256:$src1), + (EXTRACT_get_vextractf128_imm VR128:$ext)))>; +def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)), + (v4i32 (VEXTRACTF128rr + (v8i32 VR256:$src1), + (EXTRACT_get_vextractf128_imm VR128:$ext)))>; +def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)), + (v2i64 (VEXTRACTF128rr + (v4i64 VR256:$src1), + (EXTRACT_get_vextractf128_imm VR128:$ext)))>; + def : Pat<(int_x86_avx_vbroadcastf128_ps_256 addr:$src), (VBROADCASTF128 addr:$src)>; From stoklund at 2pi.dk Thu Feb 3 11:04:12 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 17:04:12 -0000 Subject: [llvm-commits] [llvm] r124798 - /llvm/trunk/lib/CodeGen/SpillPlacement.cpp Message-ID: <20110203170412.E1CFC2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 3 11:04:12 2011 New Revision: 124798 URL: http://llvm.org/viewvc/llvm-project?rev=124798&view=rev Log: Silence an MSVC warning Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.cpp?rev=124798&r1=124797&r2=124798&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SpillPlacement.cpp (original) +++ llvm/trunk/lib/CodeGen/SpillPlacement.cpp Thu Feb 3 11:04:12 2011 @@ -154,7 +154,7 @@ // 1. It avoids arbitrary bias when all links are 0 as is possible during // initial iterations. // 2. It helps tame rounding errors when the links nominally sum to 0. - const float Thres = 1e-4; + const float Thres = 1e-4f; bool Before = preferReg(); if (Sum < -Thres) Value = -1; From stoklund at 2pi.dk Thu Feb 3 11:04:16 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 17:04:16 -0000 Subject: [llvm-commits] [llvm] r124799 - in /llvm/trunk/lib/CodeGen: RegAllocGreedy.cpp SplitKit.cpp SplitKit.h Message-ID: <20110203170416.3AD3E2A6C12D@llvm.org> Author: stoklund Date: Thu Feb 3 11:04:16 2011 New Revision: 124799 URL: http://llvm.org/viewvc/llvm-project?rev=124799&view=rev Log: Return live range end points from SplitEditor::enter*/leave*. These end points come from the inserted copies, and can be passed directly to useIntv. This simplifies the coloring code. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124799&r1=124798&r2=124799&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 3 11:04:16 2011 @@ -680,16 +680,14 @@ } if (!BI.LiveThrough) { DEBUG(dbgs() << ", not live-through.\n"); - SE.enterIntvBefore(BI.Def); - SE.useIntv(BI.Def, Stop); + SE.useIntv(SE.enterIntvBefore(BI.Def), Stop); continue; } if (!RegIn) { // Block is live-through, but entry bundle is on the stack. // Reload just before the first use. DEBUG(dbgs() << ", not live-in, enter before first use.\n"); - SE.enterIntvBefore(BI.FirstUse); - SE.useIntv(BI.FirstUse, Stop); + SE.useIntv(SE.enterIntvBefore(BI.FirstUse), Stop); continue; } DEBUG(dbgs() << ", live-through.\n"); @@ -713,8 +711,7 @@ SlotIndex Use = *UI; DEBUG(dbgs() << ", free use at " << Use << ".\n"); assert(Use <= BI.LastUse && "Couldn't find last use"); - SE.enterIntvBefore(Use); - SE.useIntv(Use, Stop); + SE.useIntv(SE.enterIntvBefore(Use), Stop); continue; } @@ -759,16 +756,14 @@ } if (!BI.LiveThrough) { DEBUG(dbgs() << ", killed in block.\n"); - SE.useIntv(Start, BI.Kill.getBoundaryIndex()); - SE.leaveIntvAfter(BI.Kill); + SE.useIntv(Start, SE.leaveIntvAfter(BI.Kill)); continue; } if (!RegOut) { // Block is live-through, but exit bundle is on the stack. // Spill immediately after the last use. DEBUG(dbgs() << ", uses, stack-out.\n"); - SE.useIntv(Start, BI.LastUse.getBoundaryIndex()); - SE.leaveIntvAfter(BI.LastUse); + SE.useIntv(Start, SE.leaveIntvAfter(BI.LastUse)); continue; } // Register is live-through. @@ -794,8 +789,7 @@ SlotIndex Use = (--UI)->getBoundaryIndex(); DEBUG(dbgs() << ", free use at " << *UI << ".\n"); assert(Use >= BI.FirstUse && Use < IP.first); - SE.useIntv(Start, Use); - SE.leaveIntvAfter(Use); + SE.useIntv(Start, SE.leaveIntvAfter(Use)); continue; } @@ -875,6 +869,8 @@ SmallVector SpillRegs; LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); SplitEditor(*SA, *LIS, *VRM, *DomTree, LREdit).splitSingleBlocks(Blocks); + if (VerifyEnabled) + MF->verify(this, "After splitting live range around basic blocks"); } // Don't assign any physregs. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124799&r1=124798&r2=124799&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb 3 11:04:16 2011 @@ -776,12 +776,6 @@ // Add minimal liveness for the new value. Edit.get(RegIdx)->addRange(LiveRange(Def, Def.getNextSlot(), VNI)); - - if (RegIdx) { - if (UseIdx < Def) - UseIdx = Def; - RegAssign.insert(Def, UseIdx.getNextSlot(), RegIdx); - } return VNI; } @@ -803,38 +797,39 @@ LIMappers[OpenIdx].reset(Edit.get(OpenIdx)); } -/// enterIntvBefore - Enter OpenLI before the instruction at Idx. If CurLI is -/// not live before Idx, a COPY is not inserted. -void SplitEditor::enterIntvBefore(SlotIndex Idx) { +SlotIndex SplitEditor::enterIntvBefore(SlotIndex Idx) { assert(OpenIdx && "openIntv not called before enterIntvBefore"); - Idx = Idx.getUseIndex(); DEBUG(dbgs() << " enterIntvBefore " << Idx); + Idx = Idx.getBaseIndex(); VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); if (!ParentVNI) { DEBUG(dbgs() << ": not live\n"); - return; + return Idx; } - DEBUG(dbgs() << ": valno " << ParentVNI->id); + DEBUG(dbgs() << ": valno " << ParentVNI->id << '\n'); MachineInstr *MI = LIS.getInstructionFromIndex(Idx); assert(MI && "enterIntvBefore called with invalid index"); - defFromParent(OpenIdx, ParentVNI, Idx, *MI->getParent(), MI); - DEBUG(dump()); + VNInfo *VNI = defFromParent(OpenIdx, ParentVNI, Idx, *MI->getParent(), MI); + return VNI->def; } -/// enterIntvAtEnd - Enter OpenLI at the end of MBB. -void SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) { +SlotIndex SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) { assert(OpenIdx && "openIntv not called before enterIntvAtEnd"); - SlotIndex End = LIS.getMBBEndIdx(&MBB).getPrevSlot(); - DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << End); - VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(End); + SlotIndex End = LIS.getMBBEndIdx(&MBB); + SlotIndex Last = End.getPrevSlot(); + DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << Last); + VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Last); if (!ParentVNI) { DEBUG(dbgs() << ": not live\n"); - return; + return End; } DEBUG(dbgs() << ": valno " << ParentVNI->id); - defFromParent(OpenIdx, ParentVNI, End, MBB, MBB.getFirstTerminator()); + VNInfo *VNI = defFromParent(OpenIdx, ParentVNI, Last, MBB, + MBB.getFirstTerminator()); + RegAssign.insert(VNI->def, End, OpenIdx); DEBUG(dump()); + return VNI->def; } /// useIntv - indicate that all instructions in MBB should use OpenLI. @@ -849,8 +844,7 @@ DEBUG(dump()); } -/// leaveIntvAfter - Leave OpenLI after the instruction at Idx. -void SplitEditor::leaveIntvAfter(SlotIndex Idx) { +SlotIndex SplitEditor::leaveIntvAfter(SlotIndex Idx) { assert(OpenIdx && "openIntv not called before leaveIntvAfter"); DEBUG(dbgs() << " leaveIntvAfter " << Idx); @@ -859,21 +853,17 @@ VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Idx); if (!ParentVNI) { DEBUG(dbgs() << ": not live\n"); - return; + return Idx.getNextSlot(); } - DEBUG(dbgs() << ": valno " << ParentVNI->id); + DEBUG(dbgs() << ": valno " << ParentVNI->id << '\n'); MachineBasicBlock::iterator MII = LIS.getInstructionFromIndex(Idx); VNInfo *VNI = defFromParent(0, ParentVNI, Idx, *MII->getParent(), llvm::next(MII)); - - RegAssign.insert(Idx, VNI->def, OpenIdx); - DEBUG(dump()); + return VNI->def; } -/// leaveIntvAtTop - Leave the interval at the top of MBB. -/// Currently, only one value can leave the interval. -void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { +SlotIndex SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { assert(OpenIdx && "openIntv not called before leaveIntvAtTop"); SlotIndex Start = LIS.getMBBStartIdx(&MBB); DEBUG(dbgs() << " leaveIntvAtTop BB#" << MBB.getNumber() << ", " << Start); @@ -881,13 +871,14 @@ VNInfo *ParentVNI = Edit.getParent().getVNInfoAt(Start); if (!ParentVNI) { DEBUG(dbgs() << ": not live\n"); - return; + return Start; } VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB, MBB.SkipPHIsAndLabels(MBB.begin())); RegAssign.insert(Start, VNI->def, OpenIdx); DEBUG(dump()); + return VNI->def; } /// closeIntv - Indicate that we are done editing the currently open @@ -1148,9 +1139,7 @@ assert(IP.first.isValid() && IP.second.isValid()); openIntv(); - enterIntvBefore(IP.first); - useIntv(IP.first.getBaseIndex(), IP.second.getBoundaryIndex()); - leaveIntvAfter(IP.second); + useIntv(enterIntvBefore(IP.first), leaveIntvAfter(IP.second)); closeIntv(); } finish(); @@ -1211,18 +1200,14 @@ // First interval before the gap. Don't create single-instr intervals. if (bestPos > 1) { openIntv(); - enterIntvBefore(Uses.front()); - useIntv(Uses.front().getBaseIndex(), Uses[bestPos-1].getBoundaryIndex()); - leaveIntvAfter(Uses[bestPos-1]); + useIntv(enterIntvBefore(Uses.front()), leaveIntvAfter(Uses[bestPos-1])); closeIntv(); } // Second interval after the gap. if (bestPos < Uses.size()-1) { openIntv(); - enterIntvBefore(Uses[bestPos]); - useIntv(Uses[bestPos].getBaseIndex(), Uses.back().getBoundaryIndex()); - leaveIntvAfter(Uses.back()); + useIntv(enterIntvBefore(Uses[bestPos]), leaveIntvAfter(Uses.back())); closeIntv(); } Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=124799&r1=124798&r2=124799&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Thu Feb 3 11:04:16 2011 @@ -352,12 +352,15 @@ /// Create a new virtual register and live interval. void openIntv(); - /// enterIntvBefore - Enter OpenLI before the instruction at Idx. If CurLI is - /// not live before Idx, a COPY is not inserted. - void enterIntvBefore(SlotIndex Idx); - - /// enterIntvAtEnd - Enter OpenLI at the end of MBB. - void enterIntvAtEnd(MachineBasicBlock &MBB); + /// enterIntvBefore - Enter the open interval before the instruction at Idx. + /// If the parent interval is not live before Idx, a COPY is not inserted. + /// Return the beginning of the new live range. + SlotIndex enterIntvBefore(SlotIndex Idx); + + /// enterIntvAtEnd - Enter the open interval at the end of MBB. + /// Use the open interval from he inserted copy to the MBB end. + /// Return the beginning of the new live range. + SlotIndex enterIntvAtEnd(MachineBasicBlock &MBB); /// useIntv - indicate that all instructions in MBB should use OpenLI. void useIntv(const MachineBasicBlock &MBB); @@ -365,12 +368,14 @@ /// useIntv - indicate that all instructions in range should use OpenLI. void useIntv(SlotIndex Start, SlotIndex End); - /// leaveIntvAfter - Leave OpenLI after the instruction at Idx. - void leaveIntvAfter(SlotIndex Idx); + /// leaveIntvAfter - Leave the open interval after the instruction at Idx. + /// Return the end of the live range. + SlotIndex leaveIntvAfter(SlotIndex Idx); /// leaveIntvAtTop - Leave the interval at the top of MBB. - /// Currently, only one value can leave the interval. - void leaveIntvAtTop(MachineBasicBlock &MBB); + /// Add liveness from the MBB top to the copy. + /// Return the end of the live range. + SlotIndex leaveIntvAtTop(MachineBasicBlock &MBB); /// closeIntv - Indicate that we are done editing the currently open /// LiveInterval, and ranges can be trimmed. From gohman at apple.com Thu Feb 3 12:38:03 2011 From: gohman at apple.com (Dan Gohman) Date: Thu, 3 Feb 2011 10:38:03 -0800 Subject: [llvm-commits] [PATCH] report_fatal_error() issue In-Reply-To: References: <58C3D007-6443-40B5-A2AB-F1938D0CC5AC@apple.com> Message-ID: <97D88A61-F4E5-4206-B946-11F6700C0ED8@apple.com> On Feb 2, 2011, at 5:22 PM, NAKAMURA Takumi wrote: > Dan, thank you to comment me! > > I met this issue with test/Others/close-stderr.ll on mingw MSYS bash shell. > > 2011/2/3 Dan Gohman : >> If there's a real bug here, please explain it. Otherwise, this seems to be >> some Windows quirk, so it should be conditionalized with #if accordingly. >> In either case, please add a comment in the code. > > I was dubious to invoke exit() in global dtors. > I have reconfirmed "exit() in global dtor" works on glibc2 linux. With the current code, output errors in raw_fd_ostream never pass silently, unless explicitly silenced. If you know of a better way to achieve this, please suggest it. > I have to conditionalize when we can expect it above. eg. > #ifdef __MINGW32__ > // Mingw is not expected to call exit() in dtor context. > return; > #endif > if (has_error()) report_fatal_error(?); With this approach, command-line tools like opt, llc, etc., will silently swallow all output errors on mingw. I'll leave it up to you. > On mingw, global dtors are called as atexit handlers. (not cxa_atexit) > And it seems atexit() would not be re-entrant. > > Anyway I thought report_fatal_error() would be futile when stderr got > fault (FD == 2). If stderr has seen an output error, something bad must have happened. Even though report_fatal_error's own message may not get through, its other effects are still useful. Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/0c4bdf4f/attachment.html From criswell at uiuc.edu Thu Feb 3 13:32:54 2011 From: criswell at uiuc.edu (John Criswell) Date: Thu, 03 Feb 2011 19:32:54 -0000 Subject: [llvm-commits] [poolalloc] r124808 - in /poolalloc/trunk: include/dsa/TypeSafety.h lib/DSA/TypeSafety.cpp Message-ID: <20110203193254.80F972A6C12C@llvm.org> Author: criswell Date: Thu Feb 3 13:32:54 2011 New Revision: 124808 URL: http://llvm.org/viewvc/llvm-project?rev=124808&view=rev Log: Added the TypeSafety pass. This convenience pass will properly interpret DSA results to see if a pointer points to a memory object that is used in a type-safe fashion. Added: poolalloc/trunk/include/dsa/TypeSafety.h poolalloc/trunk/lib/DSA/TypeSafety.cpp Added: poolalloc/trunk/include/dsa/TypeSafety.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/TypeSafety.h?rev=124808&view=auto ============================================================================== --- poolalloc/trunk/include/dsa/TypeSafety.h (added) +++ poolalloc/trunk/include/dsa/TypeSafety.h Thu Feb 3 13:32:54 2011 @@ -0,0 +1,83 @@ +//===- TypeSafety.h - Find Type-Safe Pointers ---------------------*- C++ -*--// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This analysis pass determines which pointers within a program are used in +// a type-safe fashion. It uses DSA to determine type-consistency and +// abstracts the details of interpreting DSA's results. +// +//===----------------------------------------------------------------------===// + +#ifndef DSA_TYPESAFETY_H +#define DSA_TYPESAFETY_H + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" + +#include "llvm/Pass.h" + +#include + +using namespace llvm; + +namespace dsa { + +// +// Pass: TypeSafety +// +// Description: +// This pass determines which pointers within a function are type-safe. It is +// used to abstract away the interpretation of the DSNode flags and fields +// for clients. +// +// Template parameters: +// dsa - The name of the DSA Pass which this pass should use. +// +template +struct TypeSafety : public ModulePass { + protected: + // Methods + DSNodeHandle getDSNodeHandle (const Value * V, const Function * F); + void findTypeSafeDSNodes (const DSGraph * Graph); + bool isTypeSafe (const DSNode * N); + bool typeFieldsOverlap (const DSNode * N); + + // Pointers to prerequisite passes + TargetData * TD; + dsa * dsaPass; + + // Data structures + std::set TypeSafeNodes; + + public: + static char ID; + TypeSafety() : ModulePass((intptr_t)(&ID)) {} + virtual bool runOnModule (Module & M); + + const char *getPassName() const { + return "DSA Type-Safety Analysis"; + } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.addRequired(); + AU.setPreservesAll(); + } + + virtual void releaseMemory () { + TypeSafeNodes.clear(); + return; + } + + // Methods for clients to use + virtual bool isTypeSafe (const Value * V, const Function * F); +}; + +} +#endif + Added: poolalloc/trunk/lib/DSA/TypeSafety.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TypeSafety.cpp?rev=124808&view=auto ============================================================================== --- poolalloc/trunk/lib/DSA/TypeSafety.cpp (added) +++ poolalloc/trunk/lib/DSA/TypeSafety.cpp Thu Feb 3 13:32:54 2011 @@ -0,0 +1,281 @@ +//===- TypeSafety.cpp - Find type-safe pointers --------------------------- --// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass implements code that determines if memory objects are used in +// a type-consistent fashion. It is built using DSA and essentially abstracts +// away the details of interpreting DSNodes. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "type-safety" + +#include "dsa/TypeSafety.h" + +#include "llvm/ADT/Statistic.h" +#include "llvm/Module.h" + +static RegisterPass > +X ("typesafety", "Find type-safe pointers"); + +// Pass Statistics +namespace { + //STATISTIC (TypeSafeNodes, "Type-safe DSNodes"); +} + +namespace dsa { + +template +char TypeSafety::ID = 0; + +// Method: getDSNodeHandle() +// +// Description: +// This method looks up the DSNodeHandle for a given LLVM value. The context +// of the value is the specified function, although if it is a global value, +// the DSNodeHandle may exist within the global DSGraph. +// +// Return value: +// A DSNodeHandle for the value is returned. This DSNodeHandle could either +// be in the function's DSGraph or from the GlobalsGraph. Note that the +// DSNodeHandle may represent a NULL DSNode. +// +template DSNodeHandle +TypeSafety::getDSNodeHandle (const Value * V, const Function * F) { + // + // Ensure that the function has a DSGraph + // + assert (dsaPass->hasDSGraph(*F) && "No DSGraph for function!\n"); + + // + // Lookup the DSNode for the value in the function's DSGraph. + // + DSGraph * TDG = dsaPass->getDSGraph(*F); + DSNodeHandle DSH = TDG->getNodeForValue(V); + + // + // If the value wasn't found in the function's DSGraph, then maybe we can + // find the value in the globals graph. + // + if ((DSH.isNull()) && (isa(V))) { + // + // Try looking up this DSNode value in the globals graph. Note that + // globals are put into equivalence classes; we may need to first find the + // equivalence class to which our global belongs, find the global that + // represents all globals in that equivalence class, and then look up the + // DSNode Handle for *that* global. + // + DSGraph * GlobalsGraph = TDG->getGlobalsGraph (); + DSH = GlobalsGraph->getNodeForValue(V); + if (DSH.isNull()) { + // + // DSA does not currently handle global aliases. + // + if (!isa(V)) { + // + // We have to dig into the globalEC of the DSGraph to find the DSNode. + // + const GlobalValue * GV = dyn_cast(V); + const GlobalValue * Leader; + Leader = GlobalsGraph->getGlobalECs().getLeaderValue(GV); + DSH = GlobalsGraph->getNodeForValue(Leader); + } + } + } + + return DSH; +} + +template bool +TypeSafety::isTypeSafe (const Value * V, const Function * F) { + // + // Get the DSNode for the specified value. + // + DSNodeHandle DH = getDSNodeHandle (V, F); + + // + // If there is no DSNode, claim that it is not type safe. + // + if (DH.isNull()) + return false; + + // + // See if the DSNode is one that we think is type-safe. + // + if (TypeSafeNodes.count (DH.getNode())) + return true; + + return false; +} + +// +// Method: typeFieldsOverlap() +// +// Description: +// Determine if any of the type fields can overlap within the DSNode. +// +// Notes: +// o) We take advantage of the fact that a std::map keeps its elements sorted +// by key. +// +template bool +TypeSafety::typeFieldsOverlap (const DSNode * N) { + // + // There are no overlapping fields if the DSNode has no fields. + // + if (N->type_begin() == N->type_end()) + return false; + + // + // Iterate through the DSNode to see if the previous fields overlaps with the + // current field. + // + DSNode::const_type_iterator tn = N->type_begin(); + bool overlaps = false; + while (!overlaps) { + // + // Get the information about the current field. + // + unsigned offset = tn->first; + SuperSet::setPtr TypeSet = tn->second; + + // + // If this is the last field, then we are done searching. + // + if ((++tn) == N->type_end()) { + break; + } + + // + // Get the offset of the next field. + // + unsigned next_offset = tn->first; + + // + // Check to see if any of the types in the current field extend into the + // next field. + // + if (TypeSet) { + for (svset::const_iterator ni = TypeSet->begin(), + ne = TypeSet->end(); ni != ne; ++ni) { + unsigned field_length = TD->getTypeStoreSize (*ni); + if ((offset + field_length) > next_offset) { + overlaps = true; + break; + } + } + } + } + + // + // Return the result. + // + return overlaps; +} + +// +// Method: isTypeSafe() +// +// Description: +// Determine whether a DSNode represents a piece of memory that is accessed +// in a type-safe fasion. +// +// Inputs: +// N - A pointer to a DSNode representing the memory object. +// +// Return value: +// true - The memory object is used in a type-safe fasion. +// false - The memory object *may* be used in a type-unsafe fasion. +// +template bool +TypeSafety::isTypeSafe (const DSNode * N) { + // + // If the DSNode is completely folded, then we know for sure that it is not + // type-safe. + // + if (N->isNodeCompletelyFolded()) + return false; + + // + // If the memory object represented by this DSNode can be manipulated by + // external code or DSA has otherwise not finished analyzing all operations + // on it, declare it type-unsafe. + // + if (N->isExternalNode() || N->isIncompleteNode()) + return false; + + // + // If the pointer to the memory object came from some source not understood + // by DSA or somehow came from/escape to the realm of integers, declare it + // type-unsafe. + // + if (N->isUnknownNode() || N->isIntToPtrNode() || N->isPtrToIntNode()) { + return false; + } + + // + // Scan through all of the fields within the DSNode and see if any overlap. + // If they do, then the DSNode is not type-safe. + // + if (typeFieldsOverlap (N)) + return false; + + // + // We have run out of reasons for this DSNode to be type-unsafe. Declare it + // type-safe. + // + return true; +} + +// +// Method: findTypeSafeDSNodes() +// +// Description: +// Find and record all type-safe DSNodes. +// +// Inputs: +// Graph - The DSGraph for which we should search for type-safe nodes. +// +// Side-effects: +// Class level data structures are updated to record which DSNodes are +// type-safe. +// +template void +TypeSafety::findTypeSafeDSNodes (const DSGraph * Graph) { + DSGraph::node_const_iterator N = Graph->node_begin(); + DSGraph::node_const_iterator NE = Graph->node_end(); + for (; N != NE; ++N) { + if (isTypeSafe (N)) { + TypeSafeNodes.insert (&*N); + } + } +} + +template bool +TypeSafety::runOnModule(Module & M) { + // + // Get access to prerequisite passes. + // + TD = &getAnalysis(); + dsaPass = &getAnalysis(); + + // + // For every DSGraph, find which DSNodes are type-safe. + // + findTypeSafeDSNodes (dsaPass->getGlobalsGraph()); + for (Module::iterator F = M.begin(); F != M.end(); ++F) { + if (dsaPass->hasDSGraph (*F)) { + findTypeSafeDSNodes (dsaPass->getDSGraph (*F)); + } + } + + return false; +} + +} + From stoklund at 2pi.dk Thu Feb 3 14:29:36 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 20:29:36 -0000 Subject: [llvm-commits] [llvm] r124812 - /llvm/trunk/lib/CodeGen/SplitKit.cpp Message-ID: <20110203202936.CA36C2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 3 14:29:36 2011 New Revision: 124812 URL: http://llvm.org/viewvc/llvm-project?rev=124812&view=rev Log: Fix coloring bug when mapping values in the middle of a live-through block. If the found value is not live-through the block, we should only add liveness up to the requested slot index. When the value is live-through, the whole block should be colored. Bug found by SSA verification in the machine code verifier. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124812&r1=124811&r2=124812&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb 3 14:29:36 2011 @@ -607,14 +607,14 @@ for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) { MachineBasicBlock *MBB = LiveIn[i]->getBlock(); SlotIndex Start = LIS.getMBBStartIdx(MBB); - if (MBB == IdxMBB) { - LI->addRange(LiveRange(Start, Idx.getNextSlot(), IdxVNI)); - continue; - } - // Anything in LiveIn other than IdxMBB is live-through. VNInfo *VNI = LiveOutCache.lookup(MBB).first; - assert(VNI && "Missing block value"); - LI->addRange(LiveRange(Start, LIS.getMBBEndIdx(MBB), VNI)); + + // Anything in LiveIn other than IdxMBB is live-through. + // In IdxMBB, we should stop at Idx unless the same value is live-out. + if (MBB == IdxMBB && IdxVNI != VNI) + LI->addRange(LiveRange(Start, Idx.getNextSlot(), IdxVNI)); + else + LI->addRange(LiveRange(Start, LIS.getMBBEndIdx(MBB), VNI)); } return IdxVNI; From stoklund at 2pi.dk Thu Feb 3 14:29:39 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 20:29:39 -0000 Subject: [llvm-commits] [llvm] r124813 - /llvm/trunk/lib/CodeGen/SplitKit.cpp Message-ID: <20110203202939.58F492A6C12D@llvm.org> Author: stoklund Date: Thu Feb 3 14:29:39 2011 New Revision: 124813 URL: http://llvm.org/viewvc/llvm-project?rev=124813&view=rev Log: Add debug output and asserts to the phi-connecting code. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124813&r1=124812&r2=124813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb 3 14:29:39 2011 @@ -978,16 +978,27 @@ const VNInfo *PHIVNI = *I; if (!PHIVNI->isPHIDef()) continue; - LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(PHIVNI->def)]; + unsigned RegIdx = RegAssign.lookup(PHIVNI->def); + LiveIntervalMap &LIM = LIMappers[RegIdx]; MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); + DEBUG(dbgs() << " map phi in BB#" << MBB->getNumber() << '@' << PHIVNI->def + << " -> " << RegIdx << '\n'); for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), PE = MBB->pred_end(); PI != PE; ++PI) { SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); + DEBUG(dbgs() << " pred BB#" << (*PI)->getNumber() << '@' << End); // The predecessor may not have a live-out value. That is OK, like an // undef PHI operand. - if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) + if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) { + DEBUG(dbgs() << " has parent valno #" << VNI->id << " live out\n"); + assert(RegAssign.lookup(End) == RegIdx && + "Different register assignment in phi predecessor"); LIM.mapValue(VNI, End); + } + else + DEBUG(dbgs() << " is not live-out\n"); } + DEBUG(dbgs() << " " << *LIM.getLI() << '\n'); } // Rewrite instructions. From stoklund at 2pi.dk Thu Feb 3 14:29:41 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 20:29:41 -0000 Subject: [llvm-commits] [llvm] r124814 - /llvm/trunk/lib/CodeGen/SlotIndexes.cpp Message-ID: <20110203202941.A87F62A6C12E@llvm.org> Author: stoklund Date: Thu Feb 3 14:29:41 2011 New Revision: 124814 URL: http://llvm.org/viewvc/llvm-project?rev=124814&view=rev Log: Tweak debug output from SlotIndexes. Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=124814&r1=124813&r2=124814&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Thu Feb 3 14:29:41 2011 @@ -158,6 +158,7 @@ // resulting numbering will match what would have been generated by the // pass during the initial numbering of the function if the new instructions // had been present. + DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n"); functionSize = 0; unsigned index = 0; @@ -203,7 +204,10 @@ // Print a SlotIndex to a raw_ostream. void SlotIndex::print(raw_ostream &os) const { - os << entry().getIndex() << "LudS"[getSlot()]; + if (isValid()) + os << entry().getIndex() << "LudS"[getSlot()]; + else + os << "invalid"; } // Dump a SlotIndex to stderr. From stoklund at 2pi.dk Thu Feb 3 14:29:44 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 03 Feb 2011 20:29:44 -0000 Subject: [llvm-commits] [llvm] r124815 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110203202944.22D542A6C12C@llvm.org> Author: stoklund Date: Thu Feb 3 14:29:43 2011 New Revision: 124815 URL: http://llvm.org/viewvc/llvm-project?rev=124815&view=rev Log: Ensure that the computed interference intervals actually overlap their basic blocks. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124815&r1=124814&r2=124815&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 3 14:29:43 2011 @@ -626,6 +626,8 @@ IntI.advanceTo(Start); if (!IntI.valid()) break; + if (IntI.start() >= Stop) + continue; if (!IP.first.isValid() || IntI.start() < IP.first) IP.first = IntI.start(); } @@ -635,6 +637,8 @@ IntI.advanceTo(Stop); if (!IntI.valid() || IntI.start() >= Stop) --IntI; + if (IntI.stop() <= Start) + continue; if (!IP.second.isValid() || IntI.stop() > IP.second) IP.second = IntI.stop(); } @@ -663,10 +667,15 @@ tie(Start, Stop) = Indexes->getMBBRange(BI.MBB); DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " -> EB#" - << Bundles->getBundle(BI.MBB->getNumber(), 1)); + << Bundles->getBundle(BI.MBB->getNumber(), 1) + << " intf [" << IP.first << ';' << IP.second << ')'); + + // The interference interval should either be invalid or overlap MBB. + assert((!IP.first.isValid() || IP.first < Stop) && "Bad interference"); + assert((!IP.second.isValid() || IP.second > Start) && "Bad interference"); // Check interference leaving the block. - if (!IP.second.isValid() || IP.second < Start) { + if (!IP.second.isValid()) { // Block is interference-free. DEBUG(dbgs() << ", no interference"); if (!BI.Uses) { @@ -739,7 +748,7 @@ << " -> BB#" << BI.MBB->getNumber()); // Check interference entering the block. - if (!IP.first.isValid() || IP.first > Stop) { + if (!IP.first.isValid()) { // Block is interference-free. DEBUG(dbgs() << ", no interference"); if (!BI.Uses) { From dmalyshev at accesssoftek.com Thu Feb 3 14:38:08 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Thu, 3 Feb 2011 12:38:08 -0800 Subject: [llvm-commits] Quotation marks around command line arguments In-Reply-To: Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA1B@mail.accesssoftek.com> Hello everyone, While waiting, I have re-worked the patch to do the minimal essential quoting. Hope this will help it to go through quicker. Please review the attached patch. It has been tested with XP and Windows7. Thank you, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/16806292/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: quotation02.patch Type: application/octet-stream Size: 500 bytes Desc: quotation02.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/16806292/attachment.obj From ofv at wanadoo.es Thu Feb 3 14:57:36 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 03 Feb 2011 20:57:36 -0000 Subject: [llvm-commits] [llvm] r124816 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake cmake/modules/LLVM.cmake cmake/modules/TableGen.cmake utils/TableGen/CMakeLists.txt Message-ID: <20110203205736.794452A6C12C@llvm.org> Author: ofv Date: Thu Feb 3 14:57:36 2011 New Revision: 124816 URL: http://llvm.org/viewvc/llvm-project?rev=124816&view=rev Log: Changes for building Clang and others using LLVM as an external library. Installs tblgen (required by Clang). Translates handling of user settings and platform-dependant options to its own file, where it can included by another project. Installs the .cmake files required by projects like Clang. Added: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/config-ix.cmake llvm/trunk/cmake/modules/CMakeLists.txt llvm/trunk/cmake/modules/LLVM.cmake llvm/trunk/cmake/modules/TableGen.cmake llvm/trunk/utils/TableGen/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Feb 3 14:57:36 2011 @@ -133,28 +133,6 @@ option(LLVM_ENABLE_THREADS "Use threads if available." ON) -if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) - option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) -else() - option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) -endif() - -if( LLVM_ENABLE_ASSERTIONS ) - # MSVC doesn't like _DEBUG on release builds. See PR 4379. - if( NOT MSVC ) - add_definitions( -D_DEBUG ) - endif() - # On Release builds cmake automatically defines NDEBUG, so we - # explicitly undefine it: - if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) - add_definitions( -UNDEBUG ) - endif() -else() - if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) - add_definitions( -DNDEBUG ) - endif() -endif() - if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) endif() @@ -180,68 +158,34 @@ include(AddLLVMDefinitions) -if(WIN32) - if(CYGWIN) - set(LLVM_ON_WIN32 0) - set(LLVM_ON_UNIX 1) - else(CYGWIN) - set(LLVM_ON_WIN32 1) - set(LLVM_ON_UNIX 0) - endif(CYGWIN) - set(LTDL_SHLIB_EXT ".dll") - set(EXEEXT ".exe") - # Maximum path length is 160 for non-unicode paths - set(MAXPATHLEN 160) -else(WIN32) - if(UNIX) - set(LLVM_ON_WIN32 0) - set(LLVM_ON_UNIX 1) - if(APPLE) - set(LTDL_SHLIB_EXT ".dylib") - else(APPLE) - set(LTDL_SHLIB_EXT ".so") - endif(APPLE) - set(EXEEXT "") - # FIXME: Maximum path length is currently set to 'safe' fixed value - set(MAXPATHLEN 2024) - else(UNIX) - MESSAGE(SEND_ERROR "Unable to determine platform") - endif(UNIX) -endif(WIN32) - option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) -if( LLVM_ENABLE_PIC ) - if( XCODE ) - # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't - # know how to disable this, so just force ENABLE_PIC off for now. - message(WARNING "-fPIC not supported with Xcode.") - elseif( WIN32 ) - # On Windows all code is PIC. MinGW warns if -fPIC is used. - else() - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG) - if( SUPPORTS_FPIC_FLAG ) - message(STATUS "Building with -fPIC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - else( SUPPORTS_FPIC_FLAG ) - message(WARNING "-fPIC not supported.") - endif() - endif() +include(config-ix) + +include(HandleLLVMOptions) + +if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) + option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) +else() + option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) endif() -include(config-ix) +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Config/config.h) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) -# set(CMAKE_VERBOSE_MAKEFILE true) - -add_llvm_definitions( -D__STDC_LIMIT_MACROS ) -add_llvm_definitions( -D__STDC_CONSTANT_MACROS ) - # MSVC has a gazillion warnings with this. if( MSVC ) option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) @@ -252,71 +196,6 @@ option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) -if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) - # TODO: support other platforms and toolchains. - option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) - if( LLVM_BUILD_32_BITS ) - message(STATUS "Building 32 bits executables and libraries.") - add_llvm_definitions( -m32 ) - list(APPEND CMAKE_EXE_LINKER_FLAGS -m32) - list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32) - endif( LLVM_BUILD_32_BITS ) -endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) - -if( MSVC ) - include(ChooseMSVCCRT) - - # Add definitions that make MSVC much less annoying. - add_llvm_definitions( - # For some reason MS wants to deprecate a bunch of standard functions... - -D_CRT_SECURE_NO_DEPRECATE - -D_CRT_SECURE_NO_WARNINGS - -D_CRT_NONSTDC_NO_DEPRECATE - -D_CRT_NONSTDC_NO_WARNINGS - -D_SCL_SECURE_NO_DEPRECATE - -D_SCL_SECURE_NO_WARNINGS - - -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' - -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored' - -wd4224 # Suppress 'nonstandard extension used : formal parameter 'identifier' was previously defined as a type' - -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data' - -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data' - -wd4275 # Suppress 'An exported class was derived from a class that was not exported.' - -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception' - -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized' - -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized' - -wd4355 # Suppress ''this' : used in base member initializer list' - -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated' - -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible' - -wd4715 # Suppress ''function' : not all control paths return a value' - -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)' - -wd4065 # Suppress 'switch statement contains 'default' but no 'case' labels' - - -w14062 # Promote "enumerator in switch of enum is not handled" to level 1 warning. - ) - - # Enable warnings - if (LLVM_ENABLE_WARNINGS) - add_llvm_definitions( /W4 /Wall ) - if (LLVM_ENABLE_PEDANTIC) - # No MSVC equivalent available - endif (LLVM_ENABLE_PEDANTIC) - endif (LLVM_ENABLE_WARNINGS) - if (LLVM_ENABLE_WERROR) - add_llvm_definitions( /WX ) - endif (LLVM_ENABLE_WERROR) -elseif( CMAKE_COMPILER_IS_GNUCXX ) - if (LLVM_ENABLE_WARNINGS) - add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings ) - if (LLVM_ENABLE_PEDANTIC) - add_llvm_definitions( -pedantic -Wno-long-long ) - endif (LLVM_ENABLE_PEDANTIC) - endif (LLVM_ENABLE_WARNINGS) - if (LLVM_ENABLE_WERROR) - add_llvm_definitions( -Werror ) - endif (LLVM_ENABLE_WERROR) -endif( MSVC ) - include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Thu Feb 3 14:57:36 2011 @@ -357,19 +357,3 @@ endif() set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX}) - -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake - ${LLVM_BINARY_DIR}/include/llvm/Config/config.h - ) - -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake - ${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h - ) - -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake - ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h - ) - Modified: llvm/trunk/cmake/modules/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/cmake/modules/CMakeLists.txt (original) +++ llvm/trunk/cmake/modules/CMakeLists.txt Thu Feb 3 14:57:36 2011 @@ -10,3 +10,20 @@ LLVMConfig.cmake LLVMLibDeps.cmake DESTINATION share/llvm/cmake) + +install(DIRECTORY . + DESTINATION share/llvm/cmake + PATTERN *.cmake + PATTERN LLVM.cmake EXCLUDE + PATTERN LLVMConfig.cmake EXCLUDE + PATTERN LLVMLibDeps.cmake EXCLUDE + PATTERN FindBison.cmake EXCLUDE + PATTERN GetTargetTriple.cmake EXCLUDE + PATTERN VersionFromVCS.cmake EXCLUDE + PATTERN CheckAtomic.cmake EXCLUDE) + +install(FILES + ${llvm_cmake_builddir}/LLVM.cmake + LLVMConfig.cmake + LLVMLibDeps.cmake + DESTINATION share/llvm/cmake) Added: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=124816&view=auto ============================================================================== --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (added) +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Feb 3 14:57:36 2011 @@ -0,0 +1,135 @@ +include(AddLLVMDefinitions) + +if( LLVM_ENABLE_ASSERTIONS ) + # MSVC doesn't like _DEBUG on release builds. See PR 4379. + if( NOT MSVC ) + add_definitions( -D_DEBUG ) + endif() + # On Release builds cmake automatically defines NDEBUG, so we + # explicitly undefine it: + if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) + add_definitions( -UNDEBUG ) + endif() +else() + if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) + add_definitions( -DNDEBUG ) + endif() +endif() + +if(WIN32) + if(CYGWIN) + set(LLVM_ON_WIN32 0) + set(LLVM_ON_UNIX 1) + else(CYGWIN) + set(LLVM_ON_WIN32 1) + set(LLVM_ON_UNIX 0) + endif(CYGWIN) + set(LTDL_SHLIB_EXT ".dll") + set(EXEEXT ".exe") + # Maximum path length is 160 for non-unicode paths + set(MAXPATHLEN 160) +else(WIN32) + if(UNIX) + set(LLVM_ON_WIN32 0) + set(LLVM_ON_UNIX 1) + if(APPLE) + set(LTDL_SHLIB_EXT ".dylib") + else(APPLE) + set(LTDL_SHLIB_EXT ".so") + endif(APPLE) + set(EXEEXT "") + # FIXME: Maximum path length is currently set to 'safe' fixed value + set(MAXPATHLEN 2024) + else(UNIX) + MESSAGE(SEND_ERROR "Unable to determine platform") + endif(UNIX) +endif(WIN32) + +if( LLVM_ENABLE_PIC ) + if( XCODE ) + # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't + # know how to disable this, so just force ENABLE_PIC off for now. + message(WARNING "-fPIC not supported with Xcode.") + elseif( WIN32 ) + # On Windows all code is PIC. MinGW warns if -fPIC is used. + else() + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG) + if( SUPPORTS_FPIC_FLAG ) + message(STATUS "Building with -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + else( SUPPORTS_FPIC_FLAG ) + message(WARNING "-fPIC not supported.") + endif() + endif() +endif() + +if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) + # TODO: support other platforms and toolchains. + option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) + if( LLVM_BUILD_32_BITS ) + message(STATUS "Building 32 bits executables and libraries.") + add_llvm_definitions( -m32 ) + list(APPEND CMAKE_EXE_LINKER_FLAGS -m32) + list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32) + endif( LLVM_BUILD_32_BITS ) +endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) + +if( MSVC ) + include(ChooseMSVCCRT) + + # Add definitions that make MSVC much less annoying. + add_llvm_definitions( + # For some reason MS wants to deprecate a bunch of standard functions... + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_NONSTDC_NO_WARNINGS + -D_SCL_SECURE_NO_DEPRECATE + -D_SCL_SECURE_NO_WARNINGS + + -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' + -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored' + -wd4224 # Suppress 'nonstandard extension used : formal parameter 'identifier' was previously defined as a type' + -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data' + -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data' + -wd4275 # Suppress 'An exported class was derived from a class that was not exported.' + -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception' + -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized' + -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized' + -wd4355 # Suppress ''this' : used in base member initializer list' + -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated' + -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible' + -wd4715 # Suppress ''function' : not all control paths return a value' + -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)' + -wd4065 # Suppress 'switch statement contains 'default' but no 'case' labels' + + -w14062 # Promote "enumerator in switch of enum is not handled" to level 1 warning. + ) + + # Enable warnings + if (LLVM_ENABLE_WARNINGS) + add_llvm_definitions( /W4 /Wall ) + if (LLVM_ENABLE_PEDANTIC) + # No MSVC equivalent available + endif (LLVM_ENABLE_PEDANTIC) + endif (LLVM_ENABLE_WARNINGS) + if (LLVM_ENABLE_WERROR) + add_llvm_definitions( /WX ) + endif (LLVM_ENABLE_WERROR) +elseif( CMAKE_COMPILER_IS_GNUCXX ) + if (LLVM_ENABLE_WARNINGS) + add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings ) + if (LLVM_ENABLE_PEDANTIC) + add_llvm_definitions( -pedantic -Wno-long-long ) + endif (LLVM_ENABLE_PEDANTIC) + endif (LLVM_ENABLE_WARNINGS) + if (LLVM_ENABLE_WERROR) + add_llvm_definitions( -Werror ) + endif (LLVM_ENABLE_WERROR) +endif( MSVC ) + +add_llvm_definitions( -D__STDC_LIMIT_MACROS ) +add_llvm_definitions( -D__STDC_CONSTANT_MACROS ) + Modified: llvm/trunk/cmake/modules/LLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM.cmake?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVM.cmake (original) +++ llvm/trunk/cmake/modules/LLVM.cmake Thu Feb 3 14:57:36 2011 @@ -1,5 +1,7 @@ # This file provides information and services to the final user. +set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@) + set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@) set(llvm_libs @llvm_libs@) @@ -16,6 +18,13 @@ set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@) +set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@) + +set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS) + +set(HAVE_LIBDL @HAVE_LIBDL@) +set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD) + # We try to include using the current setting of CMAKE_MODULE_PATH, # which suppossedly was filled by the user with the directory where # this file was installed: Modified: llvm/trunk/cmake/modules/TableGen.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/cmake/modules/TableGen.cmake (original) +++ llvm/trunk/cmake/modules/TableGen.cmake Thu Feb 3 14:57:36 2011 @@ -21,7 +21,8 @@ # The file in LLVM_TARGET_DEFINITIONS may be not in the current # directory and local_tds may not contain it, so we must # explicitly list it here: - DEPENDS tblgen ${local_tds} ${global_tds} ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} + DEPENDS ${LLVM_TABLEGEN_EXE} ${local_tds} ${global_tds} + ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} COMMENT "Building ${ofn}..." ) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} Modified: llvm/trunk/utils/TableGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CMakeLists.txt?rev=124816&r1=124815&r2=124816&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CMakeLists.txt (original) +++ llvm/trunk/utils/TableGen/CMakeLists.txt Thu Feb 3 14:57:36 2011 @@ -1,6 +1,8 @@ set(LLVM_REQUIRES_EH 1) set(LLVM_REQUIRES_RTTI 1) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR}) + add_executable(tblgen ARMDecoderEmitter.cpp AsmMatcherEmitter.cpp @@ -48,3 +50,5 @@ if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD AND NOT BEOS ) target_link_libraries(tblgen pthread) endif() + +install(TARGETS tblgen RUNTIME DESTINATION bin) From dmalyshev at accesssoftek.com Thu Feb 3 15:29:30 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Thu, 3 Feb 2011 13:29:30 -0800 Subject: [llvm-commits] Fix floating point numbers in tests on MinGW In-Reply-To: Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> Hello everyone, I think I have found a better way to address the "Bug 6745 - .ll output is different on windows" problem. The tests always expect 2 digits exponent, which is wrong for Windows. So let's force it to be that way by defining PRINTF_EXPONENT_DIGITS environment variable = 2. See http://sourceforge.net/project/shownotes.php?release_id=24832 for more details. Please review the attached patch. The patch has been tested with WinXP, Win7, and Ubuntu. Thank you, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/edaea05f/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: fix-scientific-02.diff Type: application/octet-stream Size: 519 bytes Desc: fix-scientific-02.diff Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110203/edaea05f/attachment.obj From bob.wilson at apple.com Thu Feb 3 15:46:10 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 03 Feb 2011 21:46:10 -0000 Subject: [llvm-commits] [llvm] r124819 - in /llvm/trunk/lib/Target: ARM/AsmParser/ARMAsmParser.cpp MBlaze/AsmParser/MBlazeAsmParser.cpp Message-ID: <20110203214610.EDFFA2A6C12C@llvm.org> Author: bwilson Date: Thu Feb 3 15:46:10 2011 New Revision: 124819 URL: http://llvm.org/viewvc/llvm-project?rev=124819&view=rev Log: Fix 80-column violations and whitespace. Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=124819&r1=124818&r2=124819&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Feb 3 15:46:10 2011 @@ -550,7 +550,8 @@ /// } -bool ARMAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) { +bool ARMAsmParser::ParseRegister(unsigned &RegNo, + SMLoc &StartLoc, SMLoc &EndLoc) { RegNo = TryParseRegister(); return (RegNo == (unsigned)-1); @@ -578,12 +579,11 @@ .Default(0); } if (!RegNum) return -1; - + Parser.Lex(); // Eat identifier token. return RegNum; } - /// Try to parse a register name. The token must be an Identifier when called. /// If it's a register, an AsmOperand is created. Another AsmOperand is created /// if there is a "writeback". 'true' if it's not a register. Modified: llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp?rev=124819&r1=124818&r2=124819&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp (original) +++ llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp Thu Feb 3 15:46:10 2011 @@ -386,7 +386,8 @@ return Op; } -bool MBlazeAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) { +bool MBlazeAsmParser::ParseRegister(unsigned &RegNo, + SMLoc &StartLoc, SMLoc &EndLoc) { return (ParseRegister(RegNo) == 0); } From grosser at fim.uni-passau.de Thu Feb 3 16:02:50 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Thu, 03 Feb 2011 17:02:50 -0500 Subject: [llvm-commits] [llvm] r124816 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake cmake/modules/LLVM.cmake cmake/modules/TableGen.cmake utils/TableGen/CMakeLists.txt In-Reply-To: <20110203205736.794452A6C12C@llvm.org> References: <20110203205736.794452A6C12C@llvm.org> Message-ID: <4D4B260A.9000904@fim.uni-passau.de> On 02/03/2011 03:57 PM, Oscar Fuentes wrote: > Author: ofv > Date: Thu Feb 3 14:57:36 2011 > New Revision: 124816 > > URL: http://llvm.org/viewvc/llvm-project?rev=124816&view=rev > Log: > Changes for building Clang and others using LLVM as an external > library. > > Installs tblgen (required by Clang). > > Translates handling of user settings and platform-dependant options to > its own file, where it can included by another project. > > Installs the .cmake files required by projects like Clang. Will those files only be installed if LLVM was built using cmake or also if autoconf is used? Tobi From rafael.espindola at gmail.com Thu Feb 3 16:01:15 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 03 Feb 2011 22:01:15 -0000 Subject: [llvm-commits] [llvm] r124821 - /llvm/trunk/Makefile.rules Message-ID: <20110203220115.C69D72A6C12C@llvm.org> Author: rafael Date: Thu Feb 3 16:01:15 2011 New Revision: 124821 URL: http://llvm.org/viewvc/llvm-project?rev=124821&view=rev Log: Factor the computation of the basename of libraries. This avoids renaming them on install. Before we would have LLVMgold.so on the build directory but libLLVMgold.so on the install dir. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=124821&r1=124820&r2=124821&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 3 16:01:15 2011 @@ -1083,12 +1083,14 @@ # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) ifdef LOADABLE_MODULE -LibName.A := $(LibDir)/$(LIBRARYNAME).a -LibName.SO := $(SharedLibDir)/$(LIBRARYNAME)$(SHLIBEXT) +BaseLibName.A := $(LIBRARYNAME).a +BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT) else -LibName.A := $(LibDir)/lib$(LIBRARYNAME).a -LibName.SO := $(SharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) +BaseLibName.A := lib$(LIBRARYNAME).a +BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) endif +LibName.A := $(LibDir)/$(BaseLibName.A) +LibName.SO := $(SharedLibDir)/$(BaseLibName.SO) LibName.O := $(LibDir)/$(LIBRARYNAME).o LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca @@ -1142,7 +1144,7 @@ else DestSharedLibDir := $(DESTDIR)$(PROJ_libdir) endif -DestSharedLib := $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) +DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO) install-local:: $(DestSharedLib) From ofv at wanadoo.es Thu Feb 3 16:20:32 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Thu, 03 Feb 2011 23:20:32 +0100 Subject: [llvm-commits] [llvm] r124816 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake cmake/modules/LLVM.cmake cmake/modules/TableGen.cmake utils/TableGen/CMakeLists.txt In-Reply-To: <4D4B260A.9000904@fim.uni-passau.de> (Tobias Grosser's message of "Thu, 03 Feb 2011 17:02:50 -0500") References: <20110203205736.794452A6C12C@llvm.org> <4D4B260A.9000904@fim.uni-passau.de> Message-ID: <87ei7oep5b.fsf@wanadoo.es> Tobias Grosser writes: >> Installs tblgen (required by Clang). >> >> Translates handling of user settings and platform-dependant options to >> its own file, where it can included by another project. >> >> Installs the .cmake files required by projects like Clang. > > Will those files only be installed if LLVM was built using cmake or > also if autoconf is used? Only when you use cmake for building&installing LLVM. From ofv at wanadoo.es Thu Feb 3 16:47:59 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 03 Feb 2011 22:47:59 -0000 Subject: [llvm-commits] [llvm] r124824 - in /llvm/trunk: CMakeLists.txt include/llvm/Config/config.h.cmake Message-ID: <20110203224759.BC65A2A6C12C@llvm.org> Author: ofv Date: Thu Feb 3 16:47:59 2011 New Revision: 124824 URL: http://llvm.org/viewvc/llvm-project?rev=124824&view=rev Log: Moved to Clang's source tree its configuration options and associated macros. Modified: llvm/trunk/CMakeLists.txt llvm/trunk/include/llvm/Config/config.h.cmake Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=124824&r1=124823&r2=124824&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Feb 3 16:47:59 2011 @@ -101,9 +101,6 @@ CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") endif( MSVC ) -set(CLANG_RESOURCE_DIR "" CACHE STRING - "Relative directory from the Clang binary to its resource files.") - option(LLVM_ENABLE_CBE_PRINTF_A "Set to ON if CBE is enabled for printf %a output" ON) if(LLVM_ENABLE_CBE_PRINTF_A) set(ENABLE_CBE_PRINTF_A 1) @@ -118,9 +115,6 @@ set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so") set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h") -set(C_INCLUDE_DIRS "" CACHE STRING - "Colon separated list of directories clang will search for headers.") - set(LLVM_TARGET_ARCH "host" CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.") Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=124824&r1=124823&r2=124824&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Thu Feb 3 16:47:59 2011 @@ -5,24 +5,6 @@ #ifndef CONFIG_H #define CONFIG_H -/* Relative directory for resource files */ -#define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}" - -/* 32 bit multilib directory. */ -#define CXX_INCLUDE_32BIT_DIR "${CXX_INCLUDE_32BIT_DIR}" - -/* 64 bit multilib directory. */ -#define CXX_INCLUDE_64BIT_DIR "${CXX_INCLUDE_64BIT_DIR}" - -/* Arch the libstdc++ headers. */ -#define CXX_INCLUDE_ARCH "${CXX_INCLUDE_ARCH}" - -/* Directory with the libstdc++ headers. */ -#define CXX_INCLUDE_ROOT "${CXX_INCLUDE_ROOT}" - -/* Directories clang will search for headers */ -#define C_INCLUDE_DIRS "${C_INCLUDE_DIRS}" - /* Define if CBE is enabled for printf %a output */ #cmakedefine ENABLE_CBE_PRINTF_A ${ENABLE_CBE_PRINTF_A} From benny.kra at googlemail.com Thu Feb 3 16:51:41 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Thu, 03 Feb 2011 22:51:41 -0000 Subject: [llvm-commits] [llvm] r124826 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch-to-icmp.ll Message-ID: <20110203225141.ABC872A6C12C@llvm.org> Author: d0k Date: Thu Feb 3 16:51:41 2011 New Revision: 124826 URL: http://llvm.org/viewvc/llvm-project?rev=124826&view=rev Log: SimplifyCFG: Also transform switches that represent a range comparison but are not sorted into sub+icmp. This transforms another 1000 switches in gcc.c. Added: llvm/trunk/test/Transforms/SimplifyCFG/switch-to-icmp.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=124826&r1=124825&r2=124826&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 3 16:51:41 2011 @@ -2241,14 +2241,25 @@ /// integer range comparison into a sub, an icmp and a branch. static bool TurnSwitchRangeIntoICmp(SwitchInst *SI) { assert(SI->getNumCases() > 2 && "Degenerate switch?"); - // We can do this transform if the switch consists of an ascending series - // and all cases point to the same destination. - for (unsigned I = 2, E = SI->getNumCases(); I != E; ++I) - if (SI->getSuccessor(I-1) != SI->getSuccessor(I) || - SI->getCaseValue(I-1)->getValue()+1 != SI->getCaseValue(I)->getValue()) + + // Make sure all cases point to the same destination and gather the values. + SmallVector Cases; + Cases.push_back(SI->getCaseValue(1)); + for (unsigned I = 2, E = SI->getNumCases(); I != E; ++I) { + if (SI->getSuccessor(I-1) != SI->getSuccessor(I)) return false; + Cases.push_back(SI->getCaseValue(I)); + } + assert(Cases.size() == SI->getNumCases()-1 && "Not all cases gathered"); + + // Sort the case values, then check if they form a range we can transform. + array_pod_sort(Cases.begin(), Cases.end(), ConstantIntSortPredicate); + for (unsigned I = 1, E = Cases.size(); I != E; ++I) { + if (Cases[I-1]->getValue() != Cases[I]->getValue()+1) + return false; + } - Constant *Offset = ConstantExpr::getNeg(SI->getCaseValue(1)); + Constant *Offset = ConstantExpr::getNeg(Cases.back()); Constant *NumCases = ConstantInt::get(Offset->getType(), SI->getNumCases()-1); Value *Sub = BinaryOperator::CreateAdd(SI->getCondition(), Offset, "off", SI); Added: llvm/trunk/test/Transforms/SimplifyCFG/switch-to-icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch-to-icmp.ll?rev=124826&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/switch-to-icmp.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/switch-to-icmp.ll Thu Feb 3 16:51:41 2011 @@ -0,0 +1,40 @@ +; RUN: opt -S -simplifycfg < %s | FileCheck %s + +define zeroext i1 @test1(i32 %x) nounwind readnone ssp noredzone { +entry: + switch i32 %x, label %lor.rhs [ + i32 2, label %lor.end + i32 1, label %lor.end + i32 3, label %lor.end + ] + +lor.rhs: + br label %lor.end + +lor.end: + %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ] + ret i1 %0 + +; CHECK: @test1 +; CHECK: %off = add i32 %x, -1 +; CHECK: %switch = icmp ult i32 %off, 3 +} + +define zeroext i1 @test2(i32 %x) nounwind readnone ssp noredzone { +entry: + switch i32 %x, label %lor.rhs [ + i32 0, label %lor.end + i32 1, label %lor.end + ] + +lor.rhs: + br label %lor.end + +lor.end: + %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ] + ret i1 %0 + +; CHECK: @test2 +; CHECK: %off = add i32 %x, 0 +; CHECK: %switch = icmp ult i32 %off, 2 +} From atrick at apple.com Thu Feb 3 17:00:17 2011 From: atrick at apple.com (Andrew Trick) Date: Thu, 03 Feb 2011 23:00:17 -0000 Subject: [llvm-commits] [llvm] r124827 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Message-ID: <20110203230017.D5C9F2A6C12C@llvm.org> Author: atrick Date: Thu Feb 3 17:00:17 2011 New Revision: 124827 URL: http://llvm.org/viewvc/llvm-project?rev=124827&view=rev Log: whitespace Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=124827&r1=124826&r2=124827&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Thu Feb 3 17:00:17 2011 @@ -86,7 +86,7 @@ /// a specified operand is a physical register dependency. If so, returns the /// register and the cost of copying the register. static void CheckForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op, - const TargetRegisterInfo *TRI, + const TargetRegisterInfo *TRI, const TargetInstrInfo *TII, unsigned &PhysReg, int &Cost) { if (Op != 2 || User->getOpcode() != ISD::CopyToReg) @@ -266,33 +266,33 @@ // FIXME: Multiply by 2 because we may clone nodes during scheduling. // This is a temporary workaround. SUnits.reserve(NumNodes * 2); - + // Add all nodes in depth first order. SmallVector Worklist; SmallPtrSet Visited; Worklist.push_back(DAG->getRoot().getNode()); Visited.insert(DAG->getRoot().getNode()); - + while (!Worklist.empty()) { SDNode *NI = Worklist.pop_back_val(); - + // Add all operands to the worklist unless they've already been added. for (unsigned i = 0, e = NI->getNumOperands(); i != e; ++i) if (Visited.insert(NI->getOperand(i).getNode())) Worklist.push_back(NI->getOperand(i).getNode()); - + if (isPassiveNode(NI)) // Leaf node, e.g. a TargetImmediate. continue; - + // If this node has already been processed, stop now. if (NI->getNodeId() != -1) continue; - + SUnit *NodeSUnit = NewSUnit(NI); - + // See if anything is glued to this node, if so, add them to glued // nodes. Nodes can have at most one glue input and one glue output. Glue // is required to be the last operand and result of a node. - + // Scan up to find glued preds. SDNode *N = NI; while (N->getNumOperands() && @@ -303,15 +303,15 @@ if (N->isMachineOpcode() && TII->get(N->getMachineOpcode()).isCall()) NodeSUnit->isCall = true; } - + // Scan down to find any glued succs. N = NI; while (N->getValueType(N->getNumValues()-1) == MVT::Glue) { SDValue GlueVal(N, N->getNumValues()-1); - + // There are either zero or one users of the Glue result. bool HasGlueUse = false; - for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end(); + for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end(); UI != E; ++UI) if (GlueVal.isOperandOf(*UI)) { HasGlueUse = true; @@ -324,7 +324,7 @@ } if (!HasGlueUse) break; } - + // If there are glue operands involved, N is now the bottom-most node // of the sequence of nodes that are glued together. // Update the SUnit. @@ -347,7 +347,7 @@ for (unsigned su = 0, e = SUnits.size(); su != e; ++su) { SUnit *SU = &SUnits[su]; SDNode *MainNode = SU->getNode(); - + if (MainNode->isMachineOpcode()) { unsigned Opc = MainNode->getMachineOpcode(); const TargetInstrDesc &TID = TII->get(Opc); @@ -360,7 +360,7 @@ if (TID.isCommutable()) SU->isCommutable = true; } - + // Find all predecessors and successors of the group. for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) { if (N->isMachineOpcode() && @@ -372,7 +372,7 @@ if (NumUsed > TII->get(N->getMachineOpcode()).getNumDefs()) SU->hasPhysRegDefs = true; } - + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { SDNode *OpN = N->getOperand(i).getNode(); if (isPassiveNode(OpN)) continue; // Not scheduled. @@ -437,7 +437,7 @@ SU->Latency = 1; return; } - + // Compute the latency for the node. We use the sum of the latencies for // all nodes glued together into this SUnit. SU->Latency = 0; @@ -502,7 +502,7 @@ } /// ProcessSDDbgValues - Process SDDbgValues assoicated with this node. -static void ProcessSDDbgValues(SDNode *N, SelectionDAG *DAG, +static void ProcessSDDbgValues(SDNode *N, SelectionDAG *DAG, InstrEmitter &Emitter, SmallVector, 32> &Orders, DenseMap &VRBaseMap, From benny.kra at googlemail.com Thu Feb 3 17:05:32 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 4 Feb 2011 00:05:32 +0100 Subject: [llvm-commits] [llvm] r124724 - in /llvm/trunk: lib/Target/README.txt lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll test/Transforms/SimplifyCFG/switch_formation.dbg.ll In-Reply-To: References: <20110202155622.9F92F2A6C12C@llvm.org> Message-ID: On 02.02.2011, at 21:11, Frits van Bommel wrote: > On Wed, Feb 2, 2011 at 4:56 PM, Benjamin Kramer > wrote: >> +/// TurnSwitchRangeIntoICmp - Turns a switch with that contains only a >> +/// integer range comparison into a sub, an icmp and a branch. >> +static bool TurnSwitchRangeIntoICmp(SwitchInst *SI) { >> + assert(SI->getNumCases() > 2 && "Degenerate switch?"); >> + // We can do this transform if the switch consists of an ascending series >> + // and all cases point to the same destination. >> + for (unsigned I = 2, E = SI->getNumCases(); I != E; ++I) >> + if (SI->getSuccessor(I-1) != SI->getSuccessor(I) || >> + SI->getCaseValue(I-1)->getValue()+1 != SI->getCaseValue(I)->getValue()) >> + return false; > > What about out-of-order case values? For example: > > define zeroext i1 @quux(i32 %x) nounwind readnone ssp noredzone { > entry: > switch i32 %x, label %lor.rhs [ > i32 1, label %lor.end > i32 3, label %lor.end > i32 2, label %lor.end > ] > > lor.rhs: ; preds = %entry > br label %lor.end > > lor.end: ; preds = %lor.rhs, > %entry, %entry, %entry > %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], > [ true, %entry ] > ret i1 %0 > } > > This is supposed to be equivalent to using ordered case values, but > your code doesn't touch this switch while it works fine if the case > values are sorted. I thought transforming unsorted switches wouldn't have much impact on usual C code but testing shows that it does. I extended the transform to catch unsorted cases too in r124826. From bob.wilson at apple.com Thu Feb 3 17:17:40 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 03 Feb 2011 23:17:40 -0000 Subject: [llvm-commits] [llvm] r124829 - /llvm/trunk/include/llvm/Object/MachOFormat.h Message-ID: <20110203231740.3ECA92A6C12C@llvm.org> Author: bwilson Date: Thu Feb 3 17:17:40 2011 New Revision: 124829 URL: http://llvm.org/viewvc/llvm-project?rev=124829&view=rev Log: Edit a comment for consistency. Modified: llvm/trunk/include/llvm/Object/MachOFormat.h Modified: llvm/trunk/include/llvm/Object/MachOFormat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachOFormat.h?rev=124829&r1=124828&r2=124829&view=diff ============================================================================== --- llvm/trunk/include/llvm/Object/MachOFormat.h (original) +++ llvm/trunk/include/llvm/Object/MachOFormat.h Thu Feb 3 17:17:40 2011 @@ -347,7 +347,7 @@ RIT_X86_64_TLV = 9 }; - /// ARM also has its own relocation types. + /// ARM uses its own relocation types. enum RelocationInfoTypeARM { RIT_ARM_LocalDifference = 3, RIT_ARM_PreboundLazyPointer = 4, From bob.wilson at apple.com Thu Feb 3 17:17:44 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 03 Feb 2011 23:17:44 -0000 Subject: [llvm-commits] [llvm] r124830 - /llvm/trunk/include/llvm/MC/MCExpr.h Message-ID: <20110203231744.CB85F2A6C12D@llvm.org> Author: bwilson Date: Thu Feb 3 17:17:44 2011 New Revision: 124830 URL: http://llvm.org/viewvc/llvm-project?rev=124830&view=rev Log: Remove trailing whitespace Modified: llvm/trunk/include/llvm/MC/MCExpr.h Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=124830&r1=124829&r2=124830&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Thu Feb 3 17:17:44 2011 @@ -162,7 +162,7 @@ VK_ARM_GOTOFF, VK_ARM_TPOFF, VK_ARM_GOTTPOFF, - + VK_PPC_TOC, VK_PPC_HA16, // ha16(symbol) VK_PPC_LO16 // lo16(symbol) @@ -190,7 +190,7 @@ MCContext &Ctx); static const MCSymbolRefExpr *Create(StringRef Name, VariantKind Kind, MCContext &Ctx); - + /// @} /// @name Accessors /// @{ From bob.wilson at apple.com Thu Feb 3 17:17:47 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 03 Feb 2011 23:17:47 -0000 Subject: [llvm-commits] [llvm] r124831 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp Message-ID: <20110203231747.77C372A6C12C@llvm.org> Author: bwilson Date: Thu Feb 3 17:17:47 2011 New Revision: 124831 URL: http://llvm.org/viewvc/llvm-project?rev=124831&view=rev Log: Do not sign extend floating-point values in the asm parser. Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=124831&r1=124830&r2=124831&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Feb 3 17:17:47 2011 @@ -568,7 +568,7 @@ } case AsmToken::Real: { APFloat RealVal(APFloat::IEEEdouble, getTok().getString()); - int64_t IntVal = RealVal.bitcastToAPInt().getSExtValue(); + uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue(); Res = MCConstantExpr::Create(IntVal, getContext()); Lex(); // Eat token. return false; From grosbach at apple.com Thu Feb 3 17:28:37 2011 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 3 Feb 2011 15:28:37 -0800 Subject: [llvm-commits] [llvm] r124672 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp In-Reply-To: <20110201191232.E7F842A6C12C@llvm.org> References: <20110201191232.E7F842A6C12C@llvm.org> Message-ID: <975D87B1-87B2-48E3-BF24-5F6831D9B7B4@apple.com> Hi David, I'm getting some build warnings from clang when compiling this. Can you take a look? -Jim /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:452:3: warning: use of uninitialized variable 'LargestFP' [-Wuninitialized] MVT::SimpleValueType LargestFP; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:459:65: note: variable 'LargestFP' is possibly uninitialized when used here if (isFloatingPoint(Other.TypeVec[i]) && Other.TypeVec[i] > LargestFP) ^~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:479:19: note: variable 'LargestFP' is possibly uninitialized when used here if (*TVI == LargestFP) { ^~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:452:33: note: add initialization to silence this warning MVT::SimpleValueType LargestFP; ^ = 0 /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:386:3: warning: use of uninitialized variable 'SmallestInt' [-Wuninitialized] MVT::SimpleValueType SmallestInt; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:393:47: note: variable 'SmallestInt' is possibly uninitialized when used here if (isInteger(TypeVec[i]) && TypeVec[i] < SmallestInt) ^~~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:414:19: note: variable 'SmallestInt' is possibly uninitialized when used here if (*TVI == SmallestInt) { ^~~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:386:35: note: add initialization to silence this warning MVT::SimpleValueType SmallestInt; ^ = 0 /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:396:3: warning: use of uninitialized variable 'SmallestFP' [-Wuninitialized] MVT::SimpleValueType SmallestFP; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:403:53: note: variable 'SmallestFP' is possibly uninitialized when used here if (isFloatingPoint(TypeVec[i]) && TypeVec[i] < SmallestFP) ^~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:423:19: note: variable 'SmallestFP' is possibly uninitialized when used here if (*TVI == SmallestFP) { ^~~~~~~~~~ /Volumes/Home/grosbaj/sources/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:396:34: note: add initialization to silence this warning MVT::SimpleValueType SmallestFP; ^ = 0 On Feb 1, 2011, at 11:12 AM, David Greene wrote: > Author: greened > Date: Tue Feb 1 13:12:32 2011 > New Revision: 124672 > > URL: http://llvm.org/viewvc/llvm-project?rev=124672&view=rev > Log: > > [AVX] Implement EnforceSmallerThan for mixed int/fp type lists. This > makes type checking for extract_subvector and insert_subvector more > robust and will allow stricter typechecking of more patterns in the > future. > > This change handles int and fp as disjoint sets so that it will > enforce integer types to be smaller than the largest integer type and > fp types to be smaller than the largest fp type. There is no attempt > to check type sizes across the int/fp sets. > > Modified: > llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp > > Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=124672&r1=124671&r2=124672&view=diff > ============================================================================== > --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) > +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Feb 1 13:12:32 2011 > @@ -344,52 +344,155 @@ > if (!hasVectorTypes()) > MadeChange |= EnforceScalar(TP); > > - // This code does not currently handle nodes which have multiple types, > - // where some types are integer, and some are fp. Assert that this is not > - // the case. > - assert(!(hasIntegerTypes() && hasFloatingPointTypes()) && > - !(Other.hasIntegerTypes() && Other.hasFloatingPointTypes()) && > - "SDTCisOpSmallerThanOp does not handle mixed int/fp types!"); > + if (TypeVec.size() == 1 && Other.TypeVec.size() == 1) { > + // If we are down to concrete types, this code does not currently > + // handle nodes which have multiple types, where some types are > + // integer, and some are fp. Assert that this is not the case. > + assert(!(hasIntegerTypes() && hasFloatingPointTypes()) && > + !(Other.hasIntegerTypes() && Other.hasFloatingPointTypes()) && > + "SDTCisOpSmallerThanOp does not handle mixed int/fp types!"); > + > + // Otherwise, if these are both vector types, either this vector > + // must have a larger bitsize than the other, or this element type > + // must be larger than the other. > + EVT Type(TypeVec[0]); > + EVT OtherType(Other.TypeVec[0]); > + > + if (hasVectorTypes() && Other.hasVectorTypes()) { > + if (Type.getSizeInBits() >= OtherType.getSizeInBits()) > + if (Type.getVectorElementType().getSizeInBits() > + >= OtherType.getVectorElementType().getSizeInBits()) > + TP.error("Type inference contradiction found, '" + > + getName() + "' element type not smaller than '" + > + Other.getName() +"'!"); > + } > + else > + // For scalar types, the bitsize of this type must be larger > + // than that of the other. > + if (Type.getSizeInBits() >= OtherType.getSizeInBits()) > + TP.error("Type inference contradiction found, '" + > + getName() + "' is not smaller than '" + > + Other.getName() +"'!"); > + > + } > + > + > + // Handle int and fp as disjoint sets. This won't work for patterns > + // that have mixed fp/int types but those are likely rare and would > + // not have been accepted by this code previously. > > // Okay, find the smallest type from the current set and remove it from the > // largest set. > - MVT::SimpleValueType Smallest = TypeVec[0]; > + MVT::SimpleValueType SmallestInt; > + for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) > + if (isInteger(TypeVec[i])) { > + SmallestInt = TypeVec[i]; > + break; > + } > + for (unsigned i = 1, e = TypeVec.size(); i != e; ++i) > + if (isInteger(TypeVec[i]) && TypeVec[i] < SmallestInt) > + SmallestInt = TypeVec[i]; > + > + MVT::SimpleValueType SmallestFP; > + for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) > + if (isFloatingPoint(TypeVec[i])) { > + SmallestFP = TypeVec[i]; > + break; > + } > for (unsigned i = 1, e = TypeVec.size(); i != e; ++i) > - if (TypeVec[i] < Smallest) > - Smallest = TypeVec[i]; > + if (isFloatingPoint(TypeVec[i]) && TypeVec[i] < SmallestFP) > + SmallestFP = TypeVec[i]; > + > + int OtherIntSize = 0; > + int OtherFPSize = 0; > + for (SmallVector::iterator TVI = > + Other.TypeVec.begin(); > + TVI != Other.TypeVec.end(); > + /* NULL */) { > + if (isInteger(*TVI)) { > + ++OtherIntSize; > + if (*TVI == SmallestInt) { > + TVI = Other.TypeVec.erase(TVI); > + --OtherIntSize; > + MadeChange = true; > + continue; > + } > + } > + else if (isFloatingPoint(*TVI)) { > + ++OtherFPSize; > + if (*TVI == SmallestFP) { > + TVI = Other.TypeVec.erase(TVI); > + --OtherFPSize; > + MadeChange = true; > + continue; > + } > + } > + ++TVI; > + } > > // If this is the only type in the large set, the constraint can never be > // satisfied. > - if (Other.TypeVec.size() == 1 && Other.TypeVec[0] == Smallest) > + if ((Other.hasIntegerTypes() && OtherIntSize == 0) > + || (Other.hasFloatingPointTypes() && OtherFPSize == 0)) > TP.error("Type inference contradiction found, '" + > Other.getName() + "' has nothing larger than '" + getName() +"'!"); > > - SmallVector::iterator TVI = > - std::find(Other.TypeVec.begin(), Other.TypeVec.end(), Smallest); > - if (TVI != Other.TypeVec.end()) { > - Other.TypeVec.erase(TVI); > - MadeChange = true; > - } > - > // Okay, find the largest type in the Other set and remove it from the > // current set. > - MVT::SimpleValueType Largest = Other.TypeVec[0]; > + MVT::SimpleValueType LargestInt = Other.TypeVec[0]; > + for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) > + if (isInteger(Other.TypeVec[i])) { > + LargestInt = Other.TypeVec[i]; > + break; > + } > + for (unsigned i = 1, e = Other.TypeVec.size(); i != e; ++i) > + if (isInteger(Other.TypeVec[i]) && Other.TypeVec[i] > LargestInt) > + LargestInt = Other.TypeVec[i]; > + > + MVT::SimpleValueType LargestFP; > + for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) > + if (isFloatingPoint(Other.TypeVec[i])) { > + LargestFP = Other.TypeVec[i]; > + break; > + } > for (unsigned i = 1, e = Other.TypeVec.size(); i != e; ++i) > - if (Other.TypeVec[i] > Largest) > - Largest = Other.TypeVec[i]; > + if (isFloatingPoint(Other.TypeVec[i]) && Other.TypeVec[i] > LargestFP) > + LargestFP = Other.TypeVec[i]; > + > + int IntSize = 0; > + int FPSize = 0; > + for (SmallVector::iterator TVI = > + TypeVec.begin(); > + TVI != TypeVec.end(); > + /* NULL */) { > + if (isInteger(*TVI)) { > + ++IntSize; > + if (*TVI == LargestInt) { > + TVI = TypeVec.erase(TVI); > + --IntSize; > + MadeChange = true; > + continue; > + } > + } > + else if (isFloatingPoint(*TVI)) { > + ++FPSize; > + if (*TVI == LargestFP) { > + TVI = TypeVec.erase(TVI); > + --FPSize; > + MadeChange = true; > + continue; > + } > + } > + ++TVI; > + } > > // If this is the only type in the small set, the constraint can never be > // satisfied. > - if (TypeVec.size() == 1 && TypeVec[0] == Largest) > + if ((hasIntegerTypes() && IntSize == 0) > + || (hasFloatingPointTypes() && FPSize == 0)) > TP.error("Type inference contradiction found, '" + > getName() + "' has nothing smaller than '" + Other.getName()+"'!"); > > - TVI = std::find(TypeVec.begin(), TypeVec.end(), Largest); > - if (TVI != TypeVec.end()) { > - TypeVec.erase(TVI); > - MadeChange = true; > - } > - > return MadeChange; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From grosbach at apple.com Thu Feb 3 17:26:36 2011 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 03 Feb 2011 23:26:36 -0000 Subject: [llvm-commits] [llvm] r124832 - /llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Message-ID: <20110203232636.C709F2A6C12C@llvm.org> Author: grosbach Date: Thu Feb 3 17:26:36 2011 New Revision: 124832 URL: http://llvm.org/viewvc/llvm-project?rev=124832&view=rev Log: Tidy up a bit. Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=124832&r1=124831&r2=124832&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original) +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Thu Feb 3 17:26:36 2011 @@ -206,7 +206,6 @@ if (Target.isLittleEndianEncoding()) reverseBits(Insts); EmitSourceFileHeader("Machine Code Emitter", o); - std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::"; const std::vector &NumberedInstructions = Target.getInstructionsByEnumValue(); @@ -254,7 +253,8 @@ Record *R = *IC; if (R->getValueAsString("Namespace") == "TargetOpcode") continue; - const std::string &InstName = R->getName(); + const std::string &InstName = R->getValueAsString("Namespace") + "::" + + R->getName(); std::string Case = getInstructionCase(R, Target); CaseMap[Case].push_back(InstName); @@ -275,7 +275,7 @@ for (int i = 0, N = InstList.size(); i < N; i++) { if (i) o << "\n"; - o << " case " << Namespace << InstList[i] << ":"; + o << " case " << InstList[i] << ":"; } o << " {\n"; o << Case; From undingen at gmail.com Thu Feb 3 17:48:00 2011 From: undingen at gmail.com (Marius Wachtler) Date: Fri, 4 Feb 2011 00:48:00 +0100 Subject: [llvm-commits] [llvm] r124826 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch-to-icmp.ll In-Reply-To: <20110203225141.ABC872A6C12C@llvm.org> References: <20110203225141.ABC872A6C12C@llvm.org> Message-ID: Hello Maybe add the attached code to stop generating the add if the offset is zero. warning: haven't run make check! because currently I have no machine at hand... -- Marius -------------- next part -------------- A non-text attachment was scrubbed... Name: stopgeneratingadd.patch Type: application/octet-stream Size: 1220 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/69b146a7/attachment.obj From stoklund at 2pi.dk Thu Feb 3 18:39:18 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 00:39:18 -0000 Subject: [llvm-commits] [llvm] r124838 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp Message-ID: <20110204003918.36D8B2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 3 18:39:18 2011 New Revision: 124838 URL: http://llvm.org/viewvc/llvm-project?rev=124838&view=rev Log: Verify kill flags conservatively. Allow a live range to end with a kill flag, but don't allow a kill flag that doesn't end the live range. This makes the machine code verifier more useful during register allocation when kill flag computation is deferred. Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=124838&r1=124837&r2=124838&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Thu Feb 3 18:39:18 2011 @@ -647,24 +647,11 @@ report("No live range at use", MO, MONum); *OS << UseIdx << " is not live in " << LI << '\n'; } - // Verify isKill == LI.killedAt. - // Two-address instrs don't have kill flags on the tied operands, and - // we even allow - // %r1 = add %r1, %r1 - // without a kill flag on the untied operand. - // MI->findRegisterUseOperandIdx finds the first operand using reg. - if (!MI->isRegTiedToDefOperand(MI->findRegisterUseOperandIdx(Reg))) { - // MI could kill register without a kill flag on MO. - bool miKill = MI->killsRegister(Reg); - bool liKill = LI.killedAt(UseIdx.getDefIndex()); - if (miKill && !liKill) { - report("Live range continues after kill flag", MO, MONum); - *OS << "Live range: " << LI << '\n'; - } - if (!miKill && liKill) { - report("Live range ends without kill flag", MO, MONum); - *OS << "Live range: " << LI << '\n'; - } + // Check for extra kill flags. + // Note that we allow missing kill flags for now. + if (MO->isKill() && !LI.killedAt(UseIdx.getDefIndex())) { + report("Live range continues after kill flag", MO, MONum); + *OS << "Live range: " << LI << '\n'; } } else { report("Virtual register has no Live interval", MO, MONum); From stoklund at 2pi.dk Thu Feb 3 18:39:20 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 00:39:20 -0000 Subject: [llvm-commits] [llvm] r124839 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110204003920.BC3102A6C12D@llvm.org> Author: stoklund Date: Thu Feb 3 18:39:20 2011 New Revision: 124839 URL: http://llvm.org/viewvc/llvm-project?rev=124839&view=rev Log: Also compute interference intervals for blocks with no uses. When the live range is live through a block that doesn't use the register, but that has interference, region splitting wants to split at the top and bottom of the basic block. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124839&r1=124838&r2=124839&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 3 18:39:20 2011 @@ -611,9 +611,7 @@ if (!IntI.valid()) continue; for (unsigned i = 0, e = LiveBlocks.size(); i != e; ++i) { - BlockInfo &BI = LiveBlocks[i]; - if (!BI.Uses) - continue; + const BlockInfo &BI = LiveBlocks[i]; IndexPair &IP = InterferenceRanges[i]; SlotIndex Start, Stop; tie(Start, Stop) = Indexes->getMBBRange(BI.MBB); From stoklund at 2pi.dk Thu Feb 3 18:59:23 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 00:59:23 -0000 Subject: [llvm-commits] [llvm] r124842 - /llvm/trunk/lib/CodeGen/SplitKit.cpp Message-ID: <20110204005923.ABEDD2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 3 18:59:23 2011 New Revision: 124842 URL: http://llvm.org/viewvc/llvm-project?rev=124842&view=rev Log: Skip unused values. Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124842&r1=124841&r2=124842&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb 3 18:59:23 2011 @@ -948,6 +948,8 @@ for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), E = Edit.getParent().vni_end(); I != E; ++I) { const VNInfo *ParentVNI = *I; + if (ParentVNI->isUnused()) + continue; LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(ParentVNI->def)]; VNInfo *VNI = LIM.defValue(ParentVNI, ParentVNI->def); LIM.getLI()->addRange(LiveRange(ParentVNI->def, @@ -976,7 +978,7 @@ for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), E = Edit.getParent().vni_end(); I != E; ++I) { const VNInfo *PHIVNI = *I; - if (!PHIVNI->isPHIDef()) + if (PHIVNI->isUnused() || !PHIVNI->isPHIDef()) continue; unsigned RegIdx = RegAssign.lookup(PHIVNI->def); LiveIntervalMap &LIM = LIMappers[RegIdx]; From evan.cheng at apple.com Thu Feb 3 19:10:12 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 04 Feb 2011 01:10:12 -0000 Subject: [llvm-commits] [llvm] r124843 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp Message-ID: <20110204011012.5C6C02A6C12C@llvm.org> Author: evancheng Date: Thu Feb 3 19:10:12 2011 New Revision: 124843 URL: http://llvm.org/viewvc/llvm-project?rev=124843&view=rev Log: Update comments. Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124843&r1=124842&r2=124843&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Thu Feb 3 19:10:12 2011 @@ -504,8 +504,9 @@ if (!I->isPHI() && !I->isDebugValue()) InstrCount += 1; } - // Heuristically, don't tail-duplicate calls if it would expand code size, - // as it's less likely to be worth the extra cost. + // Don't tail-duplicate calls before register allocation. Calls presents a + // barrier to register allocation so duplicating them may end up increasing + // spills. if (InstrCount > 1 && (PreRegAlloc && HasCall)) return false; From david_dean at apple.com Thu Feb 3 19:12:54 2011 From: david_dean at apple.com (David Dean) Date: Fri, 04 Feb 2011 01:12:54 -0000 Subject: [llvm-commits] [zorg] r124844 - /zorg/trunk/buildbot/llvmlab/master/config/builders.py Message-ID: <20110204011255.070842A6C12C@llvm.org> Author: ddean Date: Thu Feb 3 19:12:54 2011 New Revision: 124844 URL: http://llvm.org/viewvc/llvm-project?rev=124844&view=rev Log: revert overzealous trimming of workdir='.' Modified: zorg/trunk/buildbot/llvmlab/master/config/builders.py Modified: zorg/trunk/buildbot/llvmlab/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/llvmlab/master/config/builders.py?rev=124844&r1=124843&r2=124844&view=diff ============================================================================== --- zorg/trunk/buildbot/llvmlab/master/config/builders.py (original) +++ zorg/trunk/buildbot/llvmlab/master/config/builders.py Thu Feb 3 19:12:54 2011 @@ -57,6 +57,7 @@ command=['pwd'], property='builddir', description='set build dir', + workdir='.', )) return f @@ -71,6 +72,7 @@ command=['rsync', '-ave', 'ssh', src_file, slavedest ], haltOnFailure=True, description=['download build artifacts'], + workdir='.', )) #extract compiler artifacts used for this build f.addStep(buildbot.steps.shell.ShellCommand( @@ -78,6 +80,7 @@ command=['tar', '-zxvf', WithProperties('clang-install.tar.gz'),], haltOnFailure=True, description=['extract', WithProperties('clang-install')], + workdir='.', )) return f @@ -86,16 +89,19 @@ command=['rm', '-rf', 'clang-install'], haltOnFailure=False, description=['rm dir', 'clang-install'], + workdir='.', )) f.addStep(buildbot.steps.shell.ShellCommand( command=['rm', '-rf', 'clang-install.tar.gz'], haltOnFailure=False, description=['rm archive', 'clang-install.tar.gz'], + workdir='.', )) f.addStep(buildbot.steps.shell.ShellCommand( command=['rm', '-rf', WithProperties('%(compiler_built:-)s')], haltOnFailure=False, description=['rm dir', WithProperties('%(compiler_built:-)s')], + workdir='.', )) return f @@ -106,6 +112,7 @@ WithProperties('./clang-install/')], haltOnFailure=True, description=['tar', '&', 'zip'], + workdir='.', )) archive_src = WithProperties('%(builddir)s/clang-install.tar.gz') f.addStep(buildbot.steps.shell.ShellCommand( @@ -115,6 +122,7 @@ ], haltOnFailure=True, description=['upload build artifacts'], + workdir='.', )) return f @@ -526,6 +534,7 @@ ';', '>', 'user-config.jam'], haltOnFailure=True, description=['create user-config.jam'], + workdir='.', )) #--bjam-options=target-os=windows --bjam-options=-l300 --bjam-options=--debug-level=3 --bjam-options=--user-config=%MYJAMFILE% --have-source --skip-script-download --ftp=ftp://boost:4peiV8Xwxfv9 at ftp.siliconman.net >runner.log f.addStep(buildbot.steps.shell.ShellCommand( @@ -537,6 +546,7 @@ WithProperties('--bjam-options=-j%(jobs)s'),'--user=""',], haltOnFailure=True, description=['boost regression harness'], + workdir='.', timeout=14400 )) return f From dpatel at apple.com Thu Feb 3 19:43:25 2011 From: dpatel at apple.com (Devang Patel) Date: Fri, 04 Feb 2011 01:43:25 -0000 Subject: [llvm-commits] [llvm] r124845 - in /llvm/trunk: lib/CodeGen/LiveDebugVariables.cpp test/CodeGen/X86/dbg-value-location.ll test/CodeGen/X86/dbg-value-range.ll Message-ID: <20110204014325.E95922A6C12C@llvm.org> Author: dpatel Date: Thu Feb 3 19:43:25 2011 New Revision: 124845 URL: http://llvm.org/viewvc/llvm-project?rev=124845&view=rev Log: DebugLoc associated with a machine instruction is used to emit location entries. DebugLoc associated with a DBG_VALUE is used to identify lexical scope of the variable. After register allocation, while inserting DBG_VALUE remember original debug location for the first instruction and reuse it, otherwise dwarf writer may be mislead in identifying the variable's scope. Added: llvm/trunk/test/CodeGen/X86/dbg-value-location.ll Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp llvm/trunk/test/CodeGen/X86/dbg-value-range.ll Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=124845&r1=124844&r2=124845&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Thu Feb 3 19:43:25 2011 @@ -79,7 +79,8 @@ class UserValue { const MDNode *variable; ///< The debug info variable we are part of. unsigned offset; ///< Byte offset into variable. - + DebugLoc dl; ///< The debug location for the variable. This is + ///< used by dwarf writer to find lexical scope. UserValue *leader; ///< Equivalence class leader. UserValue *next; ///< Next value in equivalence class, or null. @@ -104,8 +105,9 @@ public: /// UserValue - Create a new UserValue. - UserValue(const MDNode *var, unsigned o, LocMap::Allocator &alloc) - : variable(var), offset(o), leader(this), next(0), locInts(alloc) + UserValue(const MDNode *var, unsigned o, DebugLoc L, + LocMap::Allocator &alloc) + : variable(var), offset(o), dl(L), leader(this), next(0), locInts(alloc) {} /// getLeader - Get the leader of this value's equivalence class. @@ -192,6 +194,11 @@ void emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS, const TargetInstrInfo &TRI); + /// findDebugLoc - Return DebugLoc used for this DBG_VALUE instruction. A + /// variable may have more than one corresponding DBG_VALUE instructions. + /// Only first one needs DebugLoc to identify variable's lexical scope + /// in source file. + DebugLoc findDebugLoc(); void print(raw_ostream&, const TargetRegisterInfo*); }; } // namespace @@ -218,7 +225,7 @@ UVMap userVarMap; /// getUserValue - Find or create a UserValue. - UserValue *getUserValue(const MDNode *Var, unsigned Offset); + UserValue *getUserValue(const MDNode *Var, unsigned Offset, DebugLoc DL); /// lookupVirtReg - Find the EC leader for VirtReg or null. UserValue *lookupVirtReg(unsigned VirtReg); @@ -315,7 +322,8 @@ } } -UserValue *LDVImpl::getUserValue(const MDNode *Var, unsigned Offset) { +UserValue *LDVImpl::getUserValue(const MDNode *Var, unsigned Offset, + DebugLoc DL) { UserValue *&Leader = userVarMap[Var]; if (Leader) { UserValue *UV = Leader->getLeader(); @@ -325,7 +333,7 @@ return UV; } - UserValue *UV = new UserValue(Var, Offset, allocator); + UserValue *UV = new UserValue(Var, Offset, DL, allocator); userValues.push_back(UV); Leader = UserValue::merge(Leader, UV); return UV; @@ -354,7 +362,7 @@ // Get or create the UserValue for (variable,offset). unsigned Offset = MI->getOperand(1).getImm(); const MDNode *Var = MI->getOperand(2).getMetadata(); - UserValue *UV = getUserValue(Var, Offset); + UserValue *UV = getUserValue(Var, Offset, MI->getDebugLoc()); // If the location is a virtual register, make sure it is mapped. if (MI->getOperand(0).isReg()) { @@ -581,10 +589,10 @@ DEBUG(print(dbgs(), &TRI)); } -/// findInsertLocation - Find an iterator and DebugLoc for inserting a DBG_VALUE +/// findInsertLocation - Find an iterator for inserting a DBG_VALUE /// instruction. static MachineBasicBlock::iterator -findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, DebugLoc &DL, +findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS) { SlotIndex Start = LIS.getMBBStartIdx(MBB); Idx = Idx.getBaseIndex(); @@ -595,46 +603,47 @@ // We've reached the beginning of MBB. if (Idx == Start) { MachineBasicBlock::iterator I = MBB->SkipPHIsAndLabels(MBB->begin()); - if (I != MBB->end()) - DL = I->getDebugLoc(); return I; } Idx = Idx.getPrevIndex(); } - // We found an instruction. The insert point is after the instr. - DL = MI->getDebugLoc(); + // Don't insert anything after the first terminator, though. return MI->getDesc().isTerminator() ? MBB->getFirstTerminator() : llvm::next(MachineBasicBlock::iterator(MI)); } +DebugLoc UserValue::findDebugLoc() { + DebugLoc D = dl; + dl = DebugLoc(); + return D; +} void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx, unsigned LocNo, LiveIntervals &LIS, const TargetInstrInfo &TII) { - DebugLoc DL; - MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, DL, LIS); + MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, LIS); MachineOperand &Loc = locations[LocNo]; // Frame index locations may require a target callback. if (Loc.isFI()) { MachineInstr *MI = TII.emitFrameIndexDebugValue(*MBB->getParent(), - Loc.getIndex(), offset, variable, DL); + Loc.getIndex(), offset, variable, + findDebugLoc()); if (MI) { MBB->insert(I, MI); return; } } // This is not a frame index, or the target is happy with a standard FI. - BuildMI(*MBB, I, DL, TII.get(TargetOpcode::DBG_VALUE)) + BuildMI(*MBB, I, findDebugLoc(), TII.get(TargetOpcode::DBG_VALUE)) .addOperand(Loc).addImm(offset).addMetadata(variable); } void UserValue::insertDebugKill(MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS, const TargetInstrInfo &TII) { - DebugLoc DL; - MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, DL, LIS); - BuildMI(*MBB, I, DL, TII.get(TargetOpcode::DBG_VALUE)).addReg(0) + MachineBasicBlock::iterator I = findInsertLocation(MBB, Idx, LIS); + BuildMI(*MBB, I, findDebugLoc(), TII.get(TargetOpcode::DBG_VALUE)).addReg(0) .addImm(offset).addMetadata(variable); } Added: llvm/trunk/test/CodeGen/X86/dbg-value-location.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-location.ll?rev=124845&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-location.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-value-location.ll Thu Feb 3 19:43:25 2011 @@ -0,0 +1,70 @@ +; RUN: llc < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" +;Radar 8950491 + +;CHECK: .ascii "var" ## DW_AT_name +;CHECK-NEXT: .byte 0 +;CHECK-NEXT: .byte 2 ## DW_AT_decl_file +;CHECK-NEXT: .short 19509 ## DW_AT_decl_line +;CHECK-NEXT: .long 68 ## DW_AT_type +;CHECK-NEXT: .byte 1 ## DW_AT_location + + at dfm = external global i32, align 4 + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone + +define i32 @foo(i32 %dev, i64 %cmd, i8* %data, i32 %data2) nounwind optsize ssp { +entry: + call void @llvm.dbg.value(metadata !{i32 %dev}, i64 0, metadata !12), !dbg !13 + %tmp.i = load i32* @dfm, align 4, !dbg !14 + %cmp.i = icmp eq i32 %tmp.i, 0, !dbg !14 + br i1 %cmp.i, label %if.else, label %if.end.i, !dbg !14 + +if.end.i: ; preds = %entry + switch i64 %cmd, label %if.then [ + i64 2147772420, label %bb.i + i64 536897538, label %bb116.i + ], !dbg !22 + +bb.i: ; preds = %if.end.i + unreachable + +bb116.i: ; preds = %if.end.i + unreachable + +if.then: ; preds = %if.end.i + ret i32 undef, !dbg !23 + +if.else: ; preds = %entry + ret i32 0 +} + +declare hidden fastcc i32 @bar(i32, i32* nocapture) nounwind optsize ssp +declare hidden fastcc i32 @bar2(i32) nounwind optsize ssp +declare hidden fastcc i32 @bar3(i32) nounwind optsize ssp +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +!llvm.dbg.sp = !{!0, !6, !7, !8} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 19510, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32, i64, i8*, i32)* @foo} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"/tmp/f.c", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"f.i", metadata !"/tmp", metadata !"clang version 2.9 (trunk 124753)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{metadata !5} +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"bar3", metadata !"bar3", metadata !"", metadata !1, i32 14827, metadata !3, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @bar3} ; [ DW_TAG_subprogram ] +!7 = metadata !{i32 589870, i32 0, metadata !1, metadata !"bar2", metadata !"bar2", metadata !"", metadata !1, i32 15397, metadata !3, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32)* @bar2} ; [ DW_TAG_subprogram ] +!8 = metadata !{i32 589870, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"", metadata !1, i32 12382, metadata !9, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (i32, i32*)* @bar} ; [ DW_TAG_subprogram ] +!9 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !10, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!10 = metadata !{metadata !11} +!11 = metadata !{i32 589860, metadata !2, metadata !"unsigned char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 8} ; [ DW_TAG_base_type ] +!12 = metadata !{i32 590081, metadata !0, metadata !"var", metadata !1, i32 19509, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!13 = metadata !{i32 19509, i32 20, metadata !0, null} +!14 = metadata !{i32 18091, i32 2, metadata !15, metadata !17} +!15 = metadata !{i32 589835, metadata !16, i32 18086, i32 1, metadata !1, i32 748} ; [ DW_TAG_lexical_block ] +!16 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo_bar", metadata !"foo_bar", metadata !"", metadata !1, i32 18086, metadata !3, i1 true, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, null} ; [ DW_TAG_subprogram ] +!17 = metadata !{i32 19514, i32 2, metadata !18, null} +!18 = metadata !{i32 589835, metadata !0, i32 19510, i32 1, metadata !1, i32 99} ; [ DW_TAG_lexical_block ] +!22 = metadata !{i32 18094, i32 2, metadata !15, metadata !17} +!23 = metadata !{i32 19524, i32 1, metadata !18, null} Modified: llvm/trunk/test/CodeGen/X86/dbg-value-range.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-range.ll?rev=124845&r1=124844&r2=124845&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-range.ll (original) +++ llvm/trunk/test/CodeGen/X86/dbg-value-range.ll Thu Feb 3 19:43:25 2011 @@ -44,12 +44,12 @@ ; check that variable bar:b value range is appropriately trucated in debug info. Here Ltmp5 is end of ; location range. -;CHECK:Ltmp5 +;CHECK:Ltmp7 ;CHECK-NEXT: DEBUG_VALUE: bar:b <- undef ;CHECK:Ldebug_loc0: ;CHECK-NEXT: .quad Ltmp -;CHECK-NEXT: .quad Ltmp5 +;CHECK-NEXT: .quad Ltmp7 ;CHECK-NEXT: .short 1 ;CHECK-NEXT: .byte 85 ;CHECK-NEXT: .quad 0 From atrick at apple.com Thu Feb 3 21:18:17 2011 From: atrick at apple.com (Andrew Trick) Date: Fri, 04 Feb 2011 03:18:17 -0000 Subject: [llvm-commits] [llvm] r124853 - in /llvm/trunk: include/llvm/CodeGen/ScheduleDAG.h lib/CodeGen/ScheduleDAG.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Message-ID: <20110204031817.3E8162A6C12C@llvm.org> Author: atrick Date: Thu Feb 3 21:18:17 2011 New Revision: 124853 URL: http://llvm.org/viewvc/llvm-project?rev=124853&view=rev Log: Introducing a new method of tracking register pressure. We can't precisely track pressure on a selection DAG, but we can at least keep it balanced. This design accounts for various interesting aspects of selection DAGS: register and subregister copies, glued nodes, dead nodes, unused registers, etc. Added SUnit::NumRegDefsLeft and ScheduleDAGSDNodes::RegDefIter. Note: I disabled PrescheduleNodesWithMultipleUses when register pressure is enabled, based on no evidence other than I don't think it makes sense to have both enabled. Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/lib/CodeGen/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=124853&r1=124852&r2=124853&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Thu Feb 3 21:18:17 2011 @@ -248,6 +248,7 @@ unsigned NumSuccs; // # of SDep::Data sucss. unsigned NumPredsLeft; // # of preds not scheduled. unsigned NumSuccsLeft; // # of succs not scheduled. + unsigned short NumRegDefsLeft; // # of reg defs with no scheduled use. unsigned short Latency; // Node latency. bool isCall : 1; // Is a function call. bool isTwoAddress : 1; // Is a two-address instruction. @@ -276,7 +277,7 @@ SUnit(SDNode *node, unsigned nodenum) : Node(node), Instr(0), OrigNode(0), NodeNum(nodenum), NodeQueueId(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), - NumSuccsLeft(0), Latency(0), + NumSuccsLeft(0), NumRegDefsLeft(0), Latency(0), isCall(false), isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false), hasPhysRegClobbers(false), isPending(false), isAvailable(false), isScheduled(false), @@ -290,7 +291,7 @@ SUnit(MachineInstr *instr, unsigned nodenum) : Node(0), Instr(instr), OrigNode(0), NodeNum(nodenum), NodeQueueId(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), - NumSuccsLeft(0), Latency(0), + NumSuccsLeft(0), NumRegDefsLeft(0), Latency(0), isCall(false), isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false), hasPhysRegClobbers(false), isPending(false), isAvailable(false), isScheduled(false), @@ -303,7 +304,7 @@ SUnit() : Node(0), Instr(0), OrigNode(0), NodeNum(~0u), NodeQueueId(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), - NumSuccsLeft(0), Latency(0), + NumSuccsLeft(0), NumRegDefsLeft(0), Latency(0), isCall(false), isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false), hasPhysRegClobbers(false), isPending(false), isAvailable(false), isScheduled(false), @@ -347,7 +348,7 @@ /// addPred - This adds the specified edge as a pred of the current node if /// not already. It also adds the current node as a successor of the /// specified node. - void addPred(const SDep &D); + bool addPred(const SDep &D); /// removePred - This removes the specified edge as a pred of the current /// node if it exists. It also removes the current node as a successor of @@ -442,6 +443,8 @@ bool hasReadyFilter() const { return HasReadyFilter; } + virtual bool tracksRegPressure() const { return false; } + virtual bool isReady(SUnit *) const { assert(!HasReadyFilter && "The ready filter must override isReady()"); return true; Modified: llvm/trunk/lib/CodeGen/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAG.cpp?rev=124853&r1=124852&r2=124853&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAG.cpp Thu Feb 3 21:18:17 2011 @@ -75,12 +75,12 @@ /// addPred - This adds the specified edge as a pred of the current node if /// not already. It also adds the current node as a successor of the /// specified node. -void SUnit::addPred(const SDep &D) { +bool SUnit::addPred(const SDep &D) { // If this node already has this depenence, don't add a redundant one. for (SmallVector::const_iterator I = Preds.begin(), E = Preds.end(); I != E; ++I) if (*I == D) - return; + return false; // Now add a corresponding succ to N. SDep P = D; P.setSUnit(this); @@ -106,6 +106,7 @@ this->setDepthDirty(); N->setHeightDirty(); } + return true; } /// removePred - This removes the specified edge as a pred of the current @@ -285,6 +286,7 @@ dbgs() << " # preds left : " << NumPredsLeft << "\n"; dbgs() << " # succs left : " << NumSuccsLeft << "\n"; + dbgs() << " # rdefs left : " << NumRegDefsLeft << "\n"; dbgs() << " Latency : " << Latency << "\n"; dbgs() << " Depth : " << Depth << "\n"; dbgs() << " Height : " << Height << "\n"; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=124853&r1=124852&r2=124853&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Feb 3 21:18:17 2011 @@ -706,6 +706,8 @@ } else { LoadSU = CreateNewSUnit(LoadNode); LoadNode->setNodeId(LoadSU->NodeNum); + + InitNumRegDefsLeft(LoadSU); ComputeLatency(LoadSU); } @@ -722,6 +724,8 @@ } if (TID.isCommutable()) NewSU->isCommutable = true; + + InitNumRegDefsLeft(NewSU); ComputeLatency(NewSU); // Record all the edges to and from the old SU, by category. @@ -772,6 +776,10 @@ RemovePred(SuccDep, D); D.setSUnit(NewSU); AddPred(SuccDep, D); + // Balance register pressure. + if (AvailableQueue->tracksRegPressure() && SuccDep->isScheduled + && !D.isCtrl() && NewSU->NumRegDefsLeft > 0) + --NewSU->NumRegDefsLeft; } for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) { SDep D = ChainSuccs[i]; @@ -1436,6 +1444,8 @@ SU->NodeQueueId = 0; } + bool tracksRegPressure() const { return TracksRegPressure; } + void dumpRegPressure() const; bool HighRegPressure(const SUnit *SU) const; @@ -1571,7 +1581,8 @@ // Add pseudo dependency edges for two-address nodes. AddPseudoTwoAddrDeps(); // Reroute edges to nodes with multiple uses. - PrescheduleNodesWithMultipleUses(); + if (!TracksRegPressure) + PrescheduleNodesWithMultipleUses(); // Calculate node priorities. CalculateSethiUllmanNumbers(); } @@ -1642,64 +1653,20 @@ if (I->isCtrl()) continue; SUnit *PredSU = I->getSUnit(); - // NumSuccsLeft counts all deps. Don't compare it with NumSuccs which only - // counts data deps. To be more precise, we could maintain a - // NumDataSuccsLeft count. - if (PredSU->NumSuccsLeft != PredSU->Succs.size()) { - DEBUG(dbgs() << " SU(" << PredSU->NodeNum << ") live across SU(" - << SU->NodeNum << ")\n"); - continue; - } - const SDNode *PN = PredSU->getNode(); - if (!PN->isMachineOpcode()) { - if (PN->getOpcode() == ISD::CopyFromReg) { - EVT VT = PN->getValueType(0); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - unsigned Cost = TLI->getRepRegClassCostFor(VT); - if ((RegPressure[RCId] + Cost) >= RegLimit[RCId]) - return true; - } + // NumRegDefsLeft is zero when enough uses of this node have been scheduled + // to cover the number of registers defined (they are all live). + if (PredSU->NumRegDefsLeft == 0) { continue; } - unsigned POpc = PN->getMachineOpcode(); - if (POpc == TargetOpcode::IMPLICIT_DEF) - continue; - if (POpc == TargetOpcode::EXTRACT_SUBREG) { - EVT VT = PN->getOperand(0).getValueType(); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - unsigned Cost = TLI->getRepRegClassCostFor(VT); - // Check if this increases register pressure of the specific register - // class to the point where it would cause spills. - if ((RegPressure[RCId] + Cost) >= RegLimit[RCId]) - return true; - continue; - } else if (POpc == TargetOpcode::INSERT_SUBREG || - POpc == TargetOpcode::SUBREG_TO_REG) { - EVT VT = PN->getValueType(0); + for (ScheduleDAGSDNodes::RegDefIter RegDefPos(PredSU, scheduleDAG); + RegDefPos.IsValid(); RegDefPos.Advance()) { + EVT VT = RegDefPos.GetValue(); unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); unsigned Cost = TLI->getRepRegClassCostFor(VT); - // Check if this increases register pressure of the specific register - // class to the point where it would cause spills. - if ((RegPressure[RCId] + Cost) >= RegLimit[RCId]) - return true; - continue; - } - unsigned NumDefs = TII->get(PN->getMachineOpcode()).getNumDefs(); - for (unsigned i = 0; i != NumDefs; ++i) { - EVT VT = PN->getValueType(i); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - if (RegPressure[RCId] >= RegLimit[RCId]) - return true; // Reg pressure already high. - unsigned Cost = TLI->getRepRegClassCostFor(VT); - if (!PN->hasAnyUseOfValue(i)) - continue; - // Check if this increases register pressure of the specific register - // class to the point where it would cause spills. if ((RegPressure[RCId] + Cost) >= RegLimit[RCId]) return true; } } - return false; } @@ -1725,80 +1692,64 @@ if (!TracksRegPressure) return; - const SDNode *N = SU->getNode(); - if (!N->isMachineOpcode()) { - if (N->getOpcode() != ISD::CopyToReg) - return; - } else { - unsigned Opc = N->getMachineOpcode(); - if (Opc == TargetOpcode::EXTRACT_SUBREG || - Opc == TargetOpcode::INSERT_SUBREG || - Opc == TargetOpcode::SUBREG_TO_REG || - Opc == TargetOpcode::REG_SEQUENCE || - Opc == TargetOpcode::IMPLICIT_DEF) - return; - } - for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { if (I->isCtrl()) continue; SUnit *PredSU = I->getSUnit(); - // NumSuccsLeft counts all deps. Don't compare it with NumSuccs which only - // counts data deps. - if (PredSU->NumSuccsLeft != PredSU->Succs.size()) - continue; - const SDNode *PN = PredSU->getNode(); - if (!PN->isMachineOpcode()) { - if (PN->getOpcode() == ISD::CopyFromReg) { - EVT VT = PN->getValueType(0); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - RegPressure[RCId] += TLI->getRepRegClassCostFor(VT); - } - continue; - } - unsigned POpc = PN->getMachineOpcode(); - if (POpc == TargetOpcode::IMPLICIT_DEF) - continue; - if (POpc == TargetOpcode::EXTRACT_SUBREG) { - EVT VT = PN->getOperand(0).getValueType(); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - RegPressure[RCId] += TLI->getRepRegClassCostFor(VT); - continue; - } else if (POpc == TargetOpcode::INSERT_SUBREG || - POpc == TargetOpcode::SUBREG_TO_REG) { - EVT VT = PN->getValueType(0); - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - RegPressure[RCId] += TLI->getRepRegClassCostFor(VT); - continue; - } - unsigned NumDefs = TII->get(PN->getMachineOpcode()).getNumDefs(); - for (unsigned i = 0; i != NumDefs; ++i) { - EVT VT = PN->getValueType(i); - if (!PN->hasAnyUseOfValue(i)) + // NumRegDefsLeft is zero when enough uses of this node have been scheduled + // to cover the number of registers defined (they are all live). + if (PredSU->NumRegDefsLeft == 0) { + continue; + } + // FIXME: The ScheduleDAG currently loses information about which of a + // node's values is consumed by each dependence. Consequently, if the node + // defines multiple register classes, we don't know which to pressurize + // here. Instead the following loop consumes the register defs in an + // arbitrary order. At least it handles the common case of clustered loads + // to the same class. For precise liveness, each SDep needs to indicate the + // result number. But that tightly couples the ScheduleDAG with the + // SelectionDAG making updates tricky. A simpler hack would be to attach a + // value type or register class to SDep. + // + // The most important aspect of register tracking is balancing the increase + // here with the reduction further below. Note that this SU may use multiple + // defs in PredSU. The can't be determined here, but we've already + // compensated by reducing NumRegDefsLeft in PredSU during + // ScheduleDAGSDNodes::AddSchedEdges. + --PredSU->NumRegDefsLeft; + unsigned SkipRegDefs = PredSU->NumRegDefsLeft; + for (ScheduleDAGSDNodes::RegDefIter RegDefPos(PredSU, scheduleDAG); + RegDefPos.IsValid(); RegDefPos.Advance(), --SkipRegDefs) { + if (SkipRegDefs) continue; + EVT VT = RegDefPos.GetValue(); unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); RegPressure[RCId] += TLI->getRepRegClassCostFor(VT); + break; } } - // Check for isMachineOpcode() as PrescheduleNodesWithMultipleUses() - // may transfer data dependencies to CopyToReg. - if (SU->NumSuccs && N->isMachineOpcode()) { - unsigned NumDefs = TII->get(N->getMachineOpcode()).getNumDefs(); - for (unsigned i = 0; i != NumDefs; ++i) { - EVT VT = N->getValueType(i); - if (!N->hasAnyUseOfValue(i)) - continue; - unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); - if (RegPressure[RCId] < TLI->getRepRegClassCostFor(VT)) - // Register pressure tracking is imprecise. This can happen. - RegPressure[RCId] = 0; - else - RegPressure[RCId] -= TLI->getRepRegClassCostFor(VT); + // We should have this assert, but there may be dead SDNodes that never + // materialize as SUnits, so they don't appear to generate liveness. + //assert(SU->NumRegDefsLeft == 0 && "not all regdefs have scheduled uses"); + int SkipRegDefs = (int)SU->NumRegDefsLeft; + for (ScheduleDAGSDNodes::RegDefIter RegDefPos(SU, scheduleDAG); + RegDefPos.IsValid(); RegDefPos.Advance(), --SkipRegDefs) { + if (SkipRegDefs > 0) + continue; + EVT VT = RegDefPos.GetValue(); + unsigned RCId = TLI->getRepRegClassFor(VT)->getID(); + if (RegPressure[RCId] < TLI->getRepRegClassCostFor(VT)) { + // Register pressure tracking is imprecise. This can happen. But we try + // hard not to let it happen because it likely results in poor scheduling. + DEBUG(dbgs() << " SU(" << SU->NodeNum << ") has too many regdefs\n"); + RegPressure[RCId] = 0; + } + else { + RegPressure[RCId] -= TLI->getRepRegClassCostFor(VT); } } - dumpRegPressure(); } @@ -2314,7 +2265,7 @@ if (PredSU->NumSuccs == 1) continue; // Avoid prescheduling to copies from virtual registers, which don't behave - // like other nodes from the perspective of scheduling // heuristics. + // like other nodes from the perspective of scheduling heuristics. if (SDNode *N = SU->getNode()) if (N->getOpcode() == ISD::CopyFromReg && TargetRegisterInfo::isVirtualRegister Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=124853&r1=124852&r2=124853&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Thu Feb 3 21:18:17 2011 @@ -332,6 +332,9 @@ assert(N->getNodeId() == -1 && "Node already inserted!"); N->setNodeId(NodeSUnit->NodeNum); + // Compute NumRegDefsLeft. This must be done before AddSchedEdges. + InitNumRegDefsLeft(NodeSUnit); + // Assign the Latency field of NodeSUnit using target-provided information. ComputeLatency(NodeSUnit); } @@ -407,7 +410,13 @@ ST.adjustSchedDependency(OpSU, SU, const_cast(dep)); } - SU->addPred(dep); + if (!SU->addPred(dep) && !dep.isCtrl() && OpSU->NumRegDefsLeft > 0) { + // Multiple register uses are combined in the same SUnit. For example, + // we could have a set of glued nodes with all their defs consumed by + // another set of glued nodes. Register pressure tracking sees this as + // a single use, so to keep pressure balanced we reduce the defs. + --OpSU->NumRegDefsLeft; + } } } } @@ -426,6 +435,69 @@ AddSchedEdges(); } +// Initialize NumNodeDefs for the current Node's opcode. +void ScheduleDAGSDNodes::RegDefIter::InitNodeNumDefs() { + if (!Node->isMachineOpcode()) { + if (Node->getOpcode() == ISD::CopyFromReg) + NodeNumDefs = 1; + else + NodeNumDefs = 0; + return; + } + unsigned POpc = Node->getMachineOpcode(); + if (POpc == TargetOpcode::IMPLICIT_DEF) { + // No register need be allocated for this. + NodeNumDefs = 0; + return; + } + unsigned NRegDefs = SchedDAG->TII->get(Node->getMachineOpcode()).getNumDefs(); + // Some instructions define regs that are not represented in the selection DAG + // (e.g. unused flags). See tMOVi8. Make sure we don't access past NumValues. + NodeNumDefs = std::min(Node->getNumValues(), NRegDefs); + DefIdx = 0; +} + +// Construct a RegDefIter for this SUnit and find the first valid value. +ScheduleDAGSDNodes::RegDefIter::RegDefIter(const SUnit *SU, + const ScheduleDAGSDNodes *SD) + : SchedDAG(SD), Node(SU->getNode()), DefIdx(0), NodeNumDefs(0) { + InitNodeNumDefs(); + Advance(); +} + +// Advance to the next valid value defined by the SUnit. +void ScheduleDAGSDNodes::RegDefIter::Advance() { + for (;Node;) { // Visit all glued nodes. + for (;DefIdx < NodeNumDefs; ++DefIdx) { + if (!Node->hasAnyUseOfValue(DefIdx)) + continue; + if (Node->isMachineOpcode() && + Node->getMachineOpcode() == TargetOpcode::EXTRACT_SUBREG) { + // Propagate the incoming (full-register) type. I doubt it's needed. + ValueType = Node->getOperand(0).getValueType(); + } + else { + ValueType = Node->getValueType(DefIdx); + } + ++DefIdx; + return; // Found a normal regdef. + } + Node = Node->getGluedNode(); + if (Node == NULL) { + return; // No values left to visit. + } + InitNodeNumDefs(); + } +} + +void ScheduleDAGSDNodes::InitNumRegDefsLeft(SUnit *SU) { + assert(SU->NumRegDefsLeft == 0 && "expect a new node"); + for (RegDefIter I(SU, this); I.IsValid(); I.Advance()) { + assert(SU->NumRegDefsLeft < USHRT_MAX && "overflow is ok but unexpected"); + ++SU->NumRegDefsLeft; + } +} + void ScheduleDAGSDNodes::ComputeLatency(SUnit *SU) { // Check to see if the scheduler cares about latencies. if (ForceUnitLatencies()) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h?rev=124853&r1=124852&r2=124853&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Thu Feb 3 21:18:17 2011 @@ -20,7 +20,7 @@ namespace llvm { /// ScheduleDAGSDNodes - A ScheduleDAG for scheduling SDNode-based DAGs. - /// + /// /// Edges between SUnits are initially based on edges in the SelectionDAG, /// and additional edges can be added by the schedulers as heuristics. /// SDNodes such as Constants, Registers, and a few others that are not @@ -73,13 +73,17 @@ /// predecessors / successors info nor the temporary scheduling states. /// SUnit *Clone(SUnit *N); - + /// BuildSchedGraph - Build the SUnit graph from the selection dag that we /// are input. This SUnit graph is similar to the SelectionDAG, but /// excludes nodes that aren't interesting to scheduling, and represents /// flagged together nodes with a single SUnit. virtual void BuildSchedGraph(AliasAnalysis *AA); + /// InitNumRegDefsLeft - Determine the # of regs defined by this node. + /// + void InitNumRegDefsLeft(SUnit *SU); + /// ComputeLatency - Compute node latency. /// virtual void ComputeLatency(SUnit *SU); @@ -106,6 +110,30 @@ virtual void getCustomGraphFeatures(GraphWriter &GW) const; + /// RegDefIter - In place iteration over the values defined by an + /// SUnit. This does not need copies of the iterator or any other STLisms. + /// The iterator creates itself, rather than being provided by the SchedDAG. + class RegDefIter { + const ScheduleDAGSDNodes *SchedDAG; + const SDNode *Node; + unsigned DefIdx; + unsigned NodeNumDefs; + EVT ValueType; + public: + RegDefIter(const SUnit *SU, const ScheduleDAGSDNodes *SD); + + bool IsValid() const { return Node != NULL; } + + EVT GetValue() const { + assert(IsValid() && "bad iterator"); + return ValueType; + } + + void Advance(); + private: + void InitNodeNumDefs(); + }; + private: /// ClusterNeighboringLoads - Cluster loads from "near" addresses into /// combined SUnits. From ofv at wanadoo.es Thu Feb 3 21:47:50 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Fri, 04 Feb 2011 03:47:50 -0000 Subject: [llvm-commits] [llvm] r124854 - /llvm/trunk/cmake/modules/TableGen.cmake Message-ID: <20110204034750.8B5B32A6C12C@llvm.org> Author: ofv Date: Thu Feb 3 21:47:50 2011 New Revision: 124854 URL: http://llvm.org/viewvc/llvm-project?rev=124854&view=rev Log: Add the tablegenned files to the `clean' target. Modified: llvm/trunk/cmake/modules/TableGen.cmake Modified: llvm/trunk/cmake/modules/TableGen.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=124854&r1=124853&r2=124854&view=diff ============================================================================== --- llvm/trunk/cmake/modules/TableGen.cmake (original) +++ llvm/trunk/cmake/modules/TableGen.cmake Thu Feb 3 21:47:50 2011 @@ -35,6 +35,11 @@ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp COMMENT "" ) + + # `make clean' must remove all those generated files: + set_property(DIRECTORY APPEND + PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn}.tmp ${ofn}) + set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn} PROPERTIES GENERATED 1) From geek4civic at gmail.com Thu Feb 3 22:24:28 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 4 Feb 2011 13:24:28 +0900 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: <87wrlkfmim.fsf@wanadoo.es> References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> <8762t4h5np.fsf@wanadoo.es> <87wrlkfmim.fsf@wanadoo.es> Message-ID: 2011/2/1 ?scar Fuentes : > You still have: > > +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if > + ? don't. */ > +#cmakedefine HAVE_DECL_STRERROR_S ${HAVE_DECL_STRERROR_S} > > instead of > > +/* Define to 1 if you have the declaration of `strerror_s' */ I took #cmakedefine01 instead of #cmakedefine ${...}. > The autoconf part tests for _alloca, __chkstk, etc when the target > system is MinGW, while on the cmake part the checks are performed when > LLVM_ON_WIN32 is true, which in practice means MinGW and VC++. I guess > that those functions are used while compiling with VC++. Sure, checking such symbols for msvc with cmake would be redundant. (In fact, no symbols can be found on msvc.) I think it would be less harmful but I might tighten up condition only to mingw later. ...Takumi From geek4civic at gmail.com Thu Feb 3 22:24:54 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 4 Feb 2011 13:24:54 +0900 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> <8762t4h5np.fsf@wanadoo.es> Message-ID: Eric and Oscar, I re-tweaked configurations. Here is my "take 2" patchset. (last one was simply reformatted) Please look at what you would like to look at. ;) ...Takumi * Changes in last patchset - Macros, _WIN32_WINNT, &c. may affect seeking declarations in configuration. - [CMake] let #define HAVE_DECL_ set "1" or "0" (or undefined). - Added checking _chsize_s on mingw. * 0001-Windows-DynamicLibrary.inc-ELM_Callback-fix.patch.txt * 0002-lib-Target-X86-X86JITInfo.cpp-Add-Win64-stuff.patch.txt They are trivial patches. * 0003-CMake-Add-macro-add_llvm_config_definition-NAME-.patch.txt [CMake] I added; add_llvm_config_definition(name value) It provides definition(-Dname=value) at checking decls, and definition at configure_file(). * 0004-lib-Support-Windows-Windows.h-Autoconf-provides-.patch.txt [autoconf][CMake] It provides 3 definitions; _WIN32_WINNT = 0x0500 _WIN32_IE = 0x0500 WIN32_LEAN_AND_MEAN to check decls with these definitions. They are set in llvm/Config/config.h. lib/Support/Windows/Windows.h uses definitions in config.h. * 0005-autoconf-Redefine-_WIN32_WINNT-in-config.h.patch.txt [autoconf][CMake] With mingw-w64 headers, _WIN32_WINNT would be defined in system headers. It undefines and redefines _WIN32_WINNT. It suppresses a warning in a case; #include <_mingw.h> /* any system headers */ #include "llvm/Config/config.h" * 0006-autoconf-define-HAVE_DECL_SETINFORMATIONJOBOBJEC.patch.txt * 0008-Windows-Program.inc-Declare-SetInformationJobObj.patch.txt Note: The declaration of SetInformationJobObject() requires _WIN32_WINNT >= 0x0500. * 0009-Autoconf-may-check-symbols-in-libgcc.a-for-JIT-o.patch.txt * 0011-Windows-DynamicLibrary.inc-Split-explicit-symbol.patch.txt (as same as last patches) * 0012-include-llvm-Config-config.h.-Provide-MINGW_HAS_.patch.txt [autoconf][CMake] On mingw-w64, Secure API (****_s) requires definition "MINGW_HAS_SECURE_API". * 0013-autoconf-Seek-strerror_s-with-AC_CHECK_DECLS.patch.txt * 0015-lib-Support-Errno.cpp-Check-strerror_s-with-HAVE.patch.txt [autoconf][CMake] On mingw-w64, the symbol "strerror_s" could be found in libs but not defined in headers. On MSVC, "strerror_s" can be found in string.h. * 0016-autoconf-Check-_chsize_s-s-declaration.patch.txt * 0018-Use-HAVE_DECL__CHSIZE_S-to-check-_chsize_s-on-Wi.patch.txt [autoconf][CMake] Mingw-w64 provides _chsize_s() with MINGW_HAS_SECURE_API. It could be found to seek symbols in libs. * 0007-Regenerate-configure.patch.txt.gz * 0010-Regenerate-configure.patch.txt.gz * 0014-Regenerate-configure.patch.txt.gz * 0017-Regenerate-configure.patch.txt.gz Included for consistency. -------------- next part -------------- From 261edc0095b53714f1306c64d2dea2a36f2d490a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:32:50 +0900 Subject: [PATCH 01/18] Windows/DynamicLibrary.inc: ELM_Callback fix --- lib/Support/Windows/DynamicLibrary.inc | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5fad37a..5e10f77 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -55,7 +55,17 @@ extern "C" { // Use new callback if: // - Newer Visual Studio (comes with newer SDK). // - Visual Studio 2005 with Windows SDK 6.0+ -#if !defined(_MSC_VER) || _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) +#if defined(_MSC_VER) + #if _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) + #define OLD_ELM_CALLBACK_DECL 1 + #endif +#elif defined(__MINGW64__) + // Use new callback. +#elif defined(__MINGW32__) + #define OLD_ELM_CALLBACK_DECL 1 +#endif + +#ifdef OLD_ELM_CALLBACK_DECL static BOOL CALLBACK ELM_Callback(PSTR ModuleName, ModuleBaseType ModuleBase, ULONG ModuleSize, -- 1.7.1.GIT -------------- next part -------------- From 1d76503fd68304f769ce6577f21d03d4a65f5e55 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 19 Dec 2010 15:20:08 +0900 Subject: [PATCH 02/18] lib/Target/X86/X86JITInfo.cpp: Add Win64 stuff. --- lib/Target/X86/X86JITInfo.cpp | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp index 759de77..127738d 100644 --- a/lib/Target/X86/X86JITInfo.cpp +++ b/lib/Target/X86/X86JITInfo.cpp @@ -127,9 +127,17 @@ extern "C" { "movaps %xmm6, 96(%rsp)\n" "movaps %xmm7, 112(%rsp)\n" // JIT callee +#ifdef _WIN64 + "subq $32, %rsp\n" + "movq %rbp, %rcx\n" // Pass prev frame and return address + "movq 8(%rbp), %rdx\n" + "call " ASMPREFIX "X86CompilationCallback2\n" + "addq $32, %rsp\n" +#else "movq %rbp, %rdi\n" // Pass prev frame and return address "movq 8(%rbp), %rsi\n" "call " ASMPREFIX "X86CompilationCallback2\n" +#endif // Restore all XMM arg registers "movaps 112(%rsp), %xmm7\n" "movaps 96(%rsp), %xmm6\n" -- 1.7.1.GIT -------------- next part -------------- From e69a9f88f3e0ac4cc9c43b774fe0a9861e00440a Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 3 Feb 2011 20:49:11 +0900 Subject: [PATCH 03/18] CMake: Add macro: add_llvm_config_definition(NAME value). Following C/C++ checks can use -Dname=value. eg. add_llvm_config_definition(_WIN32_WINNT 0x0500) Some declarations might be unavailable without certain definition. configure_file() can use its definition(s). --- cmake/modules/AddLLVMDefinitions.cmake | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/cmake/modules/AddLLVMDefinitions.cmake b/cmake/modules/AddLLVMDefinitions.cmake index 33ac973..a44a3d0 100644 --- a/cmake/modules/AddLLVMDefinitions.cmake +++ b/cmake/modules/AddLLVMDefinitions.cmake @@ -11,3 +11,12 @@ macro(add_llvm_definitions) endforeach(arg) add_definitions( ${ARGN} ) endmacro(add_llvm_definitions) + +# Following C/C++ checks can use -Dname=value. +# eg. add_llvm_config_definition(_WIN32_WINNT 0x0500) +# Some declarations might be unavailable without certain definition. +# configure_file() can use its definition(s). +macro(add_llvm_config_definition name value) + set(${name} ${value}) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D${name}=${value}") +endmacro(add_llvm_config_definition name value) -- 1.7.1.GIT -------------- next part -------------- From 45be38ca409cbbdf2b63be2eaf7bf230aa9d6b38 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 3 Feb 2011 20:49:11 +0900 Subject: [PATCH 04/18] lib/Support/Windows/Windows.h: Autoconf provides predefined macros (_WIN32_WINNT, etc.). _WIN32_WINNT, _WIN32_IE, WIN32_LEAN_AND_MEAN They affect seeking declarations at configure. --- autoconf/configure.ac | 7 +++++++ cmake/config-ix.cmake | 6 ++++++ configure | 16 ++++++++++++++++ include/llvm/Config/config.h.cmake | 9 +++++++++ include/llvm/Config/config.h.in | 9 +++++++++ lib/Support/Windows/Windows.h | 5 ----- 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 260b4b4..b282772 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1218,6 +1218,13 @@ dnl===-----------------------------------------------------------------------=== AC_CHECK_LIB(m,sin) if test "$llvm_cv_os_type" = "MingW" ; then + AC_DEFINE([_WIN32_WINNT],[0x0500], + [We require Windows 2000 API.]) + AC_DEFINE([_WIN32_IE],[0x0500], + [MinGW at it again.]) + AC_DEFINE([WIN32_LEAN_AND_MEAN],[], + [We don't need fullset of Windows headers.]) + AC_CHECK_LIB(imagehlp, main) AC_CHECK_LIB(psapi, main) fi diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 8484bb6..de71fed 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -86,6 +86,12 @@ if( NOT LLVM_ON_WIN32 ) endif() # function checks +if (LLVM_ON_WIN32) + add_llvm_config_definition(_WIN32_WINNT 0x0500) + add_llvm_config_definition(_WIN32_IE 0x0500) + add_llvm_config_definition(WIN32_LEAN_AND_MEAN 1) +endif () + check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) diff --git a/configure b/configure index 427a10d..94b121b 100755 --- a/configure +++ b/configure @@ -13553,6 +13553,22 @@ fi if test "$llvm_cv_os_type" = "MingW" ; then +cat >>confdefs.h <<\_ACEOF +#define _WIN32_WINNT 0x0500 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _WIN32_IE 0x0500 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define WIN32_LEAN_AND_MEAN +_ACEOF + + + { echo "$as_me:$LINENO: checking for main in -limagehlp" >&5 echo $ECHO_N "checking for main in -limagehlp... $ECHO_C" >&6; } if test "${ac_cv_lib_imagehlp_main+set}" = set; then diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 12e10ce..5e4b418 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -612,6 +612,15 @@ /* Define if use udis86 library */ #undef USE_UDIS86 +/* We don't need fullset of Windows headers. */ +#cmakedefine WIN32_LEAN_AND_MEAN + +/* MinGW at it again. */ +#cmakedefine _WIN32_IE ${_WIN32_IE} + +/* We require Windows 2000 API. */ +#cmakedefine _WIN32_WINNT ${_WIN32_WINNT} + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 5e16646..06d8a1b 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -623,6 +623,15 @@ /* Define if use udis86 library */ #undef USE_UDIS86 +/* We don't need fullset of Windows headers. */ +#undef WIN32_LEAN_AND_MEAN + +/* MinGW at it again. */ +#undef _WIN32_IE + +/* We require Windows 2000 API. */ +#undef _WIN32_WINNT + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/lib/Support/Windows/Windows.h b/lib/Support/Windows/Windows.h index 6e0b585..926d58a 100644 --- a/lib/Support/Windows/Windows.h +++ b/lib/Support/Windows/Windows.h @@ -16,11 +16,6 @@ //=== is guaranteed to work on *all* Win32 variants. //===----------------------------------------------------------------------===// -// Require at least Windows 2000 API. -#define _WIN32_WINNT 0x0500 -#define _WIN32_IE 0x0500 // MinGW at it again. -#define WIN32_LEAN_AND_MEAN - #include "llvm/Config/config.h" // Get build system configuration settings #include #include -- 1.7.1.GIT -------------- next part -------------- From 6f412b6dc3d796f9070662ad9502987fad719554 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Dec 2010 10:33:35 +0900 Subject: [PATCH 05/18] autoconf: Redefine _WIN32_WINNT in config.h. _WIN32_WINNT might be defined in system headers (depend on _mingw.h) on mingw-w64. --- autoconf/configure.ac | 5 ++++- include/llvm/Config/config.h.cmake | 3 +++ include/llvm/Config/config.h.in | 3 +++ 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index b282772..0e38f92 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1665,7 +1665,10 @@ dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the dnl files can be updated automatically when their *.in sources change. AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h]) AH_TOP([#ifndef CONFIG_H -#define CONFIG_H]) +#define CONFIG_H +#ifdef _WIN32_WINNT +#undef /*nosubst*/_WIN32_WINNT +#endif]) AH_BOTTOM([#endif]) AC_CONFIG_FILES([include/llvm/Config/Targets.def]) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 5e4b418..7179fd1 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -4,6 +4,9 @@ #ifndef CONFIG_H #define CONFIG_H +#ifdef _WIN32_WINNT +#undef /*nosubst*/_WIN32_WINNT +#endif /* Define if CBE is enabled for printf %a output */ #cmakedefine ENABLE_CBE_PRINTF_A ${ENABLE_CBE_PRINTF_A} diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 06d8a1b..0fe0941 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -2,6 +2,9 @@ #ifndef CONFIG_H #define CONFIG_H +#ifdef _WIN32_WINNT +#undef /*nosubst*/_WIN32_WINNT +#endif /* Relative directory for resource files */ #undef CLANG_RESOURCE_DIR -- 1.7.1.GIT -------------- next part -------------- From ddc9a842308a444b4fd45c4325036fcfe2c09681 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 12:57:55 +0900 Subject: [PATCH 06/18] autoconf: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- autoconf/configure.ac | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 0e38f92..3954d72 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1227,6 +1227,7 @@ if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(imagehlp, main) AC_CHECK_LIB(psapi, main) + AC_CHECK_DECLS([SetInformationJobObject],,,[#include ]) fi dnl dlopen() is required for plugin support. -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0007-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 1079 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/8385f6e3/attachment-0004.gz -------------- next part -------------- From 1870e8dcdb633cae7f80c6274c66db8580c7aa17 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:07:38 +0900 Subject: [PATCH 08/18] Windows/Program.inc: Declare SetInformationJobObject() if decls not found in Windows.h. config.h.*: define HAVE_DECL_SETINFORMATIONJOBOBJECT for SetInformationJobObject() on Mingw32. --- cmake/config-ix.cmake | 1 + include/llvm/Config/config.h.cmake | 4 ++++ include/llvm/Config/config.h.in | 4 ++++ lib/Support/Windows/Program.inc | 4 +++- 4 files changed, 12 insertions(+), 1 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index de71fed..848ffe7 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -156,6 +156,7 @@ check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) + check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 7179fd1..c7e47ad 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -65,6 +65,10 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H} +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#cmakedefine01 HAVE_DECL_SETINFORMATIONJOBOBJECT + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 0fe0941..226b873 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -81,6 +81,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H +/* Define to 1 if you have the declaration of `SetInformationJobObject', and + to 0 if you don't. */ +#undef HAVE_DECL_SETINFORMATIONJOBOBJECT + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index 0b92c78..9fcbc8d 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -22,7 +22,8 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// -#ifdef __MINGW32__ +#if defined(HAVE_DECL_SETINFORMATIONJOBOBJECT) +#if !HAVE_DECL_SETINFORMATIONJOBOBJECT // Ancient mingw32's w32api might not have this declaration. extern "C" BOOL WINAPI SetInformationJobObject(HANDLE hJob, @@ -30,6 +31,7 @@ BOOL WINAPI SetInformationJobObject(HANDLE hJob, LPVOID lpJobObjectInfo, DWORD cbJobObjectInfoLength); #endif +#endif namespace { struct Win32ProcessInfo { -- 1.7.1.GIT -------------- next part -------------- From 6d204d59981b21766b1f1adbfe66a372c572b399 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 19:12:15 +0900 Subject: [PATCH 09/18] Autoconf may check symbols in libgcc.a for JIT on Mingw. --- autoconf/configure.ac | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 3954d72..e4850bd 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1405,6 +1405,28 @@ AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check symbols in libgcc.a for JIT on Mingw. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) + AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) + AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) + AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) + + AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) + AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) + AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) + AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) + AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) + AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) + AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) + AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) + AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) + AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) + + AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) + AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) +fi + dnl Check for variations in the Standard C++ library and STL. These macros are dnl provided by LLVM in the autoconf/m4 directory. AC_FUNC_ISNAN -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0010-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 2174 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/8385f6e3/attachment-0005.gz -------------- next part -------------- From d847f60f91bf3ccc98011b4c6586bef64c0c0478 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 31 Jan 2011 17:56:13 +0900 Subject: [PATCH 11/18] Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc. config.h.* have conditions whether each symbol is defined or not. --- cmake/config-ix.cmake | 20 ++++++++ include/llvm/Config/config.h.cmake | 48 ++++++++++++++++++ include/llvm/Config/config.h.in | 48 ++++++++++++++++++ lib/Support/Windows/DynamicLibrary.inc | 77 +++++++----------------------- lib/Support/Windows/explicit_symbols.inc | 66 +++++++++++++++++++++++++ 5 files changed, 199 insertions(+), 60 deletions(-) create mode 100644 lib/Support/Windows/explicit_symbols.inc diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 848ffe7..85c0c6e 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -157,6 +157,26 @@ check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) + + check_function_exists(_alloca HAVE__ALLOCA) + check_function_exists(__alloca HAVE___ALLOCA) + check_function_exists(__chkstk HAVE___CHKSTK) + check_function_exists(___chkstk HAVE____CHKSTK) + + check_function_exists(__ashldi3 HAVE___ASHLDI3) + check_function_exists(__ashrdi3 HAVE___ASHRDI3) + check_function_exists(__divdi3 HAVE___DIVDI3) + check_function_exists(__fixdfdi HAVE___FIXDFDI) + check_function_exists(__fixsfdi HAVE___FIXSFDI) + check_function_exists(__floatdidf HAVE___FLOATDIDF) + check_function_exists(__lshrdi3 HAVE___LSHRDI3) + check_function_exists(__moddi3 HAVE___MODDI3) + check_function_exists(__udivdi3 HAVE___UDIVDI3) + check_function_exists(__umoddi3 HAVE___UMODDI3) + + check_function_exists(__main HAVE___MAIN) + check_function_exists(__cmpdi2 HAVE___CMPDI2) + endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index c7e47ad..a2345e3f 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -461,9 +461,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} + +/* Have host's __alloca */ +#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} + +/* Have host's __ashldi3 */ +#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} + +/* Have host's __ashrdi3 */ +#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} + +/* Have host's __chkstk */ +#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} + +/* Have host's __cmpdi2 */ +#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} + +/* Have host's __divdi3 */ +#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} + +/* Have host's __fixsfdi */ +#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} + +/* Have host's __floatdidf */ +#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} + +/* Have host's __lshrdi3 */ +#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} + +/* Have host's __main */ +#cmakedefine HAVE___MAIN ${HAVE___MAIN} + +/* Have host's __moddi3 */ +#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} + +/* Have host's __udivdi3 */ +#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} + +/* Have host's __umoddi3 */ +#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} + +/* Have host's ___chkstk */ +#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 226b873..4d59d68 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -483,9 +483,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#undef HAVE__ALLOCA + +/* Have host's __alloca */ +#undef HAVE___ALLOCA + +/* Have host's __ashldi3 */ +#undef HAVE___ASHLDI3 + +/* Have host's __ashrdi3 */ +#undef HAVE___ASHRDI3 + +/* Have host's __chkstk */ +#undef HAVE___CHKSTK + +/* Have host's __cmpdi2 */ +#undef HAVE___CMPDI2 + +/* Have host's __divdi3 */ +#undef HAVE___DIVDI3 + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#undef HAVE___FIXDFDI + +/* Have host's __fixsfdi */ +#undef HAVE___FIXSFDI + +/* Have host's __floatdidf */ +#undef HAVE___FLOATDIDF + +/* Have host's __lshrdi3 */ +#undef HAVE___LSHRDI3 + +/* Have host's __main */ +#undef HAVE___MAIN + +/* Have host's __moddi3 */ +#undef HAVE___MODDI3 + +/* Have host's __udivdi3 */ +#undef HAVE___UDIVDI3 + +/* Have host's __umoddi3 */ +#undef HAVE___UMODDI3 + +/* Have host's ___chkstk */ +#undef HAVE____CHKSTK + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION diff --git a/lib/Support/Windows/DynamicLibrary.inc b/lib/Support/Windows/DynamicLibrary.inc index 5e10f77..2c14366 100644 --- a/lib/Support/Windows/DynamicLibrary.inc +++ b/lib/Support/Windows/DynamicLibrary.inc @@ -120,35 +120,14 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *filename, // Stack probing routines are in the support library (e.g. libgcc), but we don't // have dynamic linking on windows. Provide a hook. -#if defined(__MINGW32__) || defined (_MSC_VER) - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return (void*)&SYM - #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ - if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO - #define EXPLICIT_SYMBOL_DEF(SYM) \ - extern "C" { extern void *SYM; } - - #if defined(__MINGW32__) - EXPLICIT_SYMBOL_DEF(_alloca) - EXPLICIT_SYMBOL_DEF(__main) - EXPLICIT_SYMBOL_DEF(__ashldi3) - EXPLICIT_SYMBOL_DEF(__ashrdi3) - EXPLICIT_SYMBOL_DEF(__cmpdi2) - EXPLICIT_SYMBOL_DEF(__divdi3) - EXPLICIT_SYMBOL_DEF(__fixdfdi) - EXPLICIT_SYMBOL_DEF(__fixsfdi) - EXPLICIT_SYMBOL_DEF(__fixunsdfdi) - EXPLICIT_SYMBOL_DEF(__fixunssfdi) - EXPLICIT_SYMBOL_DEF(__floatdidf) - EXPLICIT_SYMBOL_DEF(__floatdisf) - EXPLICIT_SYMBOL_DEF(__lshrdi3) - EXPLICIT_SYMBOL_DEF(__moddi3) - EXPLICIT_SYMBOL_DEF(__udivdi3) - EXPLICIT_SYMBOL_DEF(__umoddi3) - #elif defined(_MSC_VER) - EXPLICIT_SYMBOL_DEF(_alloca_probe) - #endif -#endif +#define EXPLICIT_SYMBOL(SYM) \ + extern "C" { extern void *SYM; } +#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) EXPLICIT_SYMBOL(SYMTO) + +#include "explicit_symbols.inc" + +#undef EXPLICIT_SYMBOL +#undef EXPLICIT_SYMBOL2 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). @@ -169,39 +148,17 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { } } -#if defined(__MINGW32__) - { - EXPLICIT_SYMBOL(_alloca); - EXPLICIT_SYMBOL(__main); - EXPLICIT_SYMBOL(__ashldi3); - EXPLICIT_SYMBOL(__ashrdi3); - EXPLICIT_SYMBOL(__cmpdi2); - EXPLICIT_SYMBOL(__divdi3); - EXPLICIT_SYMBOL(__fixdfdi); - EXPLICIT_SYMBOL(__fixsfdi); - EXPLICIT_SYMBOL(__fixunsdfdi); - EXPLICIT_SYMBOL(__fixunssfdi); - EXPLICIT_SYMBOL(__floatdidf); - EXPLICIT_SYMBOL(__floatdisf); - EXPLICIT_SYMBOL(__lshrdi3); - EXPLICIT_SYMBOL(__moddi3); - EXPLICIT_SYMBOL(__udivdi3); - EXPLICIT_SYMBOL(__umoddi3); - - EXPLICIT_SYMBOL2(alloca, _alloca); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF - } -#elif defined(_MSC_VER) + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return (void*)&SYM; + #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ + if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO; + { - EXPLICIT_SYMBOL2(alloca, _alloca_probe); - EXPLICIT_SYMBOL2(_alloca, _alloca_probe); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF + #include "explicit_symbols.inc" } -#endif + + #undef EXPLICIT_SYMBOL + #undef EXPLICIT_SYMBOL2 return 0; } diff --git a/lib/Support/Windows/explicit_symbols.inc b/lib/Support/Windows/explicit_symbols.inc new file mode 100644 index 0000000..84862d6 --- /dev/null +++ b/lib/Support/Windows/explicit_symbols.inc @@ -0,0 +1,66 @@ +/* in libgcc.a */ + +#ifdef HAVE__ALLOCA + EXPLICIT_SYMBOL(_alloca) + EXPLICIT_SYMBOL2(alloca, _alloca); +#endif +#ifdef HAVE___ALLOCA + EXPLICIT_SYMBOL(__alloca) +#endif +#ifdef HAVE___CHKSTK + EXPLICIT_SYMBOL(__chkstk) +#endif +#ifdef HAVE____CHKSTK + EXPLICIT_SYMBOL(___chkstk) +#endif +#ifdef HAVE___MAIN + EXPLICIT_SYMBOL(__main) // FIXME: Don't call it. +#endif + +#ifdef HAVE___ASHLDI3 + EXPLICIT_SYMBOL(__ashldi3) +#endif +#ifdef HAVE___ASHRDI3 + EXPLICIT_SYMBOL(__ashrdi3) +#endif +#ifdef HAVE___CMPDI2 // FIXME: unused + EXPLICIT_SYMBOL(__cmpdi2) +#endif +#ifdef HAVE___DIVDI3 + EXPLICIT_SYMBOL(__divdi3) +#endif +#ifdef HAVE___FIXDFDI + EXPLICIT_SYMBOL(__fixdfdi) +#endif +#ifdef HAVE___FIXSFDI + EXPLICIT_SYMBOL(__fixsfdi) +#endif +#ifdef HAVE___FIXUNSDFDI + EXPLICIT_SYMBOL(__fixunsdfdi) +#endif +#ifdef HAVE___FIXUNSSFDI + EXPLICIT_SYMBOL(__fixunssfdi) +#endif +#ifdef HAVE___FLOATDIDF + EXPLICIT_SYMBOL(__floatdidf) +#endif +#ifdef HAVE___FLOATDISF + EXPLICIT_SYMBOL(__floatdisf) +#endif +#ifdef HAVE___LSHRDI3 + EXPLICIT_SYMBOL(__lshrdi3) +#endif +#ifdef HAVE___MODDI3 + EXPLICIT_SYMBOL(__moddi3) +#endif +#ifdef HAVE___UDIVDI3 + EXPLICIT_SYMBOL(__udivdi3) +#endif +#ifdef HAVE___UMODDI3 + EXPLICIT_SYMBOL(__umoddi3) +#endif + +/* msvcrt */ +#if defined(_MSC_VER) + EXPLICIT_SYMBOL2(alloca, _alloca_probe); +#endif -- 1.7.1.GIT -------------- next part -------------- From 6201ecd0fc4cc51361f2577635dc6b4c2122168e Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 4 Feb 2011 12:03:33 +0900 Subject: [PATCH 12/18] include/llvm/Config/config.h.*: Provide MINGW_HAS_SECURE_API for mingw-w64. --- autoconf/configure.ac | 2 ++ cmake/config-ix.cmake | 5 +++++ configure | 5 +++++ include/llvm/Config/config.h.cmake | 3 +++ include/llvm/Config/config.h.in | 3 +++ 5 files changed, 18 insertions(+), 0 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index e4850bd..fdbd7fd 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1224,6 +1224,8 @@ if test "$llvm_cv_os_type" = "MingW" ; then [MinGW at it again.]) AC_DEFINE([WIN32_LEAN_AND_MEAN],[], [We don't need fullset of Windows headers.]) + AC_DEFINE([MINGW_HAS_SECURE_API],[], + [It enables Secure API on mingw.]) AC_CHECK_LIB(imagehlp, main) AC_CHECK_LIB(psapi, main) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 85c0c6e..7605356 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -92,6 +92,11 @@ if (LLVM_ON_WIN32) add_llvm_config_definition(WIN32_LEAN_AND_MEAN 1) endif () +if (MINGW) + # Newer version of mingw header could use Secure APIs + add_llvm_config_definition(MINGW_HAS_SECURE_API 1) +endif () + check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) diff --git a/configure b/configure index ab6dd62..5bb5d79 100755 --- a/configure +++ b/configure @@ -13568,6 +13568,11 @@ cat >>confdefs.h <<\_ACEOF _ACEOF +cat >>confdefs.h <<\_ACEOF +#define MINGW_HAS_SECURE_API +_ACEOF + + { echo "$as_me:$LINENO: checking for main in -limagehlp" >&5 echo $ECHO_N "checking for main in -limagehlp... $ECHO_C" >&6; } diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index a2345e3f..315c1d1 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -613,6 +613,9 @@ /* Define to the system default library search path. */ #cmakedefine LTDL_SYSSEARCHPATH "${LTDL_SYSSEARCHPATH}" +/* It enables Secure API on mingw. */ +#cmakedefine MINGW_HAS_SECURE_API + /* Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary */ #undef NEED_DEV_ZERO_FOR_MMAP diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 4d59d68..4725179 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -635,6 +635,9 @@ /* Define to the system default library search path. */ #undef LTDL_SYSSEARCHPATH +/* It enables Secure API on mingw. */ +#undef MINGW_HAS_SECURE_API + /* Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary */ #undef NEED_DEV_ZERO_FOR_MMAP -- 1.7.1.GIT -------------- next part -------------- From 6fc49e1eb7b61afd6931ba040fb06d1fd66211d6 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 18 Jan 2011 15:30:58 +0900 Subject: [PATCH 13/18] autoconf: Seek strerror_s() with AC_CHECK_DECLS. AC_CHECK_FUNCS seeks a symbol only in libs. We should check decl in string.h. With recent Mingw, *_s() stuff would be enabled by MINGW_HAS_SECURE_API. --- autoconf/configure.ac | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index fdbd7fd..972c5e5 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1401,12 +1401,15 @@ AC_CHECK_FUNCS([powf fmodf strtof round ]) AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) -AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ]) +AC_CHECK_FUNCS([strerror strerror_r setenv ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check the declaration "Secure API" on Windows environments. +AC_CHECK_DECLS([strerror_s]) + dnl Check symbols in libgcc.a for JIT on Mingw. if test "$llvm_cv_os_type" = "MingW" ; then AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0014-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 1159 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/8385f6e3/attachment-0006.gz -------------- next part -------------- From 6cc977f9a9747c07b247fbbf508d0c91664f9856 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 1 Feb 2011 09:12:36 +0900 Subject: [PATCH 15/18] lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S int config.h.*. FIXME: I have never seen mingw(s) have strerror_s() (not _strerror_s()). --- cmake/config-ix.cmake | 2 +- include/llvm/Config/config.h.cmake | 7 ++++--- include/llvm/Config/config.h.in | 7 ++++--- lib/Support/Errno.cpp | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 7605356..951bed8 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -155,7 +155,7 @@ check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ) check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) -check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) +check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S) check_symbol_exists(memcpy string.h HAVE_MEMCPY) check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 315c1d1..df8d5e4 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -69,6 +69,10 @@ to 0 if you don't. */ #cmakedefine01 HAVE_DECL_SETINFORMATIONJOBOBJECT +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_STRERROR_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} @@ -375,9 +379,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} -/* Define to 1 if you have the `strerror_s' function. */ -#cmakedefine HAVE_STRERROR_S ${HAVE_STRERROR_S} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 4725179..2038c9f 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -85,6 +85,10 @@ to 0 if you don't. */ #undef HAVE_DECL_SETINFORMATIONJOBOBJECT +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -391,9 +395,6 @@ /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R -/* Define to 1 if you have the `strerror_s' function. */ -#undef HAVE_STRERROR_S - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H diff --git a/lib/Support/Errno.cpp b/lib/Support/Errno.cpp index 312d91e..c2a0f71 100644 --- a/lib/Support/Errno.cpp +++ b/lib/Support/Errno.cpp @@ -50,7 +50,7 @@ std::string StrError(int errnum) { # else strerror_r(errnum,buffer,MaxErrStrLen-1); # endif -#elif defined(HAVE_STRERROR_S) // Windows. +#elif HAVE_DECL_STRERROR_S // MSVCRT.DLL does not provide one. if (errnum) strerror_s(buffer, errnum); #elif defined(HAVE_STRERROR) -- 1.7.1.GIT -------------- next part -------------- From ee39daa4e561e41415da3a24fc5094e3107f8fbd Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 3 Feb 2011 12:41:25 +0900 Subject: [PATCH 16/18] autoconf: Check _chsize_s's declaration. On mingw, _chsize_s requires MINGW_HAS_SECURE_API. --- autoconf/configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 972c5e5..20109b4 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1408,7 +1408,7 @@ AC_C_PRINTF_A AC_FUNC_RAND48 dnl Check the declaration "Secure API" on Windows environments. -AC_CHECK_DECLS([strerror_s]) +AC_CHECK_DECLS([_chsize_s,strerror_s],,,[#include ]) dnl Check symbols in libgcc.a for JIT on Mingw. if test "$llvm_cv_os_type" = "MingW" ; then -- 1.7.1.GIT -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-Regenerate-configure.patch.txt.gz Type: application/x-gzip Size: 1100 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/8385f6e3/attachment-0007.gz -------------- next part -------------- From c64d0a0ad3816f94532523c6d2361ec2929fb224 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 3 Feb 2011 12:43:38 +0900 Subject: [PATCH 18/18] Use HAVE_DECL__CHSIZE_S to check _chsize_s on Win32(s). --- cmake/config-ix.cmake | 2 +- include/llvm/Config/config.h.cmake | 7 ++++--- include/llvm/Config/config.h.in | 4 ++++ lib/Support/Windows/PathV2.inc | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 951bed8..7551e33 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -160,7 +160,7 @@ check_symbol_exists(memcpy string.h HAVE_MEMCPY) check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) if ( LLVM_ON_WIN32 ) - check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) + check_symbol_exists(_chsize_s io.h HAVE_DECL__CHSIZE_S) check_symbol_exists(SetInformationJobObject windows.h HAVE_DECL_SETINFORMATIONJOBOBJECT) check_function_exists(_alloca HAVE__ALLOCA) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index df8d5e4..092b24b 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -73,6 +73,10 @@ don't. */ #cmakedefine01 HAVE_DECL_STRERROR_S +/* Define to 1 if you have the declaration of `_chsize_s', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL__CHSIZE_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} @@ -717,9 +721,6 @@ /* Define to a function implementing strdup */ #cmakedefine strdup ${strdup} -/* Define to 1 if you have the `_chsize_s' function. */ -#cmakedefine HAVE__CHSIZE_S ${HAVE__CHSIZE_S} - /* define if the compiler implements namespaces */ #undef HAVE_NAMESPACES diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 2038c9f..64b2811 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -89,6 +89,10 @@ don't. */ #undef HAVE_DECL_STRERROR_S +/* Define to 1 if you have the declaration of `_chsize_s', and to 0 if you + don't. */ +#undef HAVE_DECL__CHSIZE_S + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H diff --git a/lib/Support/Windows/PathV2.inc b/lib/Support/Windows/PathV2.inc index b36b291..e8085c3 100644 --- a/lib/Support/Windows/PathV2.inc +++ b/lib/Support/Windows/PathV2.inc @@ -328,7 +328,7 @@ error_code resize_file(const Twine &path, uint64_t size) { int fd = ::_wopen(path_utf16.begin(), O_BINARY, S_IREAD | S_IWRITE); if (fd == -1) return error_code(errno, generic_category()); -#ifdef HAVE__CHSIZE_S +#if defined(HAVE_DECL__CHSIZE_S) && HAVE_DECL__CHSIZE_S errno_t error = ::_chsize_s(fd, size); #else errno_t error = ::_chsize(fd, size); -- 1.7.1.GIT From ofv at wanadoo.es Thu Feb 3 23:02:02 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Fri, 04 Feb 2011 06:02:02 +0100 Subject: [llvm-commits] [Review request][Win64] Patches for Mingw-w64(and mingw64-clang) In-Reply-To: (NAKAMURA Takumi's message of "Fri, 4 Feb 2011 13:24:54 +0900") References: <87zkqhggv2.fsf@wanadoo.es> <5D4E2204-78B8-4011-91AF-17E5B2E5C79B@apple.com> <87aaigh6mn.fsf@wanadoo.es> <8762t4h5np.fsf@wanadoo.es> Message-ID: <87aaice6k5.fsf@wanadoo.es> Hello Takumi. NAKAMURA Takumi writes: > I re-tweaked configurations. Here is my "take 2" patchset. (last one > was simply reformatted) > Please look at what you would like to look at. ;) I don't have time to look at the patches in detail and attaching so much of them including git headers and statistics doesn't make the job any easier. [It would be a good thing if we established a policy for reviewing series of patches git-style, with one message per patch. It is so convenient when it is done right.] A quick glance reveals no terrible things, so if you tested your changes with the cmake build it is okay with me. From geek4civic at gmail.com Thu Feb 3 23:24:03 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 4 Feb 2011 14:24:03 +0900 Subject: [llvm-commits] [llvm] r124816 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake cmake/modules/LLVM.cmake cmake/modules/TableGen.cmake utils/TableGen/CMakeLists.txt In-Reply-To: <20110203205736.794452A6C12C@llvm.org> References: <20110203205736.794452A6C12C@llvm.org> Message-ID: Oscar, > --- llvm/trunk/CMakeLists.txt (original) > +++ llvm/trunk/CMakeLists.txt Thu Feb ?3 14:57:36 2011 > +include(config-ix) > + > +include(HandleLLVMOptions) It is suspious. In my case, "LLVM_ON_WIN32" was undefined in config-ix. ...Takumi From ofv at wanadoo.es Thu Feb 3 23:40:04 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Fri, 04 Feb 2011 05:40:04 -0000 Subject: [llvm-commits] [llvm] r124857 - /llvm/trunk/cmake/config-ix.cmake Message-ID: <20110204054004.EC2D62A6C12C@llvm.org> Author: ofv Date: Thu Feb 3 23:40:04 2011 New Revision: 124857 URL: http://llvm.org/viewvc/llvm-project?rev=124857&view=rev Log: LLVM_ON_WIN32 is not defined on config-ix.cmake. Use something else. Modified: llvm/trunk/cmake/config-ix.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=124857&r1=124856&r2=124857&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Thu Feb 3 23:40:04 2011 @@ -1,3 +1,8 @@ +if( WIN32 AND NOT CYGWIN ) + # We consider Cygwin as another Unix + set(PURE_WINDOWS 1) +endif() + include(CheckIncludeFile) include(CheckLibraryExists) include(CheckSymbolExists) @@ -46,7 +51,7 @@ check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) check_include_file(memory.h HAVE_MEMORY_H) check_include_file(ndir.h HAVE_NDIR_H) -if( NOT LLVM_ON_WIN32 ) +if( NOT PURE_WINDOWS ) check_include_file(pthread.h HAVE_PTHREAD_H) endif() check_include_file(setjmp.h HAVE_SETJMP_H) @@ -78,7 +83,7 @@ check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H) # library checks -if( NOT LLVM_ON_WIN32 ) +if( NOT PURE_WINDOWS ) check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC) check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT) @@ -126,7 +131,7 @@ check_symbol_exists(strcmp string.h HAVE_STRCMP) check_symbol_exists(strdup string.h HAVE_STRDUP) check_symbol_exists(strrchr string.h HAVE_STRRCHR) -if( NOT LLVM_ON_WIN32 ) +if( NOT PURE_WINDOWS ) check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) endif() check_symbol_exists(sbrk unistd.h HAVE_SBRK) @@ -148,7 +153,7 @@ check_symbol_exists(memcpy string.h HAVE_MEMCPY) check_symbol_exists(memmove string.h HAVE_MEMMOVE) check_symbol_exists(setenv stdlib.h HAVE_SETENV) -if ( LLVM_ON_WIN32 ) +if( PURE_WINDOWS ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) endif() if( HAVE_ARGZ_H ) From ofv at wanadoo.es Thu Feb 3 23:46:50 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Fri, 04 Feb 2011 06:46:50 +0100 Subject: [llvm-commits] [llvm] r124816 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake cmake/modules/CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake cmake/modules/LLVM.cmake cmake/modules/TableGen.cmake utils/TableGen/CMakeLists.txt In-Reply-To: (NAKAMURA Takumi's message of "Fri, 4 Feb 2011 14:24:03 +0900") References: <20110203205736.794452A6C12C@llvm.org> Message-ID: <8762t0e4hh.fsf@wanadoo.es> NAKAMURA Takumi writes: > It is suspious. In my case, "LLVM_ON_WIN32" was undefined in config-ix. Thanks. It should be fixed now. The recent changes made to the cmake build were not thoroughly tested on Windows, so expect some row edges there. From baldrick at free.fr Fri Feb 4 01:45:04 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 04 Feb 2011 08:45:04 +0100 Subject: [llvm-commits] [llvm] r124826 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch-to-icmp.ll In-Reply-To: <20110203225141.ABC872A6C12C@llvm.org> References: <20110203225141.ABC872A6C12C@llvm.org> Message-ID: <4D4BAE80.20109@free.fr> Hi Benjamin, > SimplifyCFG: Also transform switches that represent a range comparison but are not sorted into sub+icmp. how about having a separate simplifycfg transform that reorders switch cases so that they are sorted. Then all transforms can rely on them being sorted. Ciao, Duncan. From geek4civic at gmail.com Fri Feb 4 03:36:34 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 4 Feb 2011 18:36:34 +0900 Subject: [llvm-commits] Fix floating point numbers in tests on MinGW In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> Message-ID: Danil, Your patch was effective, (I guess you have expected), only on mingw. In fact, it is fine on mingw. I cannot pick up your patch now yet. rationale... - It does not improve anything with msvc runtime and msvc build environment. - It would be useful on mingw for testing. - We expect identical output on standalone tools. (eg. llvm-dis, clang -emit-llvm, &c...) Your patch is so simple but I am afraid of potentially hiding consistency. I will wait for 2nd opinion. Thank you! ...Takumi From geek4civic at gmail.com Fri Feb 4 06:53:04 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 04 Feb 2011 12:53:04 -0000 Subject: [llvm-commits] [llvm] r124864 - in /llvm/trunk: lib/Support/Windows/PathV2.inc lib/Support/Windows/Windows.h lib/Support/Windows/system_error.inc utils/unittest/UnitTestMain/TestMain.cpp Message-ID: <20110204125304.A30852A6C12C@llvm.org> Author: chapuni Date: Fri Feb 4 06:53:04 2011 New Revision: 124864 URL: http://llvm.org/viewvc/llvm-project?rev=124864&view=rev Log: Make Win32's header file name lower for cross build on case-sensitive filesystem. Modified: llvm/trunk/lib/Support/Windows/PathV2.inc llvm/trunk/lib/Support/Windows/Windows.h llvm/trunk/lib/Support/Windows/system_error.inc llvm/trunk/utils/unittest/UnitTestMain/TestMain.cpp Modified: llvm/trunk/lib/Support/Windows/PathV2.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/PathV2.inc?rev=124864&r1=124863&r2=124864&view=diff ============================================================================== --- llvm/trunk/lib/Support/Windows/PathV2.inc (original) +++ llvm/trunk/lib/Support/Windows/PathV2.inc Fri Feb 4 06:53:04 2011 @@ -17,7 +17,7 @@ //===----------------------------------------------------------------------===// #include "Windows.h" -#include +#include #include #include #include Modified: llvm/trunk/lib/Support/Windows/Windows.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Windows.h?rev=124864&r1=124863&r2=124864&view=diff ============================================================================== --- llvm/trunk/lib/Support/Windows/Windows.h (original) +++ llvm/trunk/lib/Support/Windows/Windows.h Fri Feb 4 06:53:04 2011 @@ -22,8 +22,8 @@ #define WIN32_LEAN_AND_MEAN #include "llvm/Config/config.h" // Get build system configuration settings -#include -#include +#include +#include #include #include Modified: llvm/trunk/lib/Support/Windows/system_error.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/system_error.inc?rev=124864&r1=124863&r2=124864&view=diff ============================================================================== --- llvm/trunk/lib/Support/Windows/system_error.inc (original) +++ llvm/trunk/lib/Support/Windows/system_error.inc Fri Feb 4 06:53:04 2011 @@ -17,8 +17,8 @@ //=== is guaranteed to work on *all* Windows variants. //===----------------------------------------------------------------------===// -#include -#include +#include +#include using namespace llvm; Modified: llvm/trunk/utils/unittest/UnitTestMain/TestMain.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/UnitTestMain/TestMain.cpp?rev=124864&r1=124863&r2=124864&view=diff ============================================================================== --- llvm/trunk/utils/unittest/UnitTestMain/TestMain.cpp (original) +++ llvm/trunk/utils/unittest/UnitTestMain/TestMain.cpp Fri Feb 4 06:53:04 2011 @@ -13,7 +13,7 @@ #if defined(LLVM_ON_WIN32) -# include +# include # if defined(_MSC_VER) # include # endif From greened at obbligato.org Fri Feb 4 10:08:29 2011 From: greened at obbligato.org (David Greene) Date: Fri, 04 Feb 2011 16:08:29 -0000 Subject: [llvm-commits] [llvm] r124868 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h X86InstrFragmentsSIMD.td X86InstrSSE.td Message-ID: <20110204160829.7D8F32A6C12C@llvm.org> Author: greened Date: Fri Feb 4 10:08:29 2011 New Revision: 124868 URL: http://llvm.org/viewvc/llvm-project?rev=124868&view=rev Log: [AVX] Support VSINSERTF128 with more patterns and appropriate infrastructure. This makes lowering 256-bit vectors to 128-bit vectors simple when 256-bit vector support is not available. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124868&r1=124867&r2=124868&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 4 10:08:29 2011 @@ -3281,6 +3281,25 @@ return Result; } +/// isVINSERTF128Index - Return true if the specified INSERT_SUBVECTOR +/// operand specifies a subvector insert that is suitable for input to +/// VINSERTF128. +bool X86::isVINSERTF128Index(SDNode *N) { + if (!isa(N->getOperand(2).getNode())) + return false; + + // The index should be aligned on a 128-bit boundary. + uint64_t Index = + cast(N->getOperand(2).getNode())->getZExtValue(); + + unsigned VL = N->getValueType(0).getVectorNumElements(); + unsigned VBits = N->getValueType(0).getSizeInBits(); + unsigned ElSize = VBits / VL; + bool Result = (Index * ElSize) % 128 == 0; + + return Result; +} + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified VECTOR_SHUFFLE mask with PSHUF* and SHUFP* instructions. unsigned X86::getShuffleSHUFImmediate(SDNode *N) { @@ -3367,6 +3386,24 @@ return Index / NumElemsPerChunk; } +/// getInsertVINSERTF128Immediate - Return the appropriate immediate +/// to insert at the specified INSERT_SUBVECTOR index with VINSERTF128 +/// instructions. +unsigned X86::getInsertVINSERTF128Immediate(SDNode *N) { + if (!isa(N->getOperand(2).getNode())) + llvm_unreachable("Illegal insert subvector for VINSERTF128"); + + uint64_t Index = + cast(N->getOperand(2).getNode())->getZExtValue(); + + EVT VecVT = N->getValueType(0); + EVT ElVT = VecVT.getVectorElementType(); + + unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits(); + + return Index / NumElemsPerChunk; +} + /// isZeroNode - Returns true if Elt is a constant zero or a floating point /// constant +0.0. bool X86::isZeroNode(SDValue Elt) { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=124868&r1=124867&r2=124868&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Feb 4 10:08:29 2011 @@ -413,6 +413,11 @@ /// suitable for input to VEXTRACTF128. bool isVEXTRACTF128Index(SDNode *N); + /// isVINSERTF128Index - Return true if the specified + /// INSERT_SUBVECTOR operand specifies a subvector insert that is + /// suitable for input to VINSERTF128. + bool isVINSERTF128Index(SDNode *N); + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP* /// instructions. @@ -435,6 +440,11 @@ /// with VEXTRACTF128 instructions. unsigned getExtractVEXTRACTF128Immediate(SDNode *N); + /// getInsertVINSERTF128Immediate - Return the appropriate + /// immediate to insert at the specified INSERT_SUBVECTOR index + /// with VINSERTF128 instructions. + unsigned getInsertVINSERTF128Immediate(SDNode *N); + /// isZeroNode - Returns true if Elt is a constant zero or a floating point /// constant +0.0. bool isZeroNode(SDValue Elt); Modified: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td?rev=124868&r1=124867&r2=124868&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Fri Feb 4 10:08:29 2011 @@ -348,6 +348,12 @@ return getI8Imm(X86::getExtractVEXTRACTF128Immediate(N)); }]>; +// INSERT_get_vinsertf128_imm xform function: convert insert_subvector index to +// VINSERTF128 imm. +def INSERT_get_vinsertf128_imm : SDNodeXForm; + def splat_lo : PatFrag<(ops node:$lhs, node:$rhs), (vector_shuffle node:$lhs, node:$rhs), [{ ShuffleVectorSDNode *SVOp = cast(N); @@ -444,3 +450,10 @@ node:$index), [{ return X86::isVEXTRACTF128Index(N); }], EXTRACT_get_vextractf128_imm>; + +def vinsertf128_insert : PatFrag<(ops node:$bigvec, node:$smallvec, + node:$index), + (insert_subvector node:$bigvec, node:$smallvec, + node:$index), [{ + return X86::isVINSERTF128Index(N); +}], INSERT_get_vinsertf128_imm>; Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=124868&r1=124867&r2=124868&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Feb 4 10:08:29 2011 @@ -5436,6 +5436,23 @@ def : Pat<(int_x86_avx_vinsertf128_si_256 VR256:$src1, VR128:$src2, imm:$src3), (VINSERTF128rr VR256:$src1, VR128:$src2, imm:$src3)>; +def : Pat<(vinsertf128_insert:$ins (v8f32 VR256:$src1), (v4f32 VR128:$src2), + (i32 imm)), + (VINSERTF128rr VR256:$src1, VR128:$src2, + (INSERT_get_vinsertf128_imm VR256:$ins))>; +def : Pat<(vinsertf128_insert:$ins (v4f64 VR256:$src1), (v2f64 VR128:$src2), + (i32 imm)), + (VINSERTF128rr VR256:$src1, VR128:$src2, + (INSERT_get_vinsertf128_imm VR256:$ins))>; +def : Pat<(vinsertf128_insert:$ins (v8i32 VR256:$src1), (v4i32 VR128:$src2), + (i32 imm)), + (VINSERTF128rr VR256:$src1, VR128:$src2, + (INSERT_get_vinsertf128_imm VR256:$ins))>; +def : Pat<(vinsertf128_insert:$ins (v4i64 VR256:$src1), (v2i64 VR128:$src2), + (i32 imm)), + (VINSERTF128rr VR256:$src1, VR128:$src2, + (INSERT_get_vinsertf128_imm VR256:$ins))>; + def : Pat<(int_x86_avx_vextractf128_pd_256 VR256:$src1, imm:$src2), (VEXTRACTF128rr VR256:$src1, imm:$src2)>; def : Pat<(int_x86_avx_vextractf128_ps_256 VR256:$src1, imm:$src2), From greened at obbligato.org Fri Feb 4 10:14:57 2011 From: greened at obbligato.org (David A. Greene) Date: Fri, 04 Feb 2011 10:14:57 -0600 Subject: [llvm-commits] [llvm] r124672 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp In-Reply-To: <975D87B1-87B2-48E3-BF24-5F6831D9B7B4@apple.com> (Jim Grosbach's message of "Thu, 3 Feb 2011 15:28:37 -0800") References: <20110201191232.E7F842A6C12C@llvm.org> <975D87B1-87B2-48E3-BF24-5F6831D9B7B4@apple.com> Message-ID: Jim Grosbach writes: > Hi David, > > I'm getting some build warnings from clang when compiling this. Can you take a look? Yep. I'll have something in ASAP. -Dave From greened at obbligato.org Fri Feb 4 11:01:53 2011 From: greened at obbligato.org (David Greene) Date: Fri, 04 Feb 2011 17:01:53 -0000 Subject: [llvm-commits] [llvm] r124869 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Message-ID: <20110204170153.73DD32A6C12C@llvm.org> Author: greened Date: Fri Feb 4 11:01:53 2011 New Revision: 124869 URL: http://llvm.org/viewvc/llvm-project?rev=124869&view=rev Log: Silence uninitialized value warnings. Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=124869&r1=124868&r2=124869&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Feb 4 11:01:53 2011 @@ -383,7 +383,7 @@ // Okay, find the smallest type from the current set and remove it from the // largest set. - MVT::SimpleValueType SmallestInt; + MVT::SimpleValueType SmallestInt = MVT::LAST_VALUETYPE; for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) if (isInteger(TypeVec[i])) { SmallestInt = TypeVec[i]; @@ -393,7 +393,7 @@ if (isInteger(TypeVec[i]) && TypeVec[i] < SmallestInt) SmallestInt = TypeVec[i]; - MVT::SimpleValueType SmallestFP; + MVT::SimpleValueType SmallestFP = MVT::LAST_VALUETYPE; for (unsigned i = 0, e = TypeVec.size(); i != e; ++i) if (isFloatingPoint(TypeVec[i])) { SmallestFP = TypeVec[i]; @@ -439,7 +439,7 @@ // Okay, find the largest type in the Other set and remove it from the // current set. - MVT::SimpleValueType LargestInt = Other.TypeVec[0]; + MVT::SimpleValueType LargestInt = MVT::Other; for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) if (isInteger(Other.TypeVec[i])) { LargestInt = Other.TypeVec[i]; @@ -449,7 +449,7 @@ if (isInteger(Other.TypeVec[i]) && Other.TypeVec[i] > LargestInt) LargestInt = Other.TypeVec[i]; - MVT::SimpleValueType LargestFP; + MVT::SimpleValueType LargestFP = MVT::Other; for (unsigned i = 0, e = Other.TypeVec.size(); i != e; ++i) if (isFloatingPoint(Other.TypeVec[i])) { LargestFP = Other.TypeVec[i]; From daniel at zuster.org Fri Feb 4 11:12:15 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 04 Feb 2011 17:12:15 -0000 Subject: [llvm-commits] [llvm] r124870 - in /llvm/trunk: include/llvm/Target/Target.td utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <20110204171215.7FE862A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 4 11:12:15 2011 New Revision: 124870 URL: http://llvm.org/viewvc/llvm-project?rev=124870&view=rev Log: MC/AsmMatcher: Add support for custom conversion functions. Modified: llvm/trunk/include/llvm/Target/Target.td llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/include/llvm/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=124870&r1=124869&r2=124870&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/Target.td (original) +++ llvm/trunk/include/llvm/Target/Target.td Fri Feb 4 11:12:15 2011 @@ -248,6 +248,13 @@ /// Target-specific flags. This becomes the TSFlags field in TargetInstrDesc. bits<64> TSFlags = 0; + + ///@name Assembler Parser Support + ///@{ + + string AsmMatchConverter = ""; + + ///@} } /// Predicates - These are extra conditionals which are turned into instruction Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=124870&r1=124869&r2=124870&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri Feb 4 11:12:15 2011 @@ -1388,6 +1388,26 @@ ie = Infos.end(); it != ie; ++it) { MatchableInfo &II = **it; + // Check if we have a custom match function. + StringRef AsmMatchConverter = II.getResultInst()->TheDef->getValueAsString( + "AsmMatchConverter"); + if (!AsmMatchConverter.empty()) { + std::string Signature = "ConvertCustom_" + AsmMatchConverter.str(); + II.ConversionFnKind = Signature; + + // Check if we have already generated this signature. + if (!GeneratedFns.insert(Signature).second) + continue; + + // If not, emit it now. Add to the enum list. + OS << " " << Signature << ",\n"; + + CvtOS << " case " << Signature << ":\n"; + CvtOS << " " << AsmMatchConverter << "(Inst, Opcode, Operands);\n"; + CvtOS << " return;\n"; + continue; + } + // Build the conversion function signature. std::string Signature = "Convert"; std::string CaseBody; @@ -1988,7 +2008,6 @@ it != ie; ++it) { MatchableInfo &II = **it; - OS << " { " << Target.getName() << "::" << II.getResultInst()->TheDef->getName() << ", \"" << II.Mnemonic << "\"" << ", " << II.ConversionFnKind << ", { "; From daniel at zuster.org Fri Feb 4 11:12:18 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 04 Feb 2011 17:12:18 -0000 Subject: [llvm-commits] [llvm] r124871 - /llvm/trunk/unittests/Makefile.unittest Message-ID: <20110204171218.901AC2A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 4 11:12:18 2011 New Revision: 124871 URL: http://llvm.org/viewvc/llvm-project?rev=124871&view=rev Log: build: Add MAKEFILE_UNITTEST_NO_INCLUDE_COMMON build variable, to be leveraged by Clang. Modified: llvm/trunk/unittests/Makefile.unittest Modified: llvm/trunk/unittests/Makefile.unittest URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile.unittest?rev=124871&r1=124870&r2=124871&view=diff ============================================================================== --- llvm/trunk/unittests/Makefile.unittest (original) +++ llvm/trunk/unittests/Makefile.unittest Fri Feb 4 11:12:18 2011 @@ -14,7 +14,9 @@ # Set up variables for building a unit test. ifdef TESTNAME +ifndef MAKEFILE_UNITTEST_NO_INCLUDE_COMMON include $(LEVEL)/Makefile.common +endif LLVMUnitTestExe = $(BuildMode)/$(TESTNAME)Tests$(EXEEXT) From daniel at zuster.org Fri Feb 4 11:12:23 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 04 Feb 2011 17:12:23 -0000 Subject: [llvm-commits] [llvm] r124872 - in /llvm/trunk: lib/Target/ARM/AsmParser/ARMAsmParser.cpp lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <20110204171223.4739C2A6C12E@llvm.org> Author: ddunbar Date: Fri Feb 4 11:12:23 2011 New Revision: 124872 URL: http://llvm.org/viewvc/llvm-project?rev=124872&view=rev Log: MC/AsmParser: Add support for allowing the conversion process to fail (via custom conversion functions). Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=124872&r1=124871&r2=124872&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Feb 4 11:12:23 2011 @@ -1393,6 +1393,8 @@ } case Match_MnemonicFail: return Error(IDLoc, "unrecognized instruction mnemonic"); + case Match_ConversionFail: + return Error(IDLoc, "unable to convert operands to instruction"); } llvm_unreachable("Implement any new match types added!"); Modified: llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp?rev=124872&r1=124871&r2=124872&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp (original) +++ llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp Fri Feb 4 11:12:23 2011 @@ -334,6 +334,8 @@ return Error(IDLoc, "instruction use requires an option to be enabled"); case Match_MnemonicFail: return Error(IDLoc, "unrecognized instruction mnemonic"); + case Match_ConversionFail: + return Error(IDLoc, "unable to convert operands to instruction"); case Match_InvalidOperand: ErrorLoc = IDLoc; if (ErrorInfo != ~0U) { Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=124872&r1=124871&r2=124872&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Fri Feb 4 11:12:23 2011 @@ -842,6 +842,8 @@ case Match_MissingFeature: Error(IDLoc, "instruction requires a CPU feature not currently enabled"); return true; + case Match_ConversionFail: + return Error(IDLoc, "unable to convert operands to instruction"); case Match_InvalidOperand: WasOriginallyInvalidOperand = true; break; Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=124872&r1=124871&r2=124872&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri Feb 4 11:12:23 2011 @@ -1368,7 +1368,7 @@ std::set GeneratedFns; // Start the unified conversion function. - CvtOS << "static void ConvertToMCInst(ConversionKind Kind, MCInst &Inst, " + CvtOS << "static bool ConvertToMCInst(ConversionKind Kind, MCInst &Inst, " << "unsigned Opcode,\n" << " const SmallVectorImpl &Operands) {\n"; @@ -1403,8 +1403,8 @@ OS << " " << Signature << ",\n"; CvtOS << " case " << Signature << ":\n"; - CvtOS << " " << AsmMatchConverter << "(Inst, Opcode, Operands);\n"; - CvtOS << " return;\n"; + CvtOS << " return " << AsmMatchConverter + << "(Inst, Opcode, Operands);\n"; continue; } @@ -1479,12 +1479,13 @@ CvtOS << " case " << Signature << ":\n"; CvtOS << CaseOS.str(); - CvtOS << " return;\n"; + CvtOS << " return true;\n"; } // Finish the convert function. CvtOS << " }\n"; + CvtOS << " return false;\n"; CvtOS << "}\n\n"; // Finish the enum, and drop the convert function after it. @@ -1914,8 +1915,11 @@ OS << " unsigned ComputeAvailableFeatures(const " << Target.getName() << "Subtarget *Subtarget) const;\n"; OS << " enum MatchResultTy {\n"; - OS << " Match_Success, Match_MnemonicFail, Match_InvalidOperand,\n"; - OS << " Match_MissingFeature\n"; + OS << " Match_ConversionFail,\n"; + OS << " Match_InvalidOperand,\n"; + OS << " Match_MissingFeature,\n"; + OS << " Match_MnemonicFail,\n"; + OS << " Match_Success\n"; OS << " };\n"; OS << " bool MnemonicIsValid(StringRef Mnemonic);\n"; OS << " MatchResultTy MatchInstructionImpl(\n"; @@ -2132,9 +2136,14 @@ OS << " HadMatchOtherThanFeatures = true;\n"; OS << " continue;\n"; OS << " }\n"; - OS << "\n"; - OS << " ConvertToMCInst(it->ConvertFn, Inst, it->Opcode, Operands);\n"; + OS << " // We have selected a definite instruction, convert the parsed\n" + << " // operands into the appropriate MCInst.\n"; + OS << " if (!ConvertToMCInst(it->ConvertFn, Inst,\n" + << " it->Opcode, Operands))\n"; + OS << " return Match_ConversionFail;\n"; + OS << "\n"; + OS << " return Match_Success;\n"; // Call the post-processing function, if used. std::string InsnCleanupFn = From aggarwa4 at illinois.edu Fri Feb 4 11:49:42 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 04 Feb 2011 17:49:42 -0000 Subject: [llvm-commits] [poolalloc] r124876 - in /poolalloc/trunk/test: TEST.dsgraph.Makefile TEST.dsgraph.report Message-ID: <20110204174942.E90F92A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 4 11:49:42 2011 New Revision: 124876 URL: http://llvm.org/viewvc/llvm-project?rev=124876&view=rev Log: Correcting makefile, to get all the stats. Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile poolalloc/trunk/test/TEST.dsgraph.report Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.Makefile?rev=124876&r1=124875&r2=124876&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.dsgraph.Makefile (original) +++ poolalloc/trunk/test/TEST.dsgraph.Makefile Fri Feb 4 11:49:42 2011 @@ -24,7 +24,7 @@ ANALYZE_OPTS := -stats -time-passes -disable-output -dsstats #ANALYZE_OPTS := -stats -time-passes -dsstats -ANALYZE_OPTS += -instcount -disable-verify +ANALYZE_OPTS += -instcount -disable-verify -analyze MEM := -track-memory -time-passes -disable-output $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ @@ -44,10 +44,10 @@ - at grep 'Number of memory instructions' $@.time.1 >> $@ @echo >> $@ @/bin/echo -n "FOLDEDNODES: " >> $@ - - at grep 'Number of folded nodes' $@.time.1 >> $@ + - at grep 'Number of nodes completely folded' $@.time.1 >> $@ @echo >> $@ @/bin/echo -n "TOTALNODES: " >> $@ - - at grep 'Graphs contain.*nodes total' $@.time.1 >> $@ + - at grep 'Number of nodes allocated' $@.time.1 >> $@ @echo >> $@ @/bin/echo -n "MAXGRAPHSIZE: " >> $@ - at grep 'Maximum graph size' $@.time.1 >> $@ Modified: poolalloc/trunk/test/TEST.dsgraph.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.report?rev=124876&r1=124875&r2=124876&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.dsgraph.report (original) +++ poolalloc/trunk/test/TEST.dsgraph.report Fri Feb 4 11:49:42 2011 @@ -150,11 +150,11 @@ ["BUTDSz:" , sub { return SumCols(@_, 2); }], [], # Misc stuff - ["NumNodes", 'Graphs contain \\[([0-9+]+)\\] nodes total'], - ["NumFold" , '([0-9]+).*Number of folded nodes '], - ["MaxSz" , '([0-9]+).*Maximum graph size'], - ["GlobGr" , '\\.GlobalsGraph\\.dot\'... \\[([0-9+]+)\\]'], - ["MaxSCC" , '([0-9]+).*Maximum SCC Size in Call Graph'], + ["NumNodes", "TOTALNODES: *([0-9]+)"], + ["NumFold", "FOLDEDNODES: *([0-9]+)"], + ["MaxSz" , "MAXGRAPHSIZE: *([0-9]+)"], + ["GlobGr" , "GLOBALSGRAPH: *([0-9]+)"], + ["MaxSCC" , "SCCSIZE: *([0-9]+)"], [], ["TypeSafe", "ACCESSES TYPED: *([0-9]+)"], ["NonType", "ACCESSES UNTYPED: *([0-9]+)"], From aggarwa4 at illinois.edu Fri Feb 4 11:51:48 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 04 Feb 2011 17:51:48 -0000 Subject: [llvm-commits] [poolalloc] r124877 - /poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Message-ID: <20110204175148.638F32A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 4 11:51:48 2011 New Revision: 124877 URL: http://llvm.org/viewvc/llvm-project?rev=124877&view=rev Log: Do not care about users, that are never used. Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=124877&r1=124876&r2=124877&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original) +++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Fri Feb 4 11:51:48 2011 @@ -39,6 +39,8 @@ static bool isAddressTaken(Value* V) { for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { User *U = *I; + if(U->getNumUses() == 0) + continue; if (!isa(U) && !isa(U)) { if(isa(U)) { if(isAddressTaken(U)) @@ -53,9 +55,8 @@ // are never used } else { llvm::CallSite CS(cast(U)); - if (!CS.isCallee(I)) { + if (!CS.isCallee(I)) return true; - } } } return false; From aggarwa4 at illinois.edu Fri Feb 4 12:18:02 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 04 Feb 2011 18:18:02 -0000 Subject: [llvm-commits] [poolalloc] r124886 - in /poolalloc/trunk: lib/DSA/Local.cpp test/TEST.dsgraph.Makefile Message-ID: <20110204181802.1A6A32A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 4 12:18:01 2011 New Revision: 124886 URL: http://llvm.org/viewvc/llvm-project?rev=124886&view=rev Log: Added some code to help do better type inference. It is disabled by default. Modified: poolalloc/trunk/lib/DSA/Local.cpp poolalloc/trunk/test/TEST.dsgraph.Makefile Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=124886&r1=124885&r2=124886&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Fri Feb 4 12:18:01 2011 @@ -51,6 +51,10 @@ cl::opt hasMagicSections("dsa-magic-sections", cl::desc("File with section to global mapping")); //, cl::ReallyHidden); +static cl::opt TypeInferenceOptimize("enable-type-inference-opts", + cl::desc("Enable Type Inference Optimizations added to DSA."), + cl::Hidden, + cl::init(false)); } namespace { @@ -355,7 +359,6 @@ void GraphBuilder::visitLoadInst(LoadInst &LI) { DSNodeHandle Ptr = getValueDest(LI.getOperand(0)); - if (Ptr.isNull()) return; // Load from null // Make that the node is read from... @@ -501,24 +504,28 @@ unsigned Offset = 0; -#if 0 - + if(TypeInferenceOptimize) { // Trying to special case constant index "inbounds" GEPs - if(GetElementPtrInst *GEPInst = dyn_cast(&GEP)) { - if(GEPInst->isInBounds()) - if(GEPInst->hasAllConstantIndices()){ - if(GEPInst->getType() == llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext())) - if(GEPInst->getNumIndices() == 1) { - Offset = (cast(GEPInst->getOperand(1)))->getSExtValue(); - if(Value.getNode()->getSize() <= (Offset+8)) { - Value.getNode()->growSize(Offset + 8); + if(GetElementPtrInst *GEPInst = dyn_cast(&GEP)) { + if(GEPInst->isInBounds()) + if(GEPInst->hasAllConstantIndices()){ + if(GEPInst->getType() == llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext())) + if(GEPInst->getNumIndices() == 1) { + Offset = (cast(GEPInst->getOperand(1)))->getSExtValue(); + if(Value.getNode()->getSize() <= (Offset+1)) { + Value.getNode()->growSize(Offset + 1); + } + Value.setOffset(Value.getOffset()+Offset); + DSNode *N = Value.getNode(); + if((int)Offset < 0) + N->foldNodeCompletely(); + setDestTo(GEP, Value); + return; } - goto end; - } + } } } -#endif // FIXME: I am not sure if the code below is completely correct (especially // if we start doing fancy analysis on non-constant array indices). @@ -620,7 +627,6 @@ } } - // Add in the offset calculated... Value.setOffset(Value.getOffset()+Offset); Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.Makefile?rev=124886&r1=124885&r2=124886&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.dsgraph.Makefile (original) +++ poolalloc/trunk/test/TEST.dsgraph.Makefile Fri Feb 4 12:18:01 2011 @@ -27,10 +27,14 @@ ANALYZE_OPTS += -instcount -disable-verify -analyze MEM := -track-memory -time-passes -disable-output +#ifdef TYPE_INFERENCE_OPT +ANALYZE_OPTS += -enable-type-inference-opts +#endif + $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ Output/%.$(TEST).report.txt: Output/%.llvm.bc Output/%.LOC.txt $(LOPT) @# Gather data - -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 + -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 -($(RUNOPT) -dsa-$(PASS) -dsa-stdlib-no-fold $(ANALYZE_OPTS) $<)> $@.time.2 2>&1 -($(RUNOPT) $(MEM) -dsa-$(PASS) -disable-verify -debug-pass=Details $<)> $@.mem.1 2>&1 @# Emit data. From daniel at zuster.org Fri Feb 4 12:45:44 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 4 Feb 2011 10:45:44 -0800 Subject: [llvm-commits] [llvm] r113163 - in /llvm/trunk: lib/Target/ARM/AsmParser/ARMAsmParser.cpp lib/Target/X86/AsmParser/X86AsmLexer.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp utils/TableGen/AsmMatcherEmitter.cpp In-Reply-To: <20100906191101.8B6FD2A6C12D@llvm.org> References: <20100906191101.8B6FD2A6C12D@llvm.org> Message-ID: Hi Chris, On Mon, Sep 6, 2010 at 12:11 PM, Chris Lattner wrote: > Author: lattner > Date: Mon Sep ?6 14:11:01 2010 > New Revision: 113163 > > URL: http://llvm.org/viewvc/llvm-project?rev=113163&view=rev > Log: > have AsmMatcherEmitter.cpp produce the hunk of code that gets included > into the middle of the class, and rework how the different sections of > the generated file are conditionally included for simplicity. I personally find this to be a bit gross, it makes things more obscure. In particular, in the current incarnation certain types (MatchResultTy) which are static and could be defined in a common .h file are in an autogenerated file. I think there are a better approaches than using multiple inclusion: (1) Make these things proper pure virtual functions in the TargetAsmParser base class, and have the clients override them. Requires static casting of the ComputeAvailableFeatures argument, but this isn't a big deal. Pro: static type checking with good diagnostics. (2) Even if you don't want to do (1), it would still be cleaner to just generate multiple files in the matcher emitter, than to generate one file which is included multiple times. This isn't a big deal, of course... - Daniel > > Modified: > ? ?llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp > ? ?llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp > ? ?llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp > ? ?llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp > > Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=113163&r1=113162&r2=113163&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) > +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Sep ?6 14:11:01 2010 > @@ -95,11 +95,8 @@ > ? /// @name Auto-generated Match Functions > ? /// { > > - ?unsigned ComputeAvailableFeatures(const ARMSubtarget *Subtarget) const; > - > - ?bool MatchInstructionImpl(const SmallVectorImpl > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&Operands, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ?MCInst &Inst); > +#define GET_ASSEMBLER_HEADER > +#include "ARMGenAsmMatcher.inc" > > ? /// } > > @@ -869,4 +866,6 @@ > ? LLVMInitializeARMAsmLexer(); > ?} > > +#define GET_REGISTER_MATCHER > +#define GET_MATCHER_IMPLEMENTATION > ?#include "ARMGenAsmMatcher.inc" > > Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=113163&r1=113162&r2=113163&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original) > +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Mon Sep ?6 14:11:01 2010 > @@ -65,9 +65,10 @@ > ? } > ?}; > > -} > +} // end anonymous namespace > > -static unsigned MatchRegisterName(StringRef Name); > +#define GET_REGISTER_MATCHER > +#include "X86GenAsmMatcher.inc" > > ?AsmToken X86AsmLexer::LexTokenATT() { > ? AsmToken lexedToken = lexDefinite(); > @@ -162,7 +163,3 @@ > ? RegisterAsmLexer X(TheX86_32Target); > ? RegisterAsmLexer Y(TheX86_64Target); > ?} > - > -#define REGISTERS_ONLY > -#include "X86GenAsmMatcher.inc" > -#undef REGISTERS_ONLY > > Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=113163&r1=113162&r2=113163&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) > +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Sep ?6 14:11:01 2010 > @@ -56,12 +56,10 @@ > > ? /// @name Auto-generated Matcher Functions > ? /// { > - > - ?unsigned ComputeAvailableFeatures(const X86Subtarget *Subtarget) const; > - > - ?bool MatchInstructionImpl( > - ? ?const SmallVectorImpl &Operands, MCInst &Inst); > - > + > +#define GET_ASSEMBLER_HEADER > +#include "X86GenAsmMatcher.inc" > + > ? /// } > > ?public: > @@ -882,9 +880,6 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MCInst &Inst) { > ? assert(!Operands.empty() && "Unexpect empty operand list!"); > > - ?X86Operand *Op = static_cast(Operands[0]); > - ?assert(Op->isToken() && "Leading operand should always be a mnemonic!"); > - > ? // First, try a direct match. > ? if (!MatchInstructionImpl(Operands, Inst)) > ? ? return false; > @@ -894,6 +889,9 @@ > ? // type. However, that requires substantially more matcher support than the > ? // following hack. > > + ?X86Operand *Op = static_cast(Operands[0]); > + ?assert(Op->isToken() && "Leading operand should always be a mnemonic!"); > + > ? // Change the operand to point to a temporary token. > ? StringRef Base = Op->getToken(); > ? SmallString<16> Tmp; > @@ -966,4 +964,6 @@ > ? LLVMInitializeX86AsmLexer(); > ?} > > +#define GET_REGISTER_MATCHER > +#define GET_MATCHER_IMPLEMENTATION > ?#include "X86GenAsmMatcher.inc" > > Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=113163&r1=113162&r2=113163&view=diff > ============================================================================== > --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Sep ?6 14:11:01 2010 > @@ -1541,13 +1541,32 @@ > > ? EmitSourceFileHeader("Assembly Matcher Source Fragment", OS); > > + ?// Information for the class declaration. > + ?OS << "\n#ifdef GET_ASSEMBLER_HEADER\n"; > + ?OS << "#undef GET_ASSEMBLER_HEADER\n"; > + ?OS << " ?unsigned ComputeAvailableFeatures(const " << > + ? ? ? ? ? Target.getName() << "Subtarget *Subtarget) const;\n"; > + ?OS << "bool MatchInstructionImpl(const SmallVectorImpl" > + ? ? << " &Operands, MCInst &Inst);\n\n"; > + ?OS << "#endif // GET_ASSEMBLER_HEADER_INFO\n\n"; > + > + > + > + > + ?OS << "\n#ifdef GET_REGISTER_MATCHER\n"; > + ?OS << "#undef GET_REGISTER_MATCHER\n\n"; > + > ? // Emit the subtarget feature enumeration. > ? EmitSubtargetFeatureFlagEnumeration(Target, Info, OS); > > ? // Emit the function to match a register name to number. > ? EmitMatchRegisterName(Target, AsmParser, OS); > + > + ?OS << "#endif // GET_REGISTER_MATCHER\n\n"; > > - ?OS << "#ifndef REGISTERS_ONLY\n\n"; > + > + ?OS << "\n#ifdef GET_MATCHER_IMPLEMENTATION\n"; > + ?OS << "#undef GET_MATCHER_IMPLEMENTATION\n\n"; > > ? // Generate the unified function to convert operands into an MCInst. > ? EmitConvertToMCInst(Target, Info.Instructions, OS); > @@ -1658,16 +1677,17 @@ > ? ? ?<< "; it != ie; ++it) {\n"; > > ? // Emit check that the required features are available. > - ? ?OS << " ? ?if ((AvailableFeatures & it->RequiredFeatures) " > - ? ? ? << "!= it->RequiredFeatures)\n"; > - ? ?OS << " ? ? ?continue;\n"; > - > + ?OS << " ? ?if ((AvailableFeatures & it->RequiredFeatures) " > + ? ? << "!= it->RequiredFeatures)\n"; > + ?OS << " ? ? ?continue;\n"; > + > ? // Emit check that the subclasses match. > ? for (unsigned i = 0; i != MaxNumOperands; ++i) { > ? ? OS << " ? ?if (!IsSubclass(Classes[" > ? ? ? ?<< i << "], it->Classes[" << i << "]))\n"; > ? ? OS << " ? ? ?continue;\n"; > ? } > + > ? OS << "\n"; > ? OS << " ? ?ConvertToMCInst(it->ConvertFn, Inst, it->Opcode, Operands);\n"; > > @@ -1683,5 +1703,5 @@ > ? OS << " ?return true;\n"; > ? OS << "}\n\n"; > > - ?OS << "#endif // REGISTERS_ONLY\n"; > + ?OS << "#endif // GET_MATCHER_IMPLEMENTATION\n\n"; > ?} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From stoklund at 2pi.dk Fri Feb 4 13:33:07 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 19:33:07 -0000 Subject: [llvm-commits] [llvm] r124893 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110204193307.A72402A6C12C@llvm.org> Author: stoklund Date: Fri Feb 4 13:33:07 2011 New Revision: 124893 URL: http://llvm.org/viewvc/llvm-project?rev=124893&view=rev Log: Verify that one of the ranges produced by region splitting is allocatable. We should not be attempting a region split if it won't lead to at least one directly allocatable interval. That could cause infinite splitting loops. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124893&r1=124892&r2=124893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Feb 4 13:33:07 2011 @@ -812,8 +812,22 @@ // separate into connected components. Some components may be allocatable. SE.finish(); - if (VerifyEnabled) + if (VerifyEnabled) { MF->verify(this, "After splitting live range around region"); + +#ifndef NDEBUG + // Make sure that at least one of the new intervals can allocate to PhysReg. + // That was the whole point of splitting the live range. + bool found = false; + for (LiveRangeEdit::iterator I = LREdit.begin(), E = LREdit.end(); I != E; + ++I) + if (!checkUncachedInterference(**I, PhysReg)) { + found = true; + break; + } + assert(found && "No allocatable intervals after pointless splitting"); +#endif + } } unsigned RAGreedy::tryRegionSplit(LiveInterval &VirtReg, AllocationOrder &Order, From stoklund at 2pi.dk Fri Feb 4 13:33:11 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 19:33:11 -0000 Subject: [llvm-commits] [llvm] r124894 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineBasicBlock.cpp lib/CodeGen/SplitKit.cpp Message-ID: <20110204193311.76D932A6C12D@llvm.org> Author: stoklund Date: Fri Feb 4 13:33:11 2011 New Revision: 124894 URL: http://llvm.org/viewvc/llvm-project?rev=124894&view=rev Log: Add LiveIntervals::getLastSplitPoint(). A live range cannot be split everywhere in a basic block. A split must go before the first terminator, and if the variable is live into a landing pad, the split must happen before the call that can throw. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp llvm/trunk/lib/CodeGen/SplitKit.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=124894&r1=124893&r2=124894&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Fri Feb 4 13:33:11 2011 @@ -308,6 +308,12 @@ /// within a single basic block. bool intervalIsInOneMBB(const LiveInterval &li) const; + /// getLastSplitPoint - Return the last possible insertion point in mbb for + /// spilling and splitting code. This is the first terminator, or the call + /// instruction if li is live into a landing pad successor. + MachineBasicBlock::iterator getLastSplitPoint(const LiveInterval &li, + MachineBasicBlock *mbb); + private: /// computeIntervals - Compute live intervals. void computeIntervals(); Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=124894&r1=124893&r2=124894&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Fri Feb 4 13:33:11 2011 @@ -224,6 +224,10 @@ /// this basic block is entered via an exception handler. void setIsLandingPad() { IsLandingPad = true; } + /// getLandingPadSuccessor - If this block has a successor that is a landing + /// pad, return it. Otherwise return NULL. + const MachineBasicBlock *getLandingPadSuccessor() const; + // Code Layout methods. /// moveBefore/moveAfter - move 'this' block before or after the specified Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=124894&r1=124893&r2=124894&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Feb 4 13:33:11 2011 @@ -746,6 +746,28 @@ // Register allocator hooks. // +MachineBasicBlock::iterator +LiveIntervals::getLastSplitPoint(const LiveInterval &li, + MachineBasicBlock *mbb) { + const MachineBasicBlock *lpad = mbb->getLandingPadSuccessor(); + + // If li is not live into a landing pad, we can insert spill code before the + // first terminator. + if (!lpad || !isLiveInToMBB(li, lpad)) + return mbb->getFirstTerminator(); + + // When there is a landing pad, spill code must go before the call instruction + // that can throw. + MachineBasicBlock::iterator I = mbb->end(), B = mbb->begin(); + while (I != B) { + --I; + if (I->getDesc().isCall()) + return I; + } + assert(0 && "Block with landing pad successor contains no call instruction"); + return mbb->getFirstTerminator(); +} + /// getReMatImplicitUse - If the remat definition MI has one (for now, we only /// allow one) virtual register operand, then its uses are implicitly using /// the register. Returns the virtual register. Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=124894&r1=124893&r2=124894&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Fri Feb 4 13:33:11 2011 @@ -175,6 +175,16 @@ return end(); } +const MachineBasicBlock *MachineBasicBlock::getLandingPadSuccessor() const { + // A block with a landing pad successor only has one other successor. + if (succ_size() > 2) + return 0; + for (const_succ_iterator I = succ_begin(), E = succ_end(); I != E; ++I) + if ((*I)->isLandingPad()) + return *I; + return 0; +} + void MachineBasicBlock::dump() const { print(dbgs()); } Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124894&r1=124893&r2=124894&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.cpp (original) +++ llvm/trunk/lib/CodeGen/SplitKit.cpp Fri Feb 4 13:33:11 2011 @@ -826,7 +826,7 @@ } DEBUG(dbgs() << ": valno " << ParentVNI->id); VNInfo *VNI = defFromParent(OpenIdx, ParentVNI, Last, MBB, - MBB.getFirstTerminator()); + LIS.getLastSplitPoint(Edit.getParent(), &MBB)); RegAssign.insert(VNI->def, End, OpenIdx); DEBUG(dump()); return VNI->def; From jason.w.kim.2009 at gmail.com Fri Feb 4 13:47:15 2011 From: jason.w.kim.2009 at gmail.com (Jason W Kim) Date: Fri, 04 Feb 2011 19:47:15 -0000 Subject: [llvm-commits] [llvm] r124895 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp lib/MC/MachObjectWriter.cpp lib/Target/ARM/ARMAsmBackend.cpp lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMFixupKinds.h lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMMCCodeEmitter.cpp test/MC/ARM/arm_fixups.s utils/TableGen/EDEmitter.cpp Message-ID: <20110204194716.140562A6C12E@llvm.org> Author: jasonwkim Date: Fri Feb 4 13:47:15 2011 New Revision: 124895 URL: http://llvm.org/viewvc/llvm-project?rev=124895&view=rev Log: Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps. (yes, this is different from R_ARM_CALL) - Adds a new method getARMBranchTargetOpValue() which handles the necessary distinction between the conditional and unconditional br/bl needed for ARM/ELF At least for ARM mode, the needed fixup for conditional versus unconditional br/bl is identical, but the ARM docs and existing ARM tools expect this reloc type... Added a few FIXME's for future naming fixups in ARMInstrInfo.td Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp llvm/trunk/lib/MC/MachObjectWriter.cpp llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMFixupKinds.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp llvm/trunk/test/MC/ARM/arm_fixups.s llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri Feb 4 13:47:15 2011 @@ -1503,7 +1503,7 @@ break; } break; - case ARM::fixup_arm_branch: + case ARM::fixup_arm_uncondbranch: switch (Modifier) { case MCSymbolRefExpr::VK_ARM_PLT: Type = ELF::R_ARM_PLT32; @@ -1513,6 +1513,9 @@ break; } break; + case ARM::fixup_arm_condbranch: + Type = ELF::R_ARM_JUMP24; + break; case ARM::fixup_arm_movt_hi16: case ARM::fixup_arm_movt_hi16_pcrel: Type = ELF::R_ARM_MOVT_PREL; @@ -1565,11 +1568,12 @@ case ARM::fixup_arm_thumb_br: assert(0 && "Unimplemented"); break; - case ARM::fixup_arm_branch: - // FIXME: Differentiate between R_ARM_CALL and - // R_ARM_JUMP24 (latter used for conditional jumps) + case ARM::fixup_arm_uncondbranch: Type = ELF::R_ARM_CALL; break; + case ARM::fixup_arm_condbranch: + Type = ELF::R_ARM_JUMP24; + break; case ARM::fixup_arm_movt_hi16: Type = ELF::R_ARM_MOVT_ABS; break; Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/MC/MachObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/MachObjectWriter.cpp Fri Feb 4 13:47:15 2011 @@ -940,7 +940,8 @@ case ARM::fixup_arm_ldst_pcrel_12: case ARM::fixup_arm_pcrel_10: case ARM::fixup_arm_adr_pcrel_12: - case ARM::fixup_arm_branch: + case ARM::fixup_arm_condbranch: + case ARM::fixup_arm_uncondbranch: RelocType = unsigned(macho::RIT_ARM_Branch24Bit); // Report as 'long', even though that is not quite accurate. Log2Size = llvm::Log2_32(4); Modified: llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Fri Feb 4 13:47:15 2011 @@ -67,7 +67,8 @@ { "fixup_arm_adr_pcrel_12", 1, 24, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_t2_adr_pcrel_12", 0, 32, MCFixupKindInfo::FKF_IsPCRel | MCFixupKindInfo::FKF_IsAlignedDownTo32Bits}, -{ "fixup_arm_branch", 0, 24, MCFixupKindInfo::FKF_IsPCRel }, +{ "fixup_arm_condbranch", 0, 24, MCFixupKindInfo::FKF_IsPCRel }, +{ "fixup_arm_uncondbranch", 0, 24, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_t2_condbranch", 0, 32, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_t2_uncondbranch", 0, 32, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_arm_thumb_br", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, @@ -254,7 +255,8 @@ return swapped; } - case ARM::fixup_arm_branch: + case ARM::fixup_arm_condbranch: + case ARM::fixup_arm_uncondbranch: // These values don't encode the low two bits since they're always zero. // Offset by 8 just as above. return 0xffffff & ((Value - 8) >> 2); @@ -454,7 +456,8 @@ case ARM::fixup_arm_ldst_pcrel_12: case ARM::fixup_arm_pcrel_10: case ARM::fixup_arm_adr_pcrel_12: - case ARM::fixup_arm_branch: + case ARM::fixup_arm_condbranch: + case ARM::fixup_arm_uncondbranch: return 3; case FK_Data_4: Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Feb 4 13:47:15 2011 @@ -187,6 +187,8 @@ const { return 0; } unsigned getUnconditionalBranchTargetOpValue(const MachineInstr &MI, unsigned Op) const { return 0; } + unsigned getARMBranchTargetOpValue(const MachineInstr &MI, unsigned Op) + const { return 0; } unsigned getCCOutOpValue(const MachineInstr &MI, unsigned Op) const { return 0; } unsigned getSOImmOpValue(const MachineInstr &MI, unsigned Op) Modified: llvm/trunk/lib/Target/ARM/ARMFixupKinds.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFixupKinds.h?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFixupKinds.h (original) +++ llvm/trunk/lib/Target/ARM/ARMFixupKinds.h Fri Feb 4 13:47:15 2011 @@ -40,9 +40,12 @@ // fixup_t2_adr_pcrel_12 - 12-bit PC relative relocation for the ADR // instruction. fixup_t2_adr_pcrel_12, - // fixup_arm_branch - 24-bit PC relative relocation for direct branch - // instructions. - fixup_arm_branch, + // fixup_arm_condbranch - 24-bit PC relative relocation for conditional branch + // instructions. + fixup_arm_condbranch, + // fixup_arm_uncondbranch - 24-bit PC relative relocation for + // branch instructions. (unconditional) + fixup_arm_uncondbranch, // fixup_t2_condbranch - 20-bit PC relative relocation for Thumb2 direct // uconditional branch instructions. fixup_t2_condbranch, Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Fri Feb 4 13:47:15 2011 @@ -293,20 +293,36 @@ // // Branch target. +// FIXME: rename brtarget to t2_brtarget def brtarget : Operand { let EncoderMethod = "getBranchTargetOpValue"; } +// FIXME: get rid of this one? def uncondbrtarget : Operand { let EncoderMethod = "getUnconditionalBranchTargetOpValue"; } +// Branch target for ARM. Handles conditional/unconditional +def br_target : Operand { + let EncoderMethod = "getARMBranchTargetOpValue"; +} + // Call target. +// FIXME: rename bltarget to t2_bl_target? def bltarget : Operand { // Encoded the same as branch targets. let EncoderMethod = "getBranchTargetOpValue"; } +// Call target for ARM. Handles conditional/unconditional +// FIXME: rename bl_target to t2_bltarget? +def bl_target : Operand { + // Encoded the same as branch targets. + let EncoderMethod = "getARMBranchTargetOpValue"; +} + + // A list of registers separated by comma. Used by load/store multiple. def RegListAsmOperand : AsmOperandClass { let Name = "RegList"; @@ -1271,7 +1287,7 @@ D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR], Uses = [SP] in { - def BL : ABXI<0b1011, (outs), (ins bltarget:$func, variable_ops), + def BL : ABXI<0b1011, (outs), (ins bl_target:$func, variable_ops), IIC_Br, "bl\t$func", [(ARMcall tglobaladdr:$func)]>, Requires<[IsARM, IsNotDarwin]> { @@ -1280,7 +1296,7 @@ let Inst{23-0} = func; } - def BL_pred : ABI<0b1011, (outs), (ins bltarget:$func, variable_ops), + def BL_pred : ABI<0b1011, (outs), (ins bl_target:$func, variable_ops), IIC_Br, "bl", "\t$func", [(ARMcall_pred tglobaladdr:$func)]>, Requires<[IsARM, IsNotDarwin]> { @@ -1456,7 +1472,7 @@ // FIXME: should be able to write a pattern for ARMBrcond, but can't use // a two-value operand where a dag node expects two operands. :( - def Bcc : ABI<0b1010, (outs), (ins brtarget:$target), + def Bcc : ABI<0b1010, (outs), (ins br_target:$target), IIC_Br, "b", "\t$target", [/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]> { bits<24> target; Modified: llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp Fri Feb 4 13:47:15 2011 @@ -99,6 +99,10 @@ uint32_t getUnconditionalBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, SmallVectorImpl &Fixups) const; + /// getARMBranchTargetOpValue - Return encoding info for 24-bit immediate + /// branch target. + uint32_t getARMBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, + SmallVectorImpl &Fixups) const; /// getAdrLabelOpValue - Return encoding info for 12-bit immediate /// ADR label target. @@ -473,6 +477,23 @@ return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_cb, Fixups); } +/// Return true if this branch has a non-always predication +static bool HasConditionalBranch(const MCInst &MI) { + int NumOp = MI.getNumOperands(); + if (NumOp >= 2) { + for (int i = 0; i < NumOp-1; ++i) { + const MCOperand &MCOp1 = MI.getOperand(i); + const MCOperand &MCOp2 = MI.getOperand(i + 1); + if (MCOp1.isImm() && MCOp2.isReg() && + (MCOp2.getReg() == 0 || MCOp2.getReg() == ARM::CPSR)) { + if (ARMCC::CondCodes(MCOp1.getImm()) != ARMCC::AL) + return true; + } + } + } + return false; +} + /// getBranchTargetOpValue - Return encoding info for 24-bit immediate branch /// target. uint32_t ARMMCCodeEmitter:: @@ -483,9 +504,24 @@ if (Subtarget->isThumb2()) return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_t2_condbranch, Fixups); - return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_branch, Fixups); + return getARMBranchTargetOpValue(MI, OpIdx, Fixups); +} + +/// getBranchTargetOpValue - Return encoding info for 24-bit immediate branch +/// target. +uint32_t ARMMCCodeEmitter:: +getARMBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, + SmallVectorImpl &Fixups) const { + if (HasConditionalBranch(MI)) + return ::getBranchTargetOpValue(MI, OpIdx, + ARM::fixup_arm_condbranch, Fixups); + return ::getBranchTargetOpValue(MI, OpIdx, + ARM::fixup_arm_uncondbranch, Fixups); } + + + /// getUnconditionalBranchTargetOpValue - Return encoding info for 24-bit /// immediate branch target. uint32_t ARMMCCodeEmitter:: Modified: llvm/trunk/test/MC/ARM/arm_fixups.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm_fixups.s?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/test/MC/ARM/arm_fixups.s (original) +++ llvm/trunk/test/MC/ARM/arm_fixups.s Fri Feb 4 13:47:15 2011 @@ -2,6 +2,6 @@ // RUN: FileCheck < %t %s // CHECK: bl _printf @ encoding: [A,A,A,0xeb] -// CHECK: @ fixup A - offset: 0, value: _printf, kind: fixup_arm_branch +// CHECK: @ fixup A - offset: 0, value: _printf, kind: fixup_arm_uncondbranch bl _printf \ No newline at end of file Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=124895&r1=124894&r2=124895&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Fri Feb 4 13:47:15 2011 @@ -325,6 +325,9 @@ PCR("uncondbrtarget"); PCR("bltarget"); + // all I, ARM mode only, conditional/unconditional + PCR("br_target"); + PCR("bl_target"); return 1; } @@ -600,6 +603,10 @@ MISC("t_bcctarget", "kOperandTypeARMBranchTarget"); // ? MISC("t_cbtarget", "kOperandTypeARMBranchTarget"); // ? MISC("bltarget", "kOperandTypeARMBranchTarget"); // ? + + MISC("br_target", "kOperandTypeARMBranchTarget"); // ? + MISC("bl_target", "kOperandTypeARMBranchTarget"); // ? + MISC("t_bltarget", "kOperandTypeARMBranchTarget"); // ? MISC("t_blxtarget", "kOperandTypeARMBranchTarget"); // ? MISC("so_reg", "kOperandTypeARMSoReg"); // R, R, I From dmalyshev at accesssoftek.com Fri Feb 4 13:55:07 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Fri, 4 Feb 2011 11:55:07 -0800 Subject: [llvm-commits] Test check_binary_output.ll Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AB1B@mail.accesssoftek.com> Hello Daniel, One of my patches has failed on one of yours buildslaves (on llvm-i686-linux to be specific). The patch itself looks innocent and shouldn't fail at all, especially on Linux :) Now that buildslave seems off-line for a long time. I'd like to reproduce the issue or confirm that that was just something wrong with the buildslave. Would you help me with some information, please? 1. What's the exact configuration of that buildslave (uname -a, and development toolchain)? 2. What's the status of that buildslave and is it going to be back on-line anytime soon? 3. Is it possible that the build http://google1.osuosl.org:8011/builders/llvm-i686-linux/builds/155 has failed because of some buildslave configuration issues? Thanks, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/9b098820/attachment.html From jasonwkim at google.com Fri Feb 4 14:15:05 2011 From: jasonwkim at google.com (Jason Kim) Date: Fri, 4 Feb 2011 12:15:05 -0800 Subject: [llvm-commits] [PATCH] ARM/MC/ELF e_flags fixup - add an ARMMCCodeEmitterBase class? Message-ID: Hi everyone, With some chagrin, I discovered that the existing ARM/GNU tool chain requires a non-zero ELF e_flags field. Specifically, a nonzero value between 4 and 5 for the EF_ARM_EABIMASK Without this field, none of the ELF .o files link properly! Adding it in is easy enough to do, but the right place to do this seems to be within ARMSubtarget, which is problematic. So the workaround is to add a small ARMMCCodeEmitterBase class to hold the e_flags value to be emitted. I can just as easily just hack this in within ARMELFObjectWriter, but this seems to be messier, as I can forsee different values being emitted depending on which ABI version LLVM should emit code for - which seems to belong in ARMSubtarget (which is hidden from the MC backend ...) In any case, some form of this flag value needs to be emitted. Otherwise none of the ELF .o files will be linkable with existing tools (!) Is it OK to add in this class? Is there a better place to put this flag? Should I just hardcode in 5 (which is current, but existing tools seem to like 4 too.)? Thanks! -jason -------------- next part -------------- A non-text attachment was scrubbed... Name: arm-mc-elf-s36-attrs.patch Type: text/x-patch Size: 7996 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/182b9277/attachment.bin From grosbach at apple.com Fri Feb 4 14:21:14 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 4 Feb 2011 12:21:14 -0800 Subject: [llvm-commits] [PATCH] ARM/MC/ELF e_flags fixup - add an ARMMCCodeEmitterBase class? In-Reply-To: References: Message-ID: <8B61B01C-2640-4B12-8B6A-ECD0B7A2F9F3@apple.com> The MCCodeEmitter shouldn't have any coupling to TargetMachine (including the ARMSubtarget) either. That it currently does is a bug, not a feature. This seems like it properly belongs in the ARMELFObjectWriter bits, perhaps with some ABI detection (from the Triple, most likely) logic added later if necessary. -Jim On Feb 4, 2011, at 12:15 PM, Jason Kim wrote: > Hi everyone, > > With some chagrin, I discovered that the existing ARM/GNU tool chain > requires a non-zero ELF e_flags field. > Specifically, a nonzero value between 4 and 5 for the EF_ARM_EABIMASK > > Without this field, none of the ELF .o files link properly! > > Adding it in is easy enough to do, but the right place to do this > seems to be within ARMSubtarget, which is problematic. > So the workaround is to add a small ARMMCCodeEmitterBase class to hold > the e_flags value to be emitted. > > I can just as easily just hack this in within ARMELFObjectWriter, but > this seems to be messier, as I can forsee different values being > emitted depending on which ABI version LLVM should emit code for - > which seems to belong in ARMSubtarget (which is hidden from the MC > backend ...) > > In any case, some form of this flag value needs to be emitted. > Otherwise none of the ELF .o files will be linkable with existing > tools (!) > > Is it OK to add in this class? Is there a better place to put this > flag? Should I just hardcode in 5 (which is current, but existing > tools seem to like 4 too.)? > > Thanks! > > -jason > From jasonwkim at google.com Fri Feb 4 14:39:54 2011 From: jasonwkim at google.com (Jason Kim) Date: Fri, 4 Feb 2011 12:39:54 -0800 Subject: [llvm-commits] [PATCH] ARM/MC/ELF e_flags fixup - add an ARMMCCodeEmitterBase class? In-Reply-To: <8B61B01C-2640-4B12-8B6A-ECD0B7A2F9F3@apple.com> References: <8B61B01C-2640-4B12-8B6A-ECD0B7A2F9F3@apple.com> Message-ID: On Fri, Feb 4, 2011 at 12:21 PM, Jim Grosbach wrote: > The MCCodeEmitter shouldn't have any coupling to TargetMachine (including the ARMSubtarget) either. That it currently does is a bug, not a feature. > > This seems like it properly belongs in the ARMELFObjectWriter bits, perhaps with some ABI detection (from the Triple, most likely) logic added later if necessary. Thanks for the advice, Jim! I'll put it in ARMELFObjectWriter as you suggest. -jason > > -Jim > > On Feb 4, 2011, at 12:15 PM, Jason Kim wrote: > >> Hi everyone, >> >> With some chagrin, I discovered that the existing ARM/GNU tool chain >> requires a non-zero ELF e_flags field. >> Specifically, a nonzero value between 4 and 5 for the EF_ARM_EABIMASK >> >> Without this field, none of the ELF .o files link properly! >> >> Adding it in is easy enough to do, but the right place to do this >> seems to be within ARMSubtarget, which is problematic. >> So the workaround is to add a small ARMMCCodeEmitterBase class to hold >> the e_flags value to be emitted. >> >> I can just as easily just hack this in within ARMELFObjectWriter, but >> this seems to be messier, as I can forsee different values being >> emitted depending on which ABI version LLVM should emit code for - >> which seems to belong in ARMSubtarget (which is hidden from the MC >> backend ...) >> >> In any case, some form of this flag value needs to be emitted. >> Otherwise none of the ELF .o files will be linkable with existing >> tools (!) >> >> Is it OK to add in this class? Is there a better place to put this >> flag? Should I just hardcode in 5 (which is current, but existing >> tools seem to like 4 too.)? >> >> Thanks! >> >> -jason >> > > From grosbach at apple.com Fri Feb 4 14:41:23 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 4 Feb 2011 12:41:23 -0800 Subject: [llvm-commits] [PATCH] ARM/MC/ELF e_flags fixup - add an ARMMCCodeEmitterBase class? In-Reply-To: References: <8B61B01C-2640-4B12-8B6A-ECD0B7A2F9F3@apple.com> Message-ID: <39B36D6C-1CAA-4767-AB8B-BEB3F6C8F1DD@apple.com> Thanks! Really great seeing all the progress being made on the ELF side of things. Good stuff. -Jim On Feb 4, 2011, at 12:39 PM, Jason Kim wrote: > On Fri, Feb 4, 2011 at 12:21 PM, Jim Grosbach wrote: >> The MCCodeEmitter shouldn't have any coupling to TargetMachine (including the ARMSubtarget) either. That it currently does is a bug, not a feature. >> >> This seems like it properly belongs in the ARMELFObjectWriter bits, perhaps with some ABI detection (from the Triple, most likely) logic added later if necessary. > > Thanks for the advice, Jim! > I'll put it in ARMELFObjectWriter as you suggest. > > -jason > >> >> -Jim >> >> On Feb 4, 2011, at 12:15 PM, Jason Kim wrote: >> >>> Hi everyone, >>> >>> With some chagrin, I discovered that the existing ARM/GNU tool chain >>> requires a non-zero ELF e_flags field. >>> Specifically, a nonzero value between 4 and 5 for the EF_ARM_EABIMASK >>> >>> Without this field, none of the ELF .o files link properly! >>> >>> Adding it in is easy enough to do, but the right place to do this >>> seems to be within ARMSubtarget, which is problematic. >>> So the workaround is to add a small ARMMCCodeEmitterBase class to hold >>> the e_flags value to be emitted. >>> >>> I can just as easily just hack this in within ARMELFObjectWriter, but >>> this seems to be messier, as I can forsee different values being >>> emitted depending on which ABI version LLVM should emit code for - >>> which seems to belong in ARMSubtarget (which is hidden from the MC >>> backend ...) >>> >>> In any case, some form of this flag value needs to be emitted. >>> Otherwise none of the ELF .o files will be linkable with existing >>> tools (!) >>> >>> Is it OK to add in this class? Is there a better place to put this >>> flag? Should I just hardcode in 5 (which is current, but existing >>> tools seem to like 4 too.)? >>> >>> Thanks! >>> >>> -jason >>> >> >> From bruno.cardoso at gmail.com Fri Feb 4 15:23:09 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 4 Feb 2011 19:23:09 -0200 Subject: [llvm-commits] [PATCH] Asm operand parsing improvements In-Reply-To: References: Message-ID: Does anyone can give me some feedback? :) On Fri, Jan 28, 2011 at 4:42 PM, Bruno Cardoso Lopes wrote: > ping! > > On Wed, Jan 26, 2011 at 11:21 AM, Bruno Cardoso Lopes > wrote: >> Hi, >> >> The first attached patch implements support for custom target specific >> asm parsing of operands. This is useful to avoid adding hacks to >> AsmParsers whenever something different from an immediate or register >> appears. The initial motivation was to remove the "mcr" family of >> hacks from ARMAsmParser, but this is also going to be useful for other >> ARM system instructions which I'm about to add the correct parsing and >> encoding once this gets accepted. The second attached patch contains >> modifications to the ARMAsmParser so that it starts using this >> mechanism. >> >> A quick explanation of how it works (read the first patch for details): >> >> A table like the one below is autogenerated for every instruction >> containing a 'ParserMethod' in its AsmOperandClass: >> >> static const OperandMatchEntry OperandMatchTable[20] = { >> ?/* Mnemonic, Operand List Mask, Operand Class, Features */ >> ?{ "cdp", 29 /* 0, 2, 3, 4 */, MCK_Coproc, Feature_IsThumb|Feature_HasV6 }, >> ?{ "cdp", 58 /* 1, 3, 4, 5 */, MCK_Coproc, Feature_IsARM }, >> >> A matcher function very similar (but lot more naive) to >> MatchInstructionImpl scans the table. After the mnemonic match, the >> features are checked and if the "to be parsed" operand index is >> present in the mask, there's a real match. Then, a switch like the one >> below dispatch the parsing to the custom method provided in >> 'ParseMethod': >> >> ?case MCK_Coproc: >> ? ?return TryParseCoprocessorOperandName(Operands); >> >> Ok to commit? Suggestions? >> Thanks. >> >> -- >> Bruno Cardoso Lopes >> http://www.brunocardoso.cc >> > > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc > -- Bruno Cardoso Lopes http://www.brunocardoso.cc From jason.w.kim.2009 at gmail.com Fri Feb 4 15:41:11 2011 From: jason.w.kim.2009 at gmail.com (Jason W Kim) Date: Fri, 04 Feb 2011 21:41:11 -0000 Subject: [llvm-commits] [llvm] r124899 - in /llvm/trunk: include/llvm/Support/ELF.h lib/MC/ELFObjectWriter.cpp test/MC/ARM/elf-eflags-eabi.s Message-ID: <20110204214111.33F562A6C12C@llvm.org> Author: jasonwkim Date: Fri Feb 4 15:41:11 2011 New Revision: 124899 URL: http://llvm.org/viewvc/llvm-project?rev=124899&view=rev Log: Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to 5 to match the current doc. Added FIXME reminder Make it really configurable later. Added: llvm/trunk/test/MC/ARM/elf-eflags-eabi.s Modified: llvm/trunk/include/llvm/Support/ELF.h llvm/trunk/lib/MC/ELFObjectWriter.cpp Modified: llvm/trunk/include/llvm/Support/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=124899&r1=124898&r2=124899&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ELF.h (original) +++ llvm/trunk/include/llvm/Support/ELF.h Fri Feb 4 15:41:11 2011 @@ -290,6 +290,10 @@ R_MICROBLAZE_COPY = 21 }; + +// ARM Specific e_flags +enum { EF_ARM_EABIMASK = 0xFF000000U }; + // ELF Relocation types for ARM // Meets 2.08 ABI Specs. Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=124899&r1=124898&r2=124899&view=diff ============================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri Feb 4 15:41:11 2011 @@ -276,6 +276,9 @@ virtual void WriteHeader(uint64_t SectionDataSize, unsigned NumberOfSections); + /// Default e_flags = 0 + virtual void WriteEFlags() { Write32(0); } + virtual void WriteSymbolEntry(MCDataFragment *SymtabF, MCDataFragment *ShndxF, uint64_t name, uint8_t info, uint64_t value, uint64_t size, @@ -387,11 +390,16 @@ class ARMELFObjectWriter : public ELFObjectWriter { public: + // FIXME: MCAssembler can't yet return the Subtarget, + enum { DefaultEABIVersion = 0x05000000U }; + ARMELFObjectWriter(MCELFObjectTargetWriter *MOTW, raw_ostream &_OS, bool IsLittleEndian); virtual ~ARMELFObjectWriter(); + + virtual void WriteEFlags(); protected: virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsPCRel, bool IsRelocWithSymbol, @@ -459,8 +467,8 @@ WriteWord(SectionDataSize + (is64Bit() ? sizeof(ELF::Elf64_Ehdr) : sizeof(ELF::Elf32_Ehdr))); // e_shoff = sec hdr table off in bytes - // FIXME: Make this configurable. - Write32(0); // e_flags = whatever the target wants + // e_flags = whatever the target wants + WriteEFlags(); // e_ehsize = ELF header size Write16(is64Bit() ? sizeof(ELF::Elf64_Ehdr) : sizeof(ELF::Elf32_Ehdr)); @@ -1477,6 +1485,11 @@ ARMELFObjectWriter::~ARMELFObjectWriter() {} +// FIXME: get the real EABI Version from the Triple. +void ARMELFObjectWriter::WriteEFlags() { + Write32(ELF::EF_ARM_EABIMASK & DefaultEABIVersion); +} + unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsPCRel, Added: llvm/trunk/test/MC/ARM/elf-eflags-eabi.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-eflags-eabi.s?rev=124899&view=auto ============================================================================== --- llvm/trunk/test/MC/ARM/elf-eflags-eabi.s (added) +++ llvm/trunk/test/MC/ARM/elf-eflags-eabi.s Fri Feb 4 15:41:11 2011 @@ -0,0 +1,13 @@ +@ RUN: llvm-mc %s -triple=armv7-linux-gnueabi -filetype=obj -o - | \ +@ RUN: elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s + .syntax unified + .text + .globl barf + .align 2 + .type barf,%function +barf: @ @barf +@ BB#0: @ %entry + b foo + +@@@ make sure the EF_ARM_EABIMASK comes out OK + at OBJ: 'e_flags', 0x05000000 From stoklund at 2pi.dk Fri Feb 4 15:42:06 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 21:42:06 -0000 Subject: [llvm-commits] [llvm] r124900 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110204214206.BBFA42A6C12C@llvm.org> Author: stoklund Date: Fri Feb 4 15:42:06 2011 New Revision: 124900 URL: http://llvm.org/viewvc/llvm-project?rev=124900&view=rev Log: Be more accurate about live range splitting at the end of blocks. If interference reaches the last split point, it is effectively live out and should be marked as 'MustSpill'. This can make a difference when the terminator uses a register. There is no way that register can be reused in the outgoing CFG bundle, even if it isn't live out. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124900&r1=124899&r2=124900&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Feb 4 15:42:06 2011 @@ -88,6 +88,8 @@ SlotIndex LastUse; ///< Last instr using current reg. SlotIndex Kill; ///< Interval end point inside block. SlotIndex Def; ///< Interval start point inside block. + /// Last possible point for splitting live ranges. + SlotIndex LastSplitPoint; bool Uses; ///< Current reg has uses or defs in block. bool LiveThrough; ///< Live in whole block (Templ 5. or 6. above). bool LiveIn; ///< Current reg is live in. @@ -356,6 +358,16 @@ SlotIndex Start, Stop; tie(Start, Stop) = Indexes->getMBBRange(BI.MBB); + // The last split point is the latest possible insertion point that dominates + // all successor blocks. If interference reaches LastSplitPoint, it is not + // possible to insert a split or reload that makes VirtReg live in the + // outgoing bundle. + MachineBasicBlock::iterator LSP = LIS->getLastSplitPoint(VirtReg, BI.MBB); + if (LSP == BI.MBB->end()) + BI.LastSplitPoint = Stop; + else + BI.LastSplitPoint = Indexes->getInstructionIndex(LSP); + // LVI is the first live segment overlapping MBB. BI.LiveIn = LVI->start <= Start; if (!BI.LiveIn) @@ -462,7 +474,8 @@ // Check if interference is live-out - force spill. if (BC.Exit != SpillPlacement::MustSpill) { BC.Exit = SpillPlacement::PrefSpill; - IntI.advanceTo(Stop); + // Any interference overlapping [LastSplitPoint;Stop) forces a spill. + IntI.advanceTo(BI.LastSplitPoint.getPrevSlot()); if (IntI.valid() && IntI.start() < Stop) BC.Exit = SpillPlacement::MustSpill; } @@ -522,8 +535,8 @@ if (IntI.start() < Stop) BC.Exit = SpillPlacement::PrefSpill; } - // Is the interference live-out? - IntI.advanceTo(Stop); + // Is the interference overlapping the last split point? + IntI.advanceTo(BI.LastSplitPoint.getPrevSlot()); if (!IntI.valid()) break; if (IntI.start() < Stop) @@ -709,7 +722,7 @@ SE.enterIntvAtEnd(*BI.MBB); continue; } - if (IP.second < BI.LastUse) { + if (IP.second < BI.LastUse && IP.second <= BI.LastSplitPoint) { // There are interference-free uses at the end of the block. // Find the first use that can get the live-out register. SmallVectorImpl::const_iterator UI = From anton at korobeynikov.info Fri Feb 4 15:51:31 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sat, 5 Feb 2011 00:51:31 +0300 Subject: [llvm-commits] [llvm] r124899 - in /llvm/trunk: include/llvm/Support/ELF.h lib/MC/ELFObjectWriter.cpp test/MC/ARM/elf-eflags-eabi.s In-Reply-To: <20110204214111.33F562A6C12C@llvm.org> References: <20110204214111.33F562A6C12C@llvm.org> Message-ID: Hi Jason, > Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to > 5 to match the current doc. > Added FIXME reminder Make it really configurable later. Shouldn't this be printed in text mode as well? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From grosbach at apple.com Fri Feb 4 16:26:40 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 4 Feb 2011 14:26:40 -0800 Subject: [llvm-commits] [PATCH] Asm operand parsing improvements In-Reply-To: References: Message-ID: <0BC93A73-9043-487E-A370-6C09E1CC4E40@apple.com> Hi Bruno, This looks very cool and is definitely an improvement over the ugly hacks we currently have. In the ARM parsing, you've placed the call to try to do custom operand parsing after the check for the token being an identifier. Is that necessary? It seems that it could/should be at the head of the ParseOperand() method so it will fire for any operands marked as needing custom parsing, whether they start with an identifier or not. What happens if for a given opcode, some entries in the table have a custom parser listed for an operand position and others do not? Is there a clear-cut "right answer" for that? If not, should it be allowed at all? Nitpick, but shouldn't the initialization of the ParserMethod in Target.td be to the empty string rather than a question mark? On Jan 26, 2011, at 5:21 AM, Bruno Cardoso Lopes wrote: > Hi, > > The first attached patch implements support for custom target specific > asm parsing of operands. This is useful to avoid adding hacks to > AsmParsers whenever something different from an immediate or register > appears. The initial motivation was to remove the "mcr" family of > hacks from ARMAsmParser, but this is also going to be useful for other > ARM system instructions which I'm about to add the correct parsing and > encoding once this gets accepted. The second attached patch contains > modifications to the ARMAsmParser so that it starts using this > mechanism. > > A quick explanation of how it works (read the first patch for details): > > A table like the one below is autogenerated for every instruction > containing a 'ParserMethod' in its AsmOperandClass: > > static const OperandMatchEntry OperandMatchTable[20] = { > /* Mnemonic, Operand List Mask, Operand Class, Features */ > { "cdp", 29 /* 0, 2, 3, 4 */, MCK_Coproc, Feature_IsThumb|Feature_HasV6 }, > { "cdp", 58 /* 1, 3, 4, 5 */, MCK_Coproc, Feature_IsARM }, > > A matcher function very similar (but lot more naive) to > MatchInstructionImpl scans the table. After the mnemonic match, the > features are checked and if the "to be parsed" operand index is > present in the mask, there's a real match. Then, a switch like the one > below dispatch the parsing to the custom method provided in > 'ParseMethod': > > case MCK_Coproc: > return TryParseCoprocessorOperandName(Operands); > > Ok to commit? Suggestions? > Thanks. > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From benny.kra at googlemail.com Fri Feb 4 16:45:57 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 4 Feb 2011 23:45:57 +0100 Subject: [llvm-commits] [llvm] r124826 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch-to-icmp.ll In-Reply-To: References: <20110203225141.ABC872A6C12C@llvm.org> Message-ID: <68D27544-DC56-4DDF-A59C-D1547EEB71EA@googlemail.com> On 04.02.2011, at 00:48, Marius Wachtler wrote: > Hello > > Maybe add the attached code to stop generating the add if the offset is zero. > > warning: haven't run make check! because currently I have no machine at hand... Hi Marius, I tried the patch and while it's obviously the right thing to do, llvm started to loop indefinitely during selfhost. I haven't investigated why it does that yet but it's a bad thing and is going to cause trouble eventually. - Benjamin From nicholas at mxc.ca Fri Feb 4 16:44:08 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 04 Feb 2011 22:44:08 -0000 Subject: [llvm-commits] [llvm] r124903 - in /llvm/trunk: lib/CodeGen/RegAllocFast.cpp test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll Message-ID: <20110204224408.C2F9B2A6C12C@llvm.org> Author: nicholas Date: Fri Feb 4 16:44:08 2011 New Revision: 124903 URL: http://llvm.org/viewvc/llvm-project?rev=124903&view=rev Log: Mark that the return is using EAX so that we don't use it for some other purpose. Fixes PR9080! Added: llvm/trunk/test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocFast.cpp?rev=124903&r1=124902&r2=124903&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Fri Feb 4 16:44:08 2011 @@ -735,6 +735,27 @@ void RAFast::AllocateBasicBlock() { DEBUG(dbgs() << "\nAllocating " << *MBB); + // FIXME: This should probably be added by instruction selection instead? + // If the last instruction in the block is a return, make sure to mark it as + // using all of the live-out values in the function. Things marked both call + // and return are tail calls; do not do this for them. The tail callee need + // not take the same registers as input that it produces as output, and there + // are dependencies for its input registers elsewhere. + if (!MBB->empty() && MBB->back().getDesc().isReturn() && + !MBB->back().getDesc().isCall()) { + MachineInstr *Ret = &MBB->back(); + + for (MachineRegisterInfo::liveout_iterator + I = MF->getRegInfo().liveout_begin(), + E = MF->getRegInfo().liveout_end(); I != E; ++I) { + assert(TargetRegisterInfo::isPhysicalRegister(*I) && + "Cannot have a live-out virtual register."); + + // Add live-out registers as implicit uses. + Ret->addRegisterKilled(*I, TRI, true); + } + } + PhysRegState.assign(TRI->getNumRegs(), regDisabled); assert(LiveVirtRegs.empty() && "Mapping not cleared form last block?"); Added: llvm/trunk/test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll?rev=124903&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll (added) +++ llvm/trunk/test/CodeGen/X86/2011-02-04-FastRegallocNoFP.ll Fri Feb 4 16:44:08 2011 @@ -0,0 +1,14 @@ +; RUN: llc -O0 < %s | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +declare i32 @foo() + +define i32 @bar() nounwind { +; CHECK: bar +; CHECK-NOT: pop.*ax + %call = call i32 @foo() + ret i32 %call +} + From dpatel at apple.com Fri Feb 4 16:57:18 2011 From: dpatel at apple.com (Devang Patel) Date: Fri, 04 Feb 2011 22:57:18 -0000 Subject: [llvm-commits] [llvm] r124904 - in /llvm/trunk: include/llvm/CodeGen/MachineLocation.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/CodeGen/X86/dbg-merge-loc-entry.ll Message-ID: <20110204225719.099202A6C12C@llvm.org> Author: dpatel Date: Fri Feb 4 16:57:18 2011 New Revision: 124904 URL: http://llvm.org/viewvc/llvm-project?rev=124904&view=rev Log: Merge .debug_loc entries whenever possible to reduce debug_loc size. Added: llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll Modified: llvm/trunk/include/llvm/CodeGen/MachineLocation.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/include/llvm/CodeGen/MachineLocation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLocation.h?rev=124904&r1=124903&r2=124904&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineLocation.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineLocation.h Fri Feb 4 16:57:18 2011 @@ -41,6 +41,11 @@ : IsRegister(true), Register(R), Offset(0) {} MachineLocation(unsigned R, int O) : IsRegister(false), Register(R), Offset(O) {} + + bool operator==(const MachineLocation &Other) const { + return IsRegister == Other.IsRegister && Register == Other.Register && + Offset == Other.Offset; + } // Accessors bool isReg() const { return IsRegister; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=124904&r1=124903&r2=124904&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Feb 4 16:57:18 2011 @@ -3580,6 +3580,14 @@ if (DotDebugLocEntries.empty()) return; + for (SmallVector::iterator + I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); + I != E; ++I) { + DotDebugLocEntry &Entry = *I; + if (I + 1 != DotDebugLocEntries.end()) + Entry.Merge(I+1); + } + // Start the dwarf loc section. Asm->OutStreamer.SwitchSection( Asm->getObjFileLowering().getDwarfLocSection()); @@ -3589,7 +3597,8 @@ for (SmallVector::iterator I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); I != E; ++I, ++index) { - DotDebugLocEntry Entry = *I; + DotDebugLocEntry &Entry = *I; + if (Entry.isMerged()) continue; if (Entry.isEmpty()) { Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=124904&r1=124903&r2=124904&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Feb 4 16:57:18 2011 @@ -74,6 +74,28 @@ MCSymbol *getLabel() const { return Label; } }; +/// DotDebugLocEntry - This struct describes location entries emitted in +/// .debug_loc section. +typedef struct DotDebugLocEntry { + const MCSymbol *Begin; + const MCSymbol *End; + MachineLocation Loc; + bool Merged; + DotDebugLocEntry() : Begin(0), End(0), Merged(false) {} + DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L) + : Begin(B), End(E), Loc(L), Merged(false) {} + /// Empty entries are also used as a trigger to emit temp label. Such + /// labels are referenced is used to find debug_loc offset for a given DIE. + bool isEmpty() { return Begin == 0 && End == 0; } + bool isMerged() { return Merged; } + void Merge(DotDebugLocEntry *Next) { + if (!(Begin && Loc == Next->Loc && End == Next->Begin)) + return; + Next->Begin = Begin; + Merged = true; + } +} DotDebugLocEntry; + class DwarfDebug { /// Asm - Target of Dwarf emission. AsmPrinter *Asm; @@ -153,20 +175,6 @@ /// machine instruction. DenseMap DbgVariableToDbgInstMap; - /// DotDebugLocEntry - This struct describes location entries emitted in - /// .debug_loc section. - typedef struct DotDebugLocEntry { - const MCSymbol *Begin; - const MCSymbol *End; - MachineLocation Loc; - DotDebugLocEntry() : Begin(0), End(0) {} - DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, - MachineLocation &L) : Begin(B), End(E), Loc(L) {} - /// Empty entries are also used as a trigger to emit temp label. Such - /// labels are referenced is used to find debug_loc offset for a given DIE. - bool isEmpty() { return Begin == 0 && End == 0; } - } DotDebugLocEntry; - /// DotDebugLocEntries - Collection of DotDebugLocEntry. SmallVector DotDebugLocEntries; Added: llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll?rev=124904&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll Fri Feb 4 16:57:18 2011 @@ -0,0 +1,827 @@ +; RUN: llc < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin8" + +;CHECK: Ldebug_loc2: +;CHECK-NEXT: .quad Ltmp11 +;CHECK-NEXT: .quad Lfunc_end0 +;CHECK-NEXT: .short 1 ## Loc expr size +;CHECK-NEXT: .byte 85 ## DW_OP_reg5 +;CHECK-NEXT: .quad 0 +;CHECK-NEXT: .quad 0 + + +%0 = type { i64, i1 } + + at __clz_tab = external unnamed_addr constant [256 x i8] + +define hidden i128 @__divti3(i128 %u, i128 %v) nounwind readnone { +entry: + tail call void @llvm.dbg.value(metadata !{i128 %u}, i64 0, metadata !103), !dbg !111 + tail call void @llvm.dbg.value(metadata !{i128 %v}, i64 0, metadata !104), !dbg !111 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !108), !dbg !112 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !109), !dbg !113 + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !105), !dbg !115 + %0 = trunc i128 %u to i64 + %sroa.store.elt15 = lshr i128 %u, 64 + %1 = trunc i128 %sroa.store.elt15 to i64 + %2 = trunc i128 %v to i64 + %sroa.store.elt = lshr i128 %v, 64 + %3 = trunc i128 %sroa.store.elt to i64 + %4 = icmp slt i64 %1, 0, !dbg !116 + br i1 %4, label %bb, label %bb1, !dbg !116 + +bb: ; preds = %entry + tail call void @llvm.dbg.value(metadata !117, i64 0, metadata !105), !dbg !118 + %5 = sub nsw i128 0, %u, !dbg !118 + %6 = trunc i128 %5 to i64 + %sroa.store.elt18 = lshr i128 %5, 64 + %7 = trunc i128 %sroa.store.elt18 to i64 + br label %bb1, !dbg !118 + +bb1: ; preds = %bb, %entry + %uu.0.1.0 = phi i64 [ %7, %bb ], [ %1, %entry ] + %uu.0.0.0 = phi i64 [ %6, %bb ], [ %0, %entry ] + %c.0 = phi i64 [ -1, %bb ], [ 0, %entry ] + %8 = icmp slt i64 %3, 0, !dbg !119 + br i1 %8, label %bb2, label %bb4, !dbg !119 + +bb2: ; preds = %bb1 + %not3 = xor i64 %c.0, -1, !dbg !120 + tail call void @llvm.dbg.value(metadata !{i64 %not3}, i64 0, metadata !105), !dbg !120 + %9 = sub nsw i128 0, %v, !dbg !120 + %10 = trunc i128 %9 to i64 + %sroa.store.elt11 = lshr i128 %9, 64 + %11 = trunc i128 %sroa.store.elt11 to i64 + br label %bb4, !dbg !120 + +bb4: ; preds = %bb2, %bb1 + %vv.0.1.0 = phi i64 [ %11, %bb2 ], [ %3, %bb1 ] + %vv.0.0.0 = phi i64 [ %10, %bb2 ], [ %2, %bb1 ] + %c.1 = phi i64 [ %not3, %bb2 ], [ %c.0, %bb1 ] + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !14) nounwind, !dbg !121 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !15) nounwind, !dbg !121 + tail call void @llvm.dbg.value(metadata !123, i64 0, metadata !16) nounwind, !dbg !121 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !17) nounwind, !dbg !124 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !30) nounwind, !dbg !125 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !31) nounwind, !dbg !126 + tail call void @llvm.dbg.declare(metadata !{null}, metadata !43) nounwind, !dbg !127 + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.0.0}, i64 0, metadata !32) nounwind, !dbg !128 + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.1.0}, i64 0, metadata !35) nounwind, !dbg !129 + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.0.0}, i64 0, metadata !36) nounwind, !dbg !130 + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.1.0}, i64 0, metadata !37) nounwind, !dbg !131 + %12 = icmp eq i64 %vv.0.1.0, 0, !dbg !132 + br i1 %12, label %bb.i, label %bb73.i, !dbg !132 + +bb.i: ; preds = %bb4 + %13 = icmp ugt i64 %vv.0.0.0, %uu.0.1.0, !dbg !133 + br i1 %13, label %bb4.i, label %bb21.i, !dbg !133 + +bb2.i: ; preds = %bb4.i + %tmp154.i = shl i64 255, %.cast.i + %14 = and i64 %tmp154.i, %vv.0.0.0 + %15 = icmp eq i64 %14, 0, !dbg !134 + br i1 %15, label %bb3.i, label %bb5.i, !dbg !134 + +bb3.i: ; preds = %bb2.i + %indvar.next20.i = add i64 %indvar19.i, 1 + br label %bb4.i, !dbg !134 + +bb4.i: ; preds = %bb.i, %bb3.i + %indvar19.i = phi i64 [ %indvar.next20.i, %bb3.i ], [ 0, %bb.i ] + %tmp24 = mul i64 %indvar19.i, -8 + %.cast.i = add i64 %tmp24, 56 + %16 = icmp eq i64 %.cast.i, 0, !dbg !134 + br i1 %16, label %bb5.i, label %bb2.i, !dbg !134 + +bb5.i: ; preds = %bb4.i, %bb2.i + %.cast6.i = and i64 %.cast.i, 4294967288 + %17 = lshr i64 %vv.0.0.0, %.cast6.i, !dbg !134 + %18 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %17, !dbg !134 + %19 = load i8* %18, align 1, !dbg !134 + %20 = zext i8 %19 to i64, !dbg !134 + %21 = add i64 %20, %.cast.i, !dbg !134 + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !134 + %22 = icmp eq i64 %21, 64 + br i1 %22, label %bb12.i, label %bb7.i, !dbg !136 + +bb7.i: ; preds = %bb5.i + %23 = sub i64 64, %21, !dbg !134 + %.cast8.i = and i64 %23, 4294967295 + %24 = shl i64 %vv.0.0.0, %.cast8.i, !dbg !137 + tail call void @llvm.dbg.value(metadata !{i64 %24}, i64 0, metadata !32) nounwind, !dbg !137 + %25 = shl i64 %uu.0.1.0, %.cast8.i, !dbg !138 + %.cast10.i = and i64 %21, 4294967295 + %26 = lshr i64 %uu.0.0.0, %.cast10.i, !dbg !138 + %27 = or i64 %25, %26, !dbg !138 + tail call void @llvm.dbg.value(metadata !{i64 %27}, i64 0, metadata !37) nounwind, !dbg !138 + %28 = shl i64 %uu.0.0.0, %.cast8.i, !dbg !139 + tail call void @llvm.dbg.value(metadata !{i64 %28}, i64 0, metadata !36) nounwind, !dbg !139 + br label %bb12.i, !dbg !139 + +bb12.i: ; preds = %bb7.i, %bb5.i + %n1.0.i = phi i64 [ %27, %bb7.i ], [ %uu.0.1.0, %bb5.i ] + %n0.0.i = phi i64 [ %28, %bb7.i ], [ %uu.0.0.0, %bb5.i ] + %d0.0.i = phi i64 [ %24, %bb7.i ], [ %vv.0.0.0, %bb5.i ] + %29 = lshr i64 %d0.0.i, 32, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %29}, i64 0, metadata !47) nounwind, !dbg !140 + %30 = and i64 %d0.0.i, 4294967295, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %30}, i64 0, metadata !49) nounwind, !dbg !140 + %31 = urem i64 %n1.0.i, %29, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %31}, i64 0, metadata !52) nounwind, !dbg !140 + %32 = udiv i64 %n1.0.i, %29, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %32}, i64 0, metadata !50) nounwind, !dbg !140 + %33 = mul i64 %32, %30, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %33}, i64 0, metadata !54) nounwind, !dbg !140 + %34 = shl i64 %31, 32 + %35 = lshr i64 %n0.0.i, 32, !dbg !140 + %36 = or i64 %34, %35, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %36}, i64 0, metadata !52) nounwind, !dbg !140 + %37 = icmp ult i64 %36, %33, !dbg !140 + br i1 %37, label %bb13.i, label %bb16.i, !dbg !140 + +bb13.i: ; preds = %bb12.i + %38 = add i64 %32, -1 + tail call void @llvm.dbg.value(metadata !{i64 %38}, i64 0, metadata !50) nounwind, !dbg !140 + %uadd153.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %36, i64 %d0.0.i) nounwind + %39 = extractvalue %0 %uadd153.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %39}, i64 0, metadata !52) nounwind, !dbg !140 + %40 = extractvalue %0 %uadd153.i, 1 + %.not.i = xor i1 %40, true + %41 = icmp ult i64 %39, %33, !dbg !140 + %or.cond.i = and i1 %41, %.not.i + br i1 %or.cond.i, label %bb15.i, label %bb16.i, !dbg !140 + +bb15.i: ; preds = %bb13.i + %42 = add i64 %32, -2 + tail call void @llvm.dbg.value(metadata !{i64 %42}, i64 0, metadata !50) nounwind, !dbg !140 + %43 = add i64 %39, %d0.0.i, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %43}, i64 0, metadata !52) nounwind, !dbg !140 + br label %bb16.i, !dbg !140 + +bb16.i: ; preds = %bb15.i, %bb13.i, %bb12.i + %__r1.0.i = phi i64 [ %43, %bb15.i ], [ %39, %bb13.i ], [ %36, %bb12.i ] + %__q1.0.i = phi i64 [ %42, %bb15.i ], [ %38, %bb13.i ], [ %32, %bb12.i ] + %44 = sub i64 %__r1.0.i, %33, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %44}, i64 0, metadata !52) nounwind, !dbg !140 + %45 = urem i64 %44, %29, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %45}, i64 0, metadata !53) nounwind, !dbg !140 + %46 = udiv i64 %44, %29, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %46}, i64 0, metadata !51) nounwind, !dbg !140 + %47 = mul i64 %46, %30, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %47}, i64 0, metadata !54) nounwind, !dbg !140 + %48 = shl i64 %45, 32 + %49 = and i64 %n0.0.i, 4294967295, !dbg !140 + %50 = or i64 %48, %49, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %50}, i64 0, metadata !53) nounwind, !dbg !140 + %51 = icmp ult i64 %50, %47, !dbg !140 + br i1 %51, label %bb17.i, label %bb20.i, !dbg !140 + +bb17.i: ; preds = %bb16.i + %52 = add i64 %46, -1 + tail call void @llvm.dbg.value(metadata !{i64 %52}, i64 0, metadata !51) nounwind, !dbg !140 + %uadd152.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %50, i64 %d0.0.i) nounwind + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !53) nounwind, !dbg !140 + %53 = extractvalue %0 %uadd152.i, 1 + br i1 %53, label %bb20.i, label %bb18.i, !dbg !140 + +bb18.i: ; preds = %bb17.i + %54 = extractvalue %0 %uadd152.i, 0 + %55 = add i64 %46, -2 + %56 = icmp ult i64 %54, %47, !dbg !140 + %..i = select i1 %56, i64 %55, i64 %52 + br label %bb20.i + +bb20.i: ; preds = %bb18.i, %bb17.i, %bb16.i + %__q0.0.i = phi i64 [ %52, %bb17.i ], [ %46, %bb16.i ], [ %..i, %bb18.i ] + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !53) nounwind, !dbg !140 + %57 = shl i64 %__q1.0.i, 32 + %58 = or i64 %__q0.0.i, %57, !dbg !140 + tail call void @llvm.dbg.value(metadata !{i64 %58}, i64 0, metadata !39) nounwind, !dbg !140 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !140 + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !141 + br label %__udivmodti4.exit, !dbg !141 + +bb21.i: ; preds = %bb.i + %59 = icmp eq i64 %vv.0.0.0, 0, !dbg !142 + br i1 %59, label %bb22.i, label %bb23.i, !dbg !142 + +bb22.i: ; preds = %bb21.i + %60 = udiv i64 1, %vv.0.0.0, !dbg !143 + tail call void @llvm.dbg.value(metadata !{i64 %60}, i64 0, metadata !32) nounwind, !dbg !143 + br label %bb23.i, !dbg !143 + +bb23.i: ; preds = %bb22.i, %bb21.i + %d0.1.i = phi i64 [ %60, %bb22.i ], [ %vv.0.0.0, %bb21.i ] + tail call void @llvm.dbg.value(metadata !{i64 %d0.1.i}, i64 0, metadata !55) nounwind, !dbg !144 + tail call void @llvm.dbg.value(metadata !145, i64 0, metadata !57) nounwind, !dbg !144 + br label %bb29.i, !dbg !144 + +bb26.i: ; preds = %bb29.i + %tmp151.i = shl i64 255, %.cast27.i + %61 = and i64 %tmp151.i, %d0.1.i + %62 = icmp eq i64 %61, 0, !dbg !144 + br i1 %62, label %bb28.i, label %bb30.i, !dbg !144 + +bb28.i: ; preds = %bb26.i + %indvar.next16.i = add i64 %indvar15.i, 1 + br label %bb29.i, !dbg !144 + +bb29.i: ; preds = %bb28.i, %bb23.i + %indvar15.i = phi i64 [ %indvar.next16.i, %bb28.i ], [ 0, %bb23.i ] + %tmp22 = mul i64 %indvar15.i, -8 + %.cast27.i = add i64 %tmp22, 56 + %63 = icmp eq i64 %.cast27.i, 0, !dbg !144 + br i1 %63, label %bb30.i, label %bb26.i, !dbg !144 + +bb30.i: ; preds = %bb29.i, %bb26.i + %.cast31.i = and i64 %.cast27.i, 4294967288 + %64 = lshr i64 %d0.1.i, %.cast31.i, !dbg !144 + %65 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %64, !dbg !144 + %66 = load i8* %65, align 1, !dbg !144 + %67 = zext i8 %66 to i64, !dbg !144 + %68 = add i64 %67, %.cast27.i, !dbg !144 + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !144 + %69 = icmp eq i64 %68, 64 + br i1 %69, label %bb32.i, label %bb33.i, !dbg !146 + +bb32.i: ; preds = %bb30.i + %70 = sub i64 %uu.0.1.0, %d0.1.i, !dbg !147 + tail call void @llvm.dbg.value(metadata !{i64 %70}, i64 0, metadata !37) nounwind, !dbg !147 + tail call void @llvm.dbg.value(metadata !148, i64 0, metadata !40) nounwind, !dbg !149 + br label %bb54.i, !dbg !149 + +bb33.i: ; preds = %bb30.i + %71 = sub i64 64, %68, !dbg !144 + tail call void @llvm.dbg.value(metadata !{i64 %68}, i64 0, metadata !41) nounwind, !dbg !150 + %.cast34.i = and i64 %71, 4294967295 + %72 = shl i64 %d0.1.i, %.cast34.i, !dbg !151 + tail call void @llvm.dbg.value(metadata !{i64 %72}, i64 0, metadata !32) nounwind, !dbg !151 + %.cast35.i = and i64 %68, 4294967295 + %73 = lshr i64 %uu.0.1.0, %.cast35.i, !dbg !152 + tail call void @llvm.dbg.value(metadata !{i64 %73}, i64 0, metadata !38) nounwind, !dbg !152 + %74 = shl i64 %uu.0.1.0, %.cast34.i, !dbg !153 + %75 = lshr i64 %uu.0.0.0, %.cast35.i, !dbg !153 + %76 = or i64 %74, %75, !dbg !153 + tail call void @llvm.dbg.value(metadata !{i64 %76}, i64 0, metadata !37) nounwind, !dbg !153 + %77 = shl i64 %uu.0.0.0, %.cast34.i, !dbg !154 + tail call void @llvm.dbg.value(metadata !{i64 %77}, i64 0, metadata !36) nounwind, !dbg !154 + %78 = lshr i64 %72, 32, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %78}, i64 0, metadata !58) nounwind, !dbg !155 + %79 = and i64 %72, 4294967295, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %79}, i64 0, metadata !60) nounwind, !dbg !155 + %80 = urem i64 %73, %78, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %80}, i64 0, metadata !63) nounwind, !dbg !155 + %81 = udiv i64 %73, %78, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %81}, i64 0, metadata !61) nounwind, !dbg !155 + %82 = mul i64 %81, %79, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %82}, i64 0, metadata !65) nounwind, !dbg !155 + %83 = shl i64 %80, 32 + %84 = lshr i64 %76, 32, !dbg !155 + %85 = or i64 %83, %84, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %85}, i64 0, metadata !63) nounwind, !dbg !155 + %86 = icmp ult i64 %85, %82, !dbg !155 + br i1 %86, label %bb46.i, label %bb49.i, !dbg !155 + +bb46.i: ; preds = %bb33.i + %87 = add i64 %81, -1 + tail call void @llvm.dbg.value(metadata !{i64 %87}, i64 0, metadata !61) nounwind, !dbg !155 + %uadd150.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %85, i64 %72) nounwind + %88 = extractvalue %0 %uadd150.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %88}, i64 0, metadata !63) nounwind, !dbg !155 + %89 = extractvalue %0 %uadd150.i, 1 + %.not1.i = xor i1 %89, true + %90 = icmp ult i64 %88, %82, !dbg !155 + %or.cond2.i = and i1 %90, %.not1.i + br i1 %or.cond2.i, label %bb48.i, label %bb49.i, !dbg !155 + +bb48.i: ; preds = %bb46.i + %91 = add i64 %81, -2 + tail call void @llvm.dbg.value(metadata !{i64 %91}, i64 0, metadata !61) nounwind, !dbg !155 + %92 = add i64 %88, %72, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %92}, i64 0, metadata !63) nounwind, !dbg !155 + br label %bb49.i, !dbg !155 + +bb49.i: ; preds = %bb48.i, %bb46.i, %bb33.i + %__q141.0.i = phi i64 [ %91, %bb48.i ], [ %87, %bb46.i ], [ %81, %bb33.i ] + %__r143.0.i = phi i64 [ %92, %bb48.i ], [ %88, %bb46.i ], [ %85, %bb33.i ] + %93 = sub i64 %__r143.0.i, %82, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %93}, i64 0, metadata !63) nounwind, !dbg !155 + %94 = urem i64 %93, %78, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %94}, i64 0, metadata !64) nounwind, !dbg !155 + %95 = udiv i64 %93, %78, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %95}, i64 0, metadata !62) nounwind, !dbg !155 + %96 = mul i64 %95, %79, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %96}, i64 0, metadata !65) nounwind, !dbg !155 + %97 = shl i64 %94, 32 + %98 = and i64 %76, 4294967295, !dbg !155 + %99 = or i64 %97, %98, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %99}, i64 0, metadata !64) nounwind, !dbg !155 + %100 = icmp ult i64 %99, %96, !dbg !155 + br i1 %100, label %bb50.i, label %bb53.i, !dbg !155 + +bb50.i: ; preds = %bb49.i + %101 = add i64 %95, -1 + tail call void @llvm.dbg.value(metadata !{i64 %101}, i64 0, metadata !62) nounwind, !dbg !155 + %uadd149.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %99, i64 %72) nounwind + %102 = extractvalue %0 %uadd149.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %102}, i64 0, metadata !64) nounwind, !dbg !155 + %103 = extractvalue %0 %uadd149.i, 1 + %.not3.i = xor i1 %103, true + %104 = icmp ult i64 %102, %96, !dbg !155 + %or.cond4.i = and i1 %104, %.not3.i + br i1 %or.cond4.i, label %bb52.i, label %bb53.i, !dbg !155 + +bb52.i: ; preds = %bb50.i + %105 = add i64 %95, -2 + tail call void @llvm.dbg.value(metadata !{i64 %105}, i64 0, metadata !62) nounwind, !dbg !155 + %106 = add i64 %102, %72, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %106}, i64 0, metadata !64) nounwind, !dbg !155 + br label %bb53.i, !dbg !155 + +bb53.i: ; preds = %bb52.i, %bb50.i, %bb49.i + %__q042.0.i = phi i64 [ %105, %bb52.i ], [ %101, %bb50.i ], [ %95, %bb49.i ] + %__r044.0.i = phi i64 [ %106, %bb52.i ], [ %102, %bb50.i ], [ %99, %bb49.i ] + %107 = sub i64 %__r044.0.i, %96, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !64) nounwind, !dbg !155 + %108 = shl i64 %__q141.0.i, 32 + %109 = or i64 %__q042.0.i, %108, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %109}, i64 0, metadata !40) nounwind, !dbg !155 + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !37) nounwind, !dbg !155 + br label %bb54.i, !dbg !155 + +bb54.i: ; preds = %bb53.i, %bb32.i + %q1.0.i = phi i64 [ 1, %bb32.i ], [ %109, %bb53.i ] + %n1.1.i = phi i64 [ %70, %bb32.i ], [ %107, %bb53.i ] + %n0.1.i = phi i64 [ %uu.0.0.0, %bb32.i ], [ %77, %bb53.i ] + %d0.2.i = phi i64 [ %d0.1.i, %bb32.i ], [ %72, %bb53.i ] + %110 = lshr i64 %d0.2.i, 32, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %110}, i64 0, metadata !66) nounwind, !dbg !156 + %111 = and i64 %d0.2.i, 4294967295, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %111}, i64 0, metadata !68) nounwind, !dbg !156 + %112 = urem i64 %n1.1.i, %110, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %112}, i64 0, metadata !71) nounwind, !dbg !156 + %113 = udiv i64 %n1.1.i, %110, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %113}, i64 0, metadata !69) nounwind, !dbg !156 + %114 = mul i64 %113, %111, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %114}, i64 0, metadata !73) nounwind, !dbg !156 + %115 = shl i64 %112, 32 + %116 = lshr i64 %n0.1.i, 32, !dbg !156 + %117 = or i64 %115, %116, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %117}, i64 0, metadata !71) nounwind, !dbg !156 + %118 = icmp ult i64 %117, %114, !dbg !156 + br i1 %118, label %bb62.i, label %bb65.i, !dbg !156 + +bb62.i: ; preds = %bb54.i + %119 = add i64 %113, -1 + tail call void @llvm.dbg.value(metadata !{i64 %119}, i64 0, metadata !69) nounwind, !dbg !156 + %uadd148.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %117, i64 %d0.2.i) nounwind + %120 = extractvalue %0 %uadd148.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %120}, i64 0, metadata !71) nounwind, !dbg !156 + %121 = extractvalue %0 %uadd148.i, 1 + %.not5.i = xor i1 %121, true + %122 = icmp ult i64 %120, %114, !dbg !156 + %or.cond6.i = and i1 %122, %.not5.i + br i1 %or.cond6.i, label %bb64.i, label %bb65.i, !dbg !156 + +bb64.i: ; preds = %bb62.i + %123 = add i64 %113, -2 + tail call void @llvm.dbg.value(metadata !{i64 %123}, i64 0, metadata !69) nounwind, !dbg !156 + %124 = add i64 %120, %d0.2.i, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %124}, i64 0, metadata !71) nounwind, !dbg !156 + br label %bb65.i, !dbg !156 + +bb65.i: ; preds = %bb64.i, %bb62.i, %bb54.i + %__q157.0.i = phi i64 [ %123, %bb64.i ], [ %119, %bb62.i ], [ %113, %bb54.i ] + %__r159.0.i = phi i64 [ %124, %bb64.i ], [ %120, %bb62.i ], [ %117, %bb54.i ] + %125 = sub i64 %__r159.0.i, %114, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %125}, i64 0, metadata !71) nounwind, !dbg !156 + %126 = urem i64 %125, %110, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %126}, i64 0, metadata !72) nounwind, !dbg !156 + %127 = udiv i64 %125, %110, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %127}, i64 0, metadata !70) nounwind, !dbg !156 + %128 = mul i64 %127, %111, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %128}, i64 0, metadata !73) nounwind, !dbg !156 + %129 = shl i64 %126, 32 + %130 = and i64 %n0.1.i, 4294967295, !dbg !156 + %131 = or i64 %129, %130, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %131}, i64 0, metadata !72) nounwind, !dbg !156 + %132 = icmp ult i64 %131, %128, !dbg !156 + br i1 %132, label %bb66.i, label %bb69.i, !dbg !156 + +bb66.i: ; preds = %bb65.i + %133 = add i64 %127, -1 + tail call void @llvm.dbg.value(metadata !{i64 %133}, i64 0, metadata !70) nounwind, !dbg !156 + %uadd147.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %131, i64 %d0.2.i) nounwind + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !72) nounwind, !dbg !156 + %134 = extractvalue %0 %uadd147.i, 1 + br i1 %134, label %bb69.i, label %bb67.i, !dbg !156 + +bb67.i: ; preds = %bb66.i + %135 = extractvalue %0 %uadd147.i, 0 + %136 = add i64 %127, -2 + %137 = icmp ult i64 %135, %128, !dbg !156 + %.7.i = select i1 %137, i64 %136, i64 %133 + br label %bb69.i + +bb69.i: ; preds = %bb67.i, %bb66.i, %bb65.i + %__q058.0.i = phi i64 [ %133, %bb66.i ], [ %127, %bb65.i ], [ %.7.i, %bb67.i ] + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !72) nounwind, !dbg !156 + %138 = shl i64 %__q157.0.i, 32 + %139 = or i64 %__q058.0.i, %138, !dbg !156 + tail call void @llvm.dbg.value(metadata !{i64 %139}, i64 0, metadata !39) nounwind, !dbg !156 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !156 + br label %__udivmodti4.exit, !dbg !156 + +bb73.i: ; preds = %bb4 + %140 = icmp ugt i64 %vv.0.1.0, %uu.0.1.0, !dbg !157 + br i1 %140, label %__udivmodti4.exit, label %bb82.i, !dbg !157 + +bb79.i: ; preds = %bb82.i + %tmp.i = shl i64 255, %.cast80.i + %141 = and i64 %tmp.i, %vv.0.1.0 + %142 = icmp eq i64 %141, 0, !dbg !158 + br i1 %142, label %bb81.i, label %bb83.i, !dbg !158 + +bb81.i: ; preds = %bb79.i + %indvar.next.i = add i64 %indvar.i, 1 + br label %bb82.i, !dbg !158 + +bb82.i: ; preds = %bb73.i, %bb81.i + %indvar.i = phi i64 [ %indvar.next.i, %bb81.i ], [ 0, %bb73.i ] + %tmp = mul i64 %indvar.i, -8 + %.cast80.i = add i64 %tmp, 56 + %143 = icmp eq i64 %.cast80.i, 0, !dbg !158 + br i1 %143, label %bb83.i, label %bb79.i, !dbg !158 + +bb83.i: ; preds = %bb82.i, %bb79.i + %.cast84.i = and i64 %.cast80.i, 4294967288 + %144 = lshr i64 %vv.0.1.0, %.cast84.i, !dbg !158 + %145 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %144, !dbg !158 + %146 = load i8* %145, align 1, !dbg !158 + %147 = zext i8 %146 to i64, !dbg !158 + %148 = add i64 %147, %.cast80.i, !dbg !158 + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !158 + %149 = icmp eq i64 %148, 64 + br i1 %149, label %bb85.i, label %bb92.i, !dbg !159 + +bb85.i: ; preds = %bb83.i + %150 = icmp ugt i64 %uu.0.1.0, %vv.0.1.0, !dbg !160 + %151 = icmp uge i64 %uu.0.0.0, %vv.0.0.0, !dbg !160 + %152 = or i1 %150, %151, !dbg !160 + %.8.i = zext i1 %152 to i64 + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !161 + br label %__udivmodti4.exit + +bb92.i: ; preds = %bb83.i + %153 = sub i64 64, %148, !dbg !158 + tail call void @llvm.dbg.value(metadata !{i64 %148}, i64 0, metadata !41) nounwind, !dbg !162 + %.cast93.i = and i64 %153, 4294967295 + %154 = shl i64 %vv.0.1.0, %.cast93.i, !dbg !163 + %.cast94.i = and i64 %148, 4294967295 + %155 = lshr i64 %vv.0.0.0, %.cast94.i, !dbg !163 + %156 = or i64 %154, %155, !dbg !163 + tail call void @llvm.dbg.value(metadata !{i64 %156}, i64 0, metadata !35) nounwind, !dbg !163 + %157 = shl i64 %vv.0.0.0, %.cast93.i, !dbg !164 + tail call void @llvm.dbg.value(metadata !{i64 %157}, i64 0, metadata !32) nounwind, !dbg !164 + %158 = lshr i64 %uu.0.1.0, %.cast94.i, !dbg !165 + tail call void @llvm.dbg.value(metadata !{i64 %158}, i64 0, metadata !38) nounwind, !dbg !165 + %159 = shl i64 %uu.0.1.0, %.cast93.i, !dbg !166 + %160 = lshr i64 %uu.0.0.0, %.cast94.i, !dbg !166 + %161 = or i64 %159, %160, !dbg !166 + tail call void @llvm.dbg.value(metadata !{i64 %161}, i64 0, metadata !37) nounwind, !dbg !166 + %162 = shl i64 %uu.0.0.0, %.cast93.i, !dbg !167 + tail call void @llvm.dbg.value(metadata !{i64 %162}, i64 0, metadata !36) nounwind, !dbg !167 + %163 = lshr i64 %156, 32, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %163}, i64 0, metadata !82) nounwind, !dbg !168 + %164 = and i64 %156, 4294967295, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %164}, i64 0, metadata !84) nounwind, !dbg !168 + %165 = urem i64 %158, %163, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %165}, i64 0, metadata !87) nounwind, !dbg !168 + %166 = udiv i64 %158, %163, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %166}, i64 0, metadata !85) nounwind, !dbg !168 + %167 = mul i64 %166, %164, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %167}, i64 0, metadata !89) nounwind, !dbg !168 + %168 = shl i64 %165, 32 + %169 = lshr i64 %161, 32, !dbg !168 + %170 = or i64 %168, %169, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %170}, i64 0, metadata !87) nounwind, !dbg !168 + %171 = icmp ult i64 %170, %167, !dbg !168 + br i1 %171, label %bb107.i, label %bb110.i, !dbg !168 + +bb107.i: ; preds = %bb92.i + %172 = add i64 %166, -1 + tail call void @llvm.dbg.value(metadata !{i64 %172}, i64 0, metadata !85) nounwind, !dbg !168 + %uadd146.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %170, i64 %156) nounwind + %173 = extractvalue %0 %uadd146.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %173}, i64 0, metadata !87) nounwind, !dbg !168 + %174 = extractvalue %0 %uadd146.i, 1 + %.not9.i = xor i1 %174, true + %175 = icmp ult i64 %173, %167, !dbg !168 + %or.cond10.i = and i1 %175, %.not9.i + br i1 %or.cond10.i, label %bb109.i, label %bb110.i, !dbg !168 + +bb109.i: ; preds = %bb107.i + %176 = add i64 %166, -2 + tail call void @llvm.dbg.value(metadata !{i64 %176}, i64 0, metadata !85) nounwind, !dbg !168 + %177 = add i64 %173, %156, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %177}, i64 0, metadata !87) nounwind, !dbg !168 + br label %bb110.i, !dbg !168 + +bb110.i: ; preds = %bb109.i, %bb107.i, %bb92.i + %__q1102.0.i = phi i64 [ %176, %bb109.i ], [ %172, %bb107.i ], [ %166, %bb92.i ] + %__r1104.0.i = phi i64 [ %177, %bb109.i ], [ %173, %bb107.i ], [ %170, %bb92.i ] + %178 = sub i64 %__r1104.0.i, %167, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %178}, i64 0, metadata !87) nounwind, !dbg !168 + %179 = urem i64 %178, %163, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %179}, i64 0, metadata !88) nounwind, !dbg !168 + %180 = udiv i64 %178, %163, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %180}, i64 0, metadata !86) nounwind, !dbg !168 + %181 = mul i64 %180, %164, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %181}, i64 0, metadata !89) nounwind, !dbg !168 + %182 = shl i64 %179, 32 + %183 = and i64 %161, 4294967295, !dbg !168 + %184 = or i64 %182, %183, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %184}, i64 0, metadata !88) nounwind, !dbg !168 + %185 = icmp ult i64 %184, %181, !dbg !168 + br i1 %185, label %bb111.i, label %bb114.i, !dbg !168 + +bb111.i: ; preds = %bb110.i + %186 = add i64 %180, -1 + tail call void @llvm.dbg.value(metadata !{i64 %186}, i64 0, metadata !86) nounwind, !dbg !168 + %uadd145.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %184, i64 %156) nounwind + %187 = extractvalue %0 %uadd145.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %187}, i64 0, metadata !88) nounwind, !dbg !168 + %188 = extractvalue %0 %uadd145.i, 1 + %.not11.i = xor i1 %188, true + %189 = icmp ult i64 %187, %181, !dbg !168 + %or.cond12.i = and i1 %189, %.not11.i + br i1 %or.cond12.i, label %bb113.i, label %bb114.i, !dbg !168 + +bb113.i: ; preds = %bb111.i + %190 = add i64 %180, -2 + tail call void @llvm.dbg.value(metadata !{i64 %190}, i64 0, metadata !86) nounwind, !dbg !168 + %191 = add i64 %187, %156, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %191}, i64 0, metadata !88) nounwind, !dbg !168 + br label %bb114.i, !dbg !168 + +bb114.i: ; preds = %bb113.i, %bb111.i, %bb110.i + %__q0103.0.i = phi i64 [ %190, %bb113.i ], [ %186, %bb111.i ], [ %180, %bb110.i ] + %__r0105.0.i = phi i64 [ %191, %bb113.i ], [ %187, %bb111.i ], [ %184, %bb110.i ] + %192 = sub i64 %__r0105.0.i, %181, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !88) nounwind, !dbg !168 + %193 = shl i64 %__q1102.0.i, 32 + %194 = or i64 %__q0103.0.i, %193, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %194}, i64 0, metadata !39) nounwind, !dbg !168 + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !37) nounwind, !dbg !168 + %195 = and i64 %__q0103.0.i, 4294967295, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %195}, i64 0, metadata !95) nounwind, !dbg !169 + %196 = lshr i64 %194, 32, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %196}, i64 0, metadata !97) nounwind, !dbg !169 + %197 = and i64 %157, 4294967295, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %197}, i64 0, metadata !96) nounwind, !dbg !169 + %198 = lshr i64 %157, 32, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %198}, i64 0, metadata !98) nounwind, !dbg !169 + %199 = mul i64 %195, %197, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %199}, i64 0, metadata !90) nounwind, !dbg !169 + %200 = mul i64 %195, %198, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %200}, i64 0, metadata !92) nounwind, !dbg !169 + %201 = mul i64 %196, %197, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %201}, i64 0, metadata !93) nounwind, !dbg !169 + %202 = mul i64 %196, %198, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %202}, i64 0, metadata !94) nounwind, !dbg !169 + %203 = lshr i64 %199, 32, !dbg !169 + %204 = add i64 %203, %200, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %204}, i64 0, metadata !92) nounwind, !dbg !169 + %uadd.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %204, i64 %201) nounwind + %205 = extractvalue %0 %uadd.i, 0 + tail call void @llvm.dbg.value(metadata !{i64 %205}, i64 0, metadata !92) nounwind, !dbg !169 + %206 = extractvalue %0 %uadd.i, 1 + %207 = add i64 %202, 4294967296, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %207}, i64 0, metadata !94) nounwind, !dbg !169 + %__x3.0.i = select i1 %206, i64 %207, i64 %202 + %208 = lshr i64 %205, 32, !dbg !169 + %209 = add i64 %__x3.0.i, %208, !dbg !169 + tail call void @llvm.dbg.value(metadata !{i64 %209}, i64 0, metadata !79) nounwind, !dbg !169 + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !81) nounwind, !dbg !169 + %210 = icmp ugt i64 %209, %192, !dbg !170 + br i1 %210, label %bb121.i, label %bb117.i, !dbg !170 + +bb117.i: ; preds = %bb114.i + %211 = and i64 %199, 4294967295, !dbg !169 + %212 = shl i64 %205, 32 + %213 = or i64 %212, %211 + %214 = icmp eq i64 %209, %192, !dbg !170 + %215 = icmp ugt i64 %213, %162, !dbg !170 + %216 = and i1 %214, %215, !dbg !170 + br i1 %216, label %bb121.i, label %__udivmodti4.exit, !dbg !170 + +bb121.i: ; preds = %bb117.i, %bb114.i + %217 = add i64 %194, -1 + tail call void @llvm.dbg.value(metadata !{i64 %217}, i64 0, metadata !39) nounwind, !dbg !171 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !99) nounwind, !dbg !172 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !79) nounwind, !dbg !172 + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !81) nounwind, !dbg !172 + br label %__udivmodti4.exit, !dbg !172 + +__udivmodti4.exit: ; preds = %bb20.i, %bb69.i, %bb73.i, %bb85.i, %bb117.i, %bb121.i + %q1.2.i = phi i64 [ 0, %bb85.i ], [ 0, %bb20.i ], [ %q1.0.i, %bb69.i ], [ 0, %bb73.i ], [ 0, %bb121.i ], [ 0, %bb117.i ] + %q0.3.i = phi i64 [ %.8.i, %bb85.i ], [ %58, %bb20.i ], [ %139, %bb69.i ], [ 0, %bb73.i ], [ %217, %bb121.i ], [ %194, %bb117.i ] + %218 = zext i64 %q0.3.i to i128 + %219 = zext i64 %q1.2.i to i128 + %220 = shl i128 %219, 64 + %221 = or i128 %220, %218 + tail call void @llvm.dbg.value(metadata !{i128 %221}, i64 0, metadata !110), !dbg !122 + %222 = icmp eq i64 %c.1, 0, !dbg !173 + %223 = sub nsw i128 0, %221, !dbg !174 + tail call void @llvm.dbg.value(metadata !{i128 %223}, i64 0, metadata !110), !dbg !174 + %w.0 = select i1 %222, i128 %221, i128 %223 + ret i128 %w.0, !dbg !175 +} + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone + +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone + +!llvm.dbg.sp = !{!0, !9} +!llvm.dbg.lv.__udivmodti4 = !{!14, !15, !16, !17, !30, !31, !32, !35, !36, !37, !38, !39, !40, !41, !42, !43, !44, !46, !47, !49, !50, !51, !52, !53, !54, !55, !57, !58, !60, !61, !62, !63, !64, !65, !66, !68, !69, !70, !71, !72, !73, !74, !76, !77, !79, !81, !82, !84, !85, !86, !87, !88, !89, !90, !92, !93, !94, !95, !96, !97, !98, !99, !101} +!llvm.dbg.lv.__divti3 = !{!103, !104, !105, !108, !109, !110} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__udivmodti4", metadata !"__udivmodti4", metadata !"", metadata !1, i32 879, metadata !3, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, null} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"foobar.c", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 1, metadata !"foobar.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{metadata !5, metadata !5, metadata !5, metadata !8} +!5 = metadata !{i32 589846, metadata !6, metadata !"UTItype", metadata !6, i32 166, i64 0, i64 0, i64 0, i32 0, metadata !7} ; [ DW_TAG_typedef ] +!6 = metadata !{i32 589865, metadata !"foobar.h", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] +!7 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] +!8 = metadata !{i32 589839, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ] +!9 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__divti3", metadata !"__divti3", metadata !"__divti3", metadata !1, i32 1094, metadata !10, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i128 (i128, i128)* @__divti3} ; [ DW_TAG_subprogram ] +!10 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null} ; [ DW_TAG_subroutine_type ] +!11 = metadata !{metadata !12, metadata !12, metadata !12} +!12 = metadata !{i32 589846, metadata !6, metadata !"TItype", metadata !6, i32 160, i64 0, i64 0, i64 0, i32 0, metadata !13} ; [ DW_TAG_typedef ] +!13 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!14 = metadata !{i32 590081, metadata !0, metadata !"n", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!15 = metadata !{i32 590081, metadata !0, metadata !"d", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!16 = metadata !{i32 590081, metadata !0, metadata !"rp", metadata !1, i32 878, metadata !8, i32 0} ; [ DW_TAG_arg_variable ] +!17 = metadata !{i32 590080, metadata !18, metadata !"nn", metadata !1, i32 880, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!18 = metadata !{i32 589835, metadata !0, i32 879, i32 0, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] +!19 = metadata !{i32 589846, metadata !1, metadata !"DWunion", metadata !1, i32 879, i64 0, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_typedef ] +!20 = metadata !{i32 589847, metadata !1, metadata !"", metadata !6, i32 432, i64 128, i64 128, i64 0, i32 0, null, metadata !21, i32 0, null} ; [ DW_TAG_union_type ] +!21 = metadata !{metadata !22, metadata !29} +!22 = metadata !{i32 589837, metadata !20, metadata !"s", metadata !6, i32 433, i64 128, i64 64, i64 0, i32 0, metadata !23} ; [ DW_TAG_member ] +!23 = metadata !{i32 589843, metadata !1, metadata !"DWstruct", metadata !6, i32 424, i64 128, i64 64, i64 0, i32 0, null, metadata !24, i32 0, null} ; [ DW_TAG_structure_type ] +!24 = metadata !{metadata !25, metadata !28} +!25 = metadata !{i32 589837, metadata !23, metadata !"low", metadata !6, i32 424, i64 64, i64 64, i64 0, i32 0, metadata !26} ; [ DW_TAG_member ] +!26 = metadata !{i32 589846, metadata !6, metadata !"DItype", metadata !6, i32 156, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] +!27 = metadata !{i32 589860, metadata !1, metadata !"long int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!28 = metadata !{i32 589837, metadata !23, metadata !"high", metadata !6, i32 424, i64 64, i64 64, i64 64, i32 0, metadata !26} ; [ DW_TAG_member ] +!29 = metadata !{i32 589837, metadata !20, metadata !"ll", metadata !6, i32 434, i64 128, i64 128, i64 0, i32 0, metadata !12} ; [ DW_TAG_member ] +!30 = metadata !{i32 590080, metadata !18, metadata !"dd", metadata !1, i32 881, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!31 = metadata !{i32 590080, metadata !18, metadata !"rr", metadata !1, i32 882, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!32 = metadata !{i32 590080, metadata !18, metadata !"d0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!33 = metadata !{i32 589846, metadata !6, metadata !"UDItype", metadata !6, i32 159, i64 0, i64 0, i64 0, i32 0, metadata !34} ; [ DW_TAG_typedef ] +!34 = metadata !{i32 589860, metadata !1, metadata !"long unsigned int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] +!35 = metadata !{i32 590080, metadata !18, metadata !"d1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!36 = metadata !{i32 590080, metadata !18, metadata !"n0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!37 = metadata !{i32 590080, metadata !18, metadata !"n1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!38 = metadata !{i32 590080, metadata !18, metadata !"n2", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!39 = metadata !{i32 590080, metadata !18, metadata !"q0", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!40 = metadata !{i32 590080, metadata !18, metadata !"q1", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!41 = metadata !{i32 590080, metadata !18, metadata !"b", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!42 = metadata !{i32 590080, metadata !18, metadata !"bm", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!43 = metadata !{i32 590080, metadata !18, metadata !"ww", metadata !1, i32 1086, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!44 = metadata !{i32 590080, metadata !45, metadata !"__xr", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!45 = metadata !{i32 589835, metadata !18, i32 933, i32 0, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] +!46 = metadata !{i32 590080, metadata !45, metadata !"__a", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!47 = metadata !{i32 590080, metadata !48, metadata !"__d1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!48 = metadata !{i32 589835, metadata !18, i32 945, i32 0, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] +!49 = metadata !{i32 590080, metadata !48, metadata !"__d0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!50 = metadata !{i32 590080, metadata !48, metadata !"__q1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!51 = metadata !{i32 590080, metadata !48, metadata !"__q0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!52 = metadata !{i32 590080, metadata !48, metadata !"__r1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!53 = metadata !{i32 590080, metadata !48, metadata !"__r0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!54 = metadata !{i32 590080, metadata !48, metadata !"__m", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!55 = metadata !{i32 590080, metadata !56, metadata !"__xr", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!56 = metadata !{i32 589835, metadata !18, i32 957, i32 0, metadata !1, i32 3} ; [ DW_TAG_lexical_block ] +!57 = metadata !{i32 590080, metadata !56, metadata !"__a", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!58 = metadata !{i32 590080, metadata !59, metadata !"__d1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!59 = metadata !{i32 589835, metadata !18, i32 982, i32 0, metadata !1, i32 4} ; [ DW_TAG_lexical_block ] +!60 = metadata !{i32 590080, metadata !59, metadata !"__d0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!61 = metadata !{i32 590080, metadata !59, metadata !"__q1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!62 = metadata !{i32 590080, metadata !59, metadata !"__q0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!63 = metadata !{i32 590080, metadata !59, metadata !"__r1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!64 = metadata !{i32 590080, metadata !59, metadata !"__r0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!65 = metadata !{i32 590080, metadata !59, metadata !"__m", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!66 = metadata !{i32 590080, metadata !67, metadata !"__d1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!67 = metadata !{i32 589835, metadata !18, i32 987, i32 0, metadata !1, i32 5} ; [ DW_TAG_lexical_block ] +!68 = metadata !{i32 590080, metadata !67, metadata !"__d0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!69 = metadata !{i32 590080, metadata !67, metadata !"__q1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!70 = metadata !{i32 590080, metadata !67, metadata !"__q0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!71 = metadata !{i32 590080, metadata !67, metadata !"__r1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!72 = metadata !{i32 590080, metadata !67, metadata !"__r0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!73 = metadata !{i32 590080, metadata !67, metadata !"__m", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!74 = metadata !{i32 590080, metadata !75, metadata !"__xr", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!75 = metadata !{i32 589835, metadata !18, i32 1022, i32 0, metadata !1, i32 6} ; [ DW_TAG_lexical_block ] +!76 = metadata !{i32 590080, metadata !75, metadata !"__a", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!77 = metadata !{i32 590080, metadata !78, metadata !"__x", metadata !1, i32 1036, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!78 = metadata !{i32 589835, metadata !18, i32 1036, i32 0, metadata !1, i32 7} ; [ DW_TAG_lexical_block ] +!79 = metadata !{i32 590080, metadata !80, metadata !"m1", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!80 = metadata !{i32 589835, metadata !18, i32 1055, i32 0, metadata !1, i32 8} ; [ DW_TAG_lexical_block ] +!81 = metadata !{i32 590080, metadata !80, metadata !"m0", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!82 = metadata !{i32 590080, metadata !83, metadata !"__d1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!83 = metadata !{i32 589835, metadata !80, i32 1063, i32 0, metadata !1, i32 9} ; [ DW_TAG_lexical_block ] +!84 = metadata !{i32 590080, metadata !83, metadata !"__d0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!85 = metadata !{i32 590080, metadata !83, metadata !"__q1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!86 = metadata !{i32 590080, metadata !83, metadata !"__q0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!87 = metadata !{i32 590080, metadata !83, metadata !"__r1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!88 = metadata !{i32 590080, metadata !83, metadata !"__r0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!89 = metadata !{i32 590080, metadata !83, metadata !"__m", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!90 = metadata !{i32 590080, metadata !91, metadata !"__x0", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!91 = metadata !{i32 589835, metadata !80, i32 1064, i32 0, metadata !1, i32 10} ; [ DW_TAG_lexical_block ] +!92 = metadata !{i32 590080, metadata !91, metadata !"__x1", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!93 = metadata !{i32 590080, metadata !91, metadata !"__x2", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!94 = metadata !{i32 590080, metadata !91, metadata !"__x3", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!95 = metadata !{i32 590080, metadata !91, metadata !"__ul", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!96 = metadata !{i32 590080, metadata !91, metadata !"__vl", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!97 = metadata !{i32 590080, metadata !91, metadata !"__uh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!98 = metadata !{i32 590080, metadata !91, metadata !"__vh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!99 = metadata !{i32 590080, metadata !100, metadata !"__x", metadata !1, i32 1069, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!100 = metadata !{i32 589835, metadata !80, i32 1069, i32 0, metadata !1, i32 11} ; [ DW_TAG_lexical_block ] +!101 = metadata !{i32 590080, metadata !102, metadata !"__x", metadata !1, i32 1077, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] +!102 = metadata !{i32 589835, metadata !80, i32 1077, i32 0, metadata !1, i32 12} ; [ DW_TAG_lexical_block ] +!103 = metadata !{i32 590081, metadata !9, metadata !"u", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] +!104 = metadata !{i32 590081, metadata !9, metadata !"v", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] +!105 = metadata !{i32 590080, metadata !106, metadata !"c", metadata !1, i32 1095, metadata !107, i32 0} ; [ DW_TAG_auto_variable ] +!106 = metadata !{i32 589835, metadata !9, i32 1094, i32 0, metadata !1, i32 13} ; [ DW_TAG_lexical_block ] +!107 = metadata !{i32 589846, metadata !6, metadata !"word_type", metadata !6, i32 424, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] +!108 = metadata !{i32 590080, metadata !106, metadata !"uu", metadata !1, i32 1096, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!109 = metadata !{i32 590080, metadata !106, metadata !"vv", metadata !1, i32 1097, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] +!110 = metadata !{i32 590080, metadata !106, metadata !"w", metadata !1, i32 1098, metadata !12, i32 0} ; [ DW_TAG_auto_variable ] +!111 = metadata !{i32 1093, i32 0, metadata !9, null} +!112 = metadata !{i32 1096, i32 0, metadata !106, null} +!113 = metadata !{i32 1097, i32 0, metadata !106, null} +!114 = metadata !{i64 0} +!115 = metadata !{i32 1095, i32 0, metadata !106, null} +!116 = metadata !{i32 1100, i32 0, metadata !106, null} +!117 = metadata !{i64 -1} +!118 = metadata !{i32 1101, i32 0, metadata !106, null} +!119 = metadata !{i32 1103, i32 0, metadata !106, null} +!120 = metadata !{i32 1104, i32 0, metadata !106, null} +!121 = metadata !{i32 878, i32 0, metadata !0, metadata !122} +!122 = metadata !{i32 1107, i32 0, metadata !106, null} +!123 = metadata !{i128* null} +!124 = metadata !{i32 880, i32 0, metadata !18, metadata !122} +!125 = metadata !{i32 881, i32 0, metadata !18, metadata !122} +!126 = metadata !{i32 882, i32 0, metadata !18, metadata !122} +!127 = metadata !{i32 1086, i32 0, metadata !18, metadata !122} +!128 = metadata !{i32 887, i32 0, metadata !18, metadata !122} +!129 = metadata !{i32 888, i32 0, metadata !18, metadata !122} +!130 = metadata !{i32 889, i32 0, metadata !18, metadata !122} +!131 = metadata !{i32 890, i32 0, metadata !18, metadata !122} +!132 = metadata !{i32 927, i32 0, metadata !18, metadata !122} +!133 = metadata !{i32 929, i32 0, metadata !18, metadata !122} +!134 = metadata !{i32 933, i32 0, metadata !45, metadata !122} +!135 = metadata !{null} +!136 = metadata !{i32 935, i32 0, metadata !18, metadata !122} +!137 = metadata !{i32 940, i32 0, metadata !18, metadata !122} +!138 = metadata !{i32 941, i32 0, metadata !18, metadata !122} +!139 = metadata !{i32 942, i32 0, metadata !18, metadata !122} +!140 = metadata !{i32 945, i32 0, metadata !48, metadata !122} +!141 = metadata !{i32 946, i32 0, metadata !18, metadata !122} +!142 = metadata !{i32 954, i32 0, metadata !18, metadata !122} +!143 = metadata !{i32 955, i32 0, metadata !18, metadata !122} +!144 = metadata !{i32 957, i32 0, metadata !56, metadata !122} +!145 = metadata !{i64 56} +!146 = metadata !{i32 959, i32 0, metadata !18, metadata !122} +!147 = metadata !{i32 968, i32 0, metadata !18, metadata !122} +!148 = metadata !{i64 1} +!149 = metadata !{i32 969, i32 0, metadata !18, metadata !122} +!150 = metadata !{i32 975, i32 0, metadata !18, metadata !122} +!151 = metadata !{i32 977, i32 0, metadata !18, metadata !122} +!152 = metadata !{i32 978, i32 0, metadata !18, metadata !122} +!153 = metadata !{i32 979, i32 0, metadata !18, metadata !122} +!154 = metadata !{i32 980, i32 0, metadata !18, metadata !122} +!155 = metadata !{i32 982, i32 0, metadata !59, metadata !122} +!156 = metadata !{i32 987, i32 0, metadata !67, metadata !122} +!157 = metadata !{i32 1003, i32 0, metadata !18, metadata !122} +!158 = metadata !{i32 1022, i32 0, metadata !75, metadata !122} +!159 = metadata !{i32 1023, i32 0, metadata !18, metadata !122} +!160 = metadata !{i32 1033, i32 0, metadata !18, metadata !122} +!161 = metadata !{i32 1041, i32 0, metadata !18, metadata !122} +!162 = metadata !{i32 1055, i32 0, metadata !80, metadata !122} +!163 = metadata !{i32 1057, i32 0, metadata !80, metadata !122} +!164 = metadata !{i32 1058, i32 0, metadata !80, metadata !122} +!165 = metadata !{i32 1059, i32 0, metadata !80, metadata !122} +!166 = metadata !{i32 1060, i32 0, metadata !80, metadata !122} +!167 = metadata !{i32 1061, i32 0, metadata !80, metadata !122} +!168 = metadata !{i32 1063, i32 0, metadata !83, metadata !122} +!169 = metadata !{i32 1064, i32 0, metadata !91, metadata !122} +!170 = metadata !{i32 1066, i32 0, metadata !80, metadata !122} +!171 = metadata !{i32 1068, i32 0, metadata !80, metadata !122} +!172 = metadata !{i32 1069, i32 0, metadata !100, metadata !122} +!173 = metadata !{i32 1108, i32 0, metadata !106, null} +!174 = metadata !{i32 1109, i32 0, metadata !106, null} +!175 = metadata !{i32 1111, i32 0, metadata !106, null} From bruno.cardoso at gmail.com Fri Feb 4 17:10:51 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 4 Feb 2011 21:10:51 -0200 Subject: [llvm-commits] [PATCH] Asm operand parsing improvements In-Reply-To: <0BC93A73-9043-487E-A370-6C09E1CC4E40@apple.com> References: <0BC93A73-9043-487E-A370-6C09E1CC4E40@apple.com> Message-ID: Hi Jim, On Fri, Feb 4, 2011 at 8:26 PM, Jim Grosbach wrote: > Hi Bruno, > > This looks very cool and is definitely an improvement over the ugly hacks we currently have. > > In the ARM parsing, you've placed the call to try to do custom operand parsing after the check for the token being an identifier. Is that necessary? It seems that it could/should be at the head of the ParseOperand() method so it will fire for any operands marked as needing custom parsing, whether they start with an identifier or not. Agreed, I think it could go in the head of the ParseOperand without any problem (at least that I'm aware of). > What happens if for a given opcode, some entries in the table have a custom parser listed for an operand position and others do not? Is there a clear-cut "right answer" for that? If not, should it be allowed at all? Since it naively tries to match in the following order: opcode, features, operand index, it's not a problem, unless for some weird case I didn't think about yet, do you have one in mind? Anyway, this could be improved over time if we find more interesting cases. > Nitpick, but shouldn't the initialization of the ParserMethod in Target.td be to the empty string rather than a question mark? It probably can, I just followed the initialization pattern already there, but no problem to change. Jim, Daniel, or someone else from ARM's world, it's ok to commit this? Are there any other plans or directions for this kind of stuff I should be aware of? Thanks for the feedback Jim :) > On Jan 26, 2011, at 5:21 AM, Bruno Cardoso Lopes wrote: > >> Hi, >> >> The first attached patch implements support for custom target specific >> asm parsing of operands. This is useful to avoid adding hacks to >> AsmParsers whenever something different from an immediate or register >> appears. The initial motivation was to remove the "mcr" family of >> hacks from ARMAsmParser, but this is also going to be useful for other >> ARM system instructions which I'm about to add the correct parsing and >> encoding once this gets accepted. The second attached patch contains >> modifications to the ARMAsmParser so that it starts using this >> mechanism. >> >> A quick explanation of how it works (read the first patch for details): >> >> A table like the one below is autogenerated for every instruction >> containing a 'ParserMethod' in its AsmOperandClass: >> >> static const OperandMatchEntry OperandMatchTable[20] = { >> ?/* Mnemonic, Operand List Mask, Operand Class, Features */ >> ?{ "cdp", 29 /* 0, 2, 3, 4 */, MCK_Coproc, Feature_IsThumb|Feature_HasV6 }, >> ?{ "cdp", 58 /* 1, 3, 4, 5 */, MCK_Coproc, Feature_IsARM }, >> >> A matcher function very similar (but lot more naive) to >> MatchInstructionImpl scans the table. After the mnemonic match, the >> features are checked and if the "to be parsed" operand index is >> present in the mask, there's a real match. Then, a switch like the one >> below dispatch the parsing to the custom method provided in >> 'ParseMethod': >> >> ?case MCK_Coproc: >> ? ?return TryParseCoprocessorOperandName(Operands); >> >> Ok to commit? Suggestions? >> Thanks. >> >> -- >> Bruno Cardoso Lopes >> http://www.brunocardoso.cc >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- Bruno Cardoso Lopes http://www.brunocardoso.cc From stoklund at 2pi.dk Fri Feb 4 17:11:13 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 04 Feb 2011 23:11:13 -0000 Subject: [llvm-commits] [llvm] r124907 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <20110204231113.40BFD2A6C12C@llvm.org> Author: stoklund Date: Fri Feb 4 17:11:13 2011 New Revision: 124907 URL: http://llvm.org/viewvc/llvm-project?rev=124907&view=rev Log: Apparently, it is possible for a block with a landing pad successor to have no calls. In that case we simply ignore the landing pad and split live ranges before the first terminator. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=124907&r1=124906&r2=124907&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Feb 4 17:11:13 2011 @@ -764,7 +764,7 @@ if (I->getDesc().isCall()) return I; } - assert(0 && "Block with landing pad successor contains no call instruction"); + // The block contains no calls that can throw, so use the first terminator. return mbb->getFirstTerminator(); } From daniel at zuster.org Fri Feb 4 17:17:40 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 04 Feb 2011 23:17:40 -0000 Subject: [llvm-commits] [llvm] r124908 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <20110204231740.65E1E2A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 4 17:17:40 2011 New Revision: 124908 URL: http://llvm.org/viewvc/llvm-project?rev=124908&view=rev Log: MC/AsmMatcher: Sink ConvertToMCInst into the TargetAsmParser instance, which implicitly allows custom conversions to be member functions. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=124908&r1=124907&r2=124908&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri Feb 4 17:17:40 2011 @@ -1356,7 +1356,7 @@ } } -static void EmitConvertToMCInst(CodeGenTarget &Target, +static void EmitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName, std::vector &Infos, raw_ostream &OS) { // Write the convert function to a separate stream, so we can drop it after @@ -1368,7 +1368,8 @@ std::set GeneratedFns; // Start the unified conversion function. - CvtOS << "static bool ConvertToMCInst(ConversionKind Kind, MCInst &Inst, " + CvtOS << "bool " << Target.getName() << ClassName << "::\n"; + CvtOS << "ConvertToMCInst(unsigned Kind, MCInst &Inst, " << "unsigned Opcode,\n" << " const SmallVectorImpl &Operands) {\n"; @@ -1921,6 +1922,10 @@ OS << " Match_MnemonicFail,\n"; OS << " Match_Success\n"; OS << " };\n"; + OS << " bool ConvertToMCInst(unsigned Kind, MCInst &Inst, " + << "unsigned Opcode,\n" + << " const SmallVectorImpl " + << "&Operands);\n"; OS << " bool MnemonicIsValid(StringRef Mnemonic);\n"; OS << " MatchResultTy MatchInstructionImpl(\n"; OS << " const SmallVectorImpl &Operands,\n"; @@ -1946,7 +1951,7 @@ bool HasMnemonicAliases = EmitMnemonicAliases(OS, Info); // Generate the unified function to convert operands into an MCInst. - EmitConvertToMCInst(Target, Info.Matchables, OS); + EmitConvertToMCInst(Target, ClassName, Info.Matchables, OS); // Emit the enumeration for classes which participate in matching. EmitMatchClassEnumeration(Target, Info.Classes, OS); From greened at obbligato.org Fri Feb 4 17:29:33 2011 From: greened at obbligato.org (David Greene) Date: Fri, 04 Feb 2011 23:29:33 -0000 Subject: [llvm-commits] [llvm] r124910 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20110204232933.B83052A6C12C@llvm.org> Author: greened Date: Fri Feb 4 17:29:33 2011 New Revision: 124910 URL: http://llvm.org/viewvc/llvm-project?rev=124910&view=rev Log: [AVX] Add some utilities to insert and extract 128-bit subvectors. This allows us to easily support 256-bit operations that don't have native 256-bit support. This applies to integer operations, certain types of shuffles and various othher things. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124910&r1=124909&r2=124910&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 4 17:29:33 2011 @@ -60,6 +60,128 @@ static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, SDValue V2); +static SDValue Insert128BitVector(SDValue Result, + SDValue Vec, + SDValue Idx, + SelectionDAG &DAG, + DebugLoc dl); +static SDValue Extract128BitVector(SDValue Vec, + SDValue Idx, + SelectionDAG &DAG, + DebugLoc dl); + +static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG &DAG); + +/// Generate a DAG to grab 128-bits from a vector > 128 bits. This +/// sets things up to match to an AVX VEXTRACTF128 instruction or a +/// simple subregister reference. +static SDValue Extract128BitVector(SDValue Vec, + SDValue Idx, + SelectionDAG &DAG, + DebugLoc dl) { + EVT VT = Vec.getValueType(); + assert(VT.getSizeInBits() == 256 && "Unexpected vector size!"); + + EVT ElVT = VT.getVectorElementType(); + + int Factor = VT.getSizeInBits() / 128; + + EVT ResultVT = EVT::getVectorVT(*DAG.getContext(), + ElVT, + VT.getVectorNumElements() / Factor); + + // Extract from UNDEF is UNDEF. + if (Vec.getOpcode() == ISD::UNDEF) + return DAG.getNode(ISD::UNDEF, dl, ResultVT); + + if (isa(Idx)) { + unsigned IdxVal = cast(Idx)->getZExtValue(); + + // Extract the relevant 128 bits. Generate an EXTRACT_SUBVECTOR + // we can match to VEXTRACTF128. + unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); + + // This is the index of the first element of the 128-bit chunk + // we want. + unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) + * ElemsPerChunk); + + SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); + + SDValue Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, Vec, + VecIdx); + + return Result; + } + + return SDValue(); +} + +/// Generate a DAG to put 128-bits into a vector > 128 bits. This +/// sets things up to match to an AVX VINSERTF128 instruction or a +/// simple superregister reference. +static SDValue Insert128BitVector(SDValue Result, + SDValue Vec, + SDValue Idx, + SelectionDAG &DAG, + DebugLoc dl) { + if (isa(Idx)) { + EVT VT = Vec.getValueType(); + assert(VT.getSizeInBits() == 128 && "Unexpected vector size!"); + + EVT ElVT = VT.getVectorElementType(); + + unsigned IdxVal = cast(Idx)->getZExtValue(); + + EVT ResultVT = Result.getValueType(); + + // Insert the relevant 128 bits. + unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); + + // This is the index of the first element of the 128-bit chunk + // we want. + unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) + * ElemsPerChunk); + + SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); + + Result = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec, + VecIdx); + return Result; + } + + return SDValue(); +} + +/// Given two vectors, concat them. +static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG &DAG) { + DebugLoc dl = Lower.getDebugLoc(); + + assert(Lower.getValueType() == Upper.getValueType() && "Mismatched vectors!"); + + EVT VT = EVT::getVectorVT(*DAG.getContext(), + Lower.getValueType().getVectorElementType(), + Lower.getValueType().getVectorNumElements() * 2); + + // TODO: Generalize to arbitrary vector length (this assumes 256-bit vectors). + assert(VT.getSizeInBits() == 256 && "Unsupported vector concat!"); + + // Insert the upper subvector. + SDValue Vec = Insert128BitVector(DAG.getNode(ISD::UNDEF, dl, VT), Upper, + DAG.getConstant( + // This is half the length of the result + // vector. Start inserting the upper 128 + // bits here. + Lower.getValueType(). + getVectorNumElements(), + MVT::i32), + DAG, dl); + + // Insert the lower subvector. + Vec = Insert128BitVector(Vec, Lower, DAG.getConstant(0, MVT::i32), DAG, dl); + return Vec; +} + static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { const X86Subtarget *Subtarget = &TM.getSubtarget(); bool is64Bit = Subtarget->is64Bit(); From nlewycky at google.com Fri Feb 4 18:07:20 2011 From: nlewycky at google.com (Nick Lewycky) Date: Fri, 4 Feb 2011 16:07:20 -0800 Subject: [llvm-commits] [llvm] r124910 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <20110204232933.B83052A6C12C@llvm.org> References: <20110204232933.B83052A6C12C@llvm.org> Message-ID: Hi David, you broke our build: llvm/lib/Target/X86/X86ISelLowering.cpp:78: error: 'llvm::SDValue Extract128BitVector(llvm::SDValue, llvm::SDValue, llvm::SelectionDAG&, llvm::DebugLoc)' defined but not used [-Wunused-function] llvm/lib/Target/X86/X86ISelLowering.cpp:157: error: 'llvm::SDValue ConcatVectors(llvm::SDValue, llvm::SDValue, llvm::SelectionDAG&)' defined but not used [-Wunused-function] llvm/lib/Target/X86/X86ISelLowering.cpp:78: error: 'llvm::SDValue Extract128BitVector(llvm::SDValue, llvm::SDValue, llvm::SelectionDAG&, llvm::DebugLoc)' defined but not used [-Wunused-function] llvm/lib/Target/X86/X86ISelLowering.cpp:157: error: 'llvm::SDValue ConcatVectors(llvm::SDValue, llvm::SDValue, llvm::SelectionDAG&)' defined but not used [-Wunused-function] Yup, we use -Werror. Are you going to commit the patch that makes use of these functions soon? Nick On 4 February 2011 15:29, David Greene wrote: > Author: greened > Date: Fri Feb 4 17:29:33 2011 > New Revision: 124910 > > URL: http://llvm.org/viewvc/llvm-project?rev=124910&view=rev > Log: > > [AVX] Add some utilities to insert and extract 128-bit subvectors. > This allows us to easily support 256-bit operations that don't have > native 256-bit support. This applies to integer operations, certain > types of shuffles and various othher things. > > Modified: > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124910&r1=124909&r2=124910&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 4 17:29:33 2011 > @@ -60,6 +60,128 @@ > static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, > SDValue V2); > > +static SDValue Insert128BitVector(SDValue Result, > + SDValue Vec, > + SDValue Idx, > + SelectionDAG &DAG, > + DebugLoc dl); > +static SDValue Extract128BitVector(SDValue Vec, > + SDValue Idx, > + SelectionDAG &DAG, > + DebugLoc dl); > + > +static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG > &DAG); > + > +/// Generate a DAG to grab 128-bits from a vector > 128 bits. This > +/// sets things up to match to an AVX VEXTRACTF128 instruction or a > +/// simple subregister reference. > +static SDValue Extract128BitVector(SDValue Vec, > + SDValue Idx, > + SelectionDAG &DAG, > + DebugLoc dl) { > + EVT VT = Vec.getValueType(); > + assert(VT.getSizeInBits() == 256 && "Unexpected vector size!"); > + > + EVT ElVT = VT.getVectorElementType(); > + > + int Factor = VT.getSizeInBits() / 128; > + > + EVT ResultVT = EVT::getVectorVT(*DAG.getContext(), > + ElVT, > + VT.getVectorNumElements() / Factor); > + > + // Extract from UNDEF is UNDEF. > + if (Vec.getOpcode() == ISD::UNDEF) > + return DAG.getNode(ISD::UNDEF, dl, ResultVT); > + > + if (isa(Idx)) { > + unsigned IdxVal = cast(Idx)->getZExtValue(); > + > + // Extract the relevant 128 bits. Generate an EXTRACT_SUBVECTOR > + // we can match to VEXTRACTF128. > + unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); > + > + // This is the index of the first element of the 128-bit chunk > + // we want. > + unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) > + * ElemsPerChunk); > + > + SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); > + > + SDValue Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, > Vec, > + VecIdx); > + > + return Result; > + } > + > + return SDValue(); > +} > + > +/// Generate a DAG to put 128-bits into a vector > 128 bits. This > +/// sets things up to match to an AVX VINSERTF128 instruction or a > +/// simple superregister reference. > +static SDValue Insert128BitVector(SDValue Result, > + SDValue Vec, > + SDValue Idx, > + SelectionDAG &DAG, > + DebugLoc dl) { > + if (isa(Idx)) { > + EVT VT = Vec.getValueType(); > + assert(VT.getSizeInBits() == 128 && "Unexpected vector size!"); > + > + EVT ElVT = VT.getVectorElementType(); > + > + unsigned IdxVal = cast(Idx)->getZExtValue(); > + > + EVT ResultVT = Result.getValueType(); > + > + // Insert the relevant 128 bits. > + unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); > + > + // This is the index of the first element of the 128-bit chunk > + // we want. > + unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) > + * ElemsPerChunk); > + > + SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); > + > + Result = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec, > + VecIdx); > + return Result; > + } > + > + return SDValue(); > +} > + > +/// Given two vectors, concat them. > +static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG > &DAG) { > + DebugLoc dl = Lower.getDebugLoc(); > + > + assert(Lower.getValueType() == Upper.getValueType() && "Mismatched > vectors!"); > + > + EVT VT = EVT::getVectorVT(*DAG.getContext(), > + Lower.getValueType().getVectorElementType(), > + Lower.getValueType().getVectorNumElements() * > 2); > + > + // TODO: Generalize to arbitrary vector length (this assumes 256-bit > vectors). > + assert(VT.getSizeInBits() == 256 && "Unsupported vector concat!"); > + > + // Insert the upper subvector. > + SDValue Vec = Insert128BitVector(DAG.getNode(ISD::UNDEF, dl, VT), Upper, > + DAG.getConstant( > + // This is half the length of the > result > + // vector. Start inserting the upper > 128 > + // bits here. > + Lower.getValueType(). > + getVectorNumElements(), > + MVT::i32), > + DAG, dl); > + > + // Insert the lower subvector. > + Vec = Insert128BitVector(Vec, Lower, DAG.getConstant(0, MVT::i32), DAG, > dl); > + return Vec; > +} > + > static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { > const X86Subtarget *Subtarget = &TM.getSubtarget(); > bool is64Bit = Subtarget->is64Bit(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/accc0edf/attachment-0001.html From grosbach at apple.com Fri Feb 4 18:13:09 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 4 Feb 2011 16:13:09 -0800 Subject: [llvm-commits] [PATCH] Asm operand parsing improvements In-Reply-To: References: <0BC93A73-9043-487E-A370-6C09E1CC4E40@apple.com> Message-ID: On Feb 4, 2011, at 3:10 PM, Bruno Cardoso Lopes wrote: > Hi Jim, > > On Fri, Feb 4, 2011 at 8:26 PM, Jim Grosbach wrote: >> Hi Bruno, >> >> This looks very cool and is definitely an improvement over the ugly hacks we currently have. >> >> In the ARM parsing, you've placed the call to try to do custom operand parsing after the check for the token being an identifier. Is that necessary? It seems that it could/should be at the head of the ParseOperand() method so it will fire for any operands marked as needing custom parsing, whether they start with an identifier or not. > > Agreed, I think it could go in the head of the ParseOperand without > any problem (at least that I'm aware of). Excellent. That should allow us to use this for things like restricted range immediates that don't fit nicely into the current general purpose lattice framework. > >> What happens if for a given opcode, some entries in the table have a custom parser listed for an operand position and others do not? Is there a clear-cut "right answer" for that? If not, should it be allowed at all? > > Since it naively tries to match in the following order: opcode, > features, operand index, it's not a problem, unless for some weird > case I didn't think about yet, do you have one in mind? Anyway, this > could be improved over time if we find more interesting cases. No specific examples in mind, no. Just a potential ambiguity that I'm not clear on what will happen. It'll very likely be a non-issue in practice. > >> Nitpick, but shouldn't the initialization of the ParserMethod in Target.td be to the empty string rather than a question mark? > > It probably can, I just followed the initialization pattern already > there, but no problem to change. > Ah, OK. I was thinking an empty string was the style used for other stuff there. Faulty memory, then. Whatever matches the existing style works for me. > Jim, Daniel, or someone else from ARM's world, it's ok to commit this? > Are there any other plans or directions for this kind of stuff I > should be aware of? > Thanks for the feedback Jim :) > I'm fine w/ going ahead w/ committing this. There's been a lot of talk about how to address issues like this, but nothing formal for long term that I'm aware of. This is a great step up and should solve a lot of the problems. Thanks for working on this! -Jim >> On Jan 26, 2011, at 5:21 AM, Bruno Cardoso Lopes wrote: >> >>> Hi, >>> >>> The first attached patch implements support for custom target specific >>> asm parsing of operands. This is useful to avoid adding hacks to >>> AsmParsers whenever something different from an immediate or register >>> appears. The initial motivation was to remove the "mcr" family of >>> hacks from ARMAsmParser, but this is also going to be useful for other >>> ARM system instructions which I'm about to add the correct parsing and >>> encoding once this gets accepted. The second attached patch contains >>> modifications to the ARMAsmParser so that it starts using this >>> mechanism. >>> >>> A quick explanation of how it works (read the first patch for details): >>> >>> A table like the one below is autogenerated for every instruction >>> containing a 'ParserMethod' in its AsmOperandClass: >>> >>> static const OperandMatchEntry OperandMatchTable[20] = { >>> /* Mnemonic, Operand List Mask, Operand Class, Features */ >>> { "cdp", 29 /* 0, 2, 3, 4 */, MCK_Coproc, Feature_IsThumb|Feature_HasV6 }, >>> { "cdp", 58 /* 1, 3, 4, 5 */, MCK_Coproc, Feature_IsARM }, >>> >>> A matcher function very similar (but lot more naive) to >>> MatchInstructionImpl scans the table. After the mnemonic match, the >>> features are checked and if the "to be parsed" operand index is >>> present in the mask, there's a real match. Then, a switch like the one >>> below dispatch the parsing to the custom method provided in >>> 'ParseMethod': >>> >>> case MCK_Coproc: >>> return TryParseCoprocessorOperandName(Operands); >>> >>> Ok to commit? Suggestions? >>> Thanks. >>> >>> -- >>> Bruno Cardoso Lopes >>> http://www.brunocardoso.cc >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> > > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc From greened at obbligato.org Fri Feb 4 18:26:01 2011 From: greened at obbligato.org (David A. Greene) Date: Fri, 04 Feb 2011 18:26:01 -0600 Subject: [llvm-commits] [llvm] r124910 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: (Nick Lewycky's message of "Fri, 4 Feb 2011 16:07:20 -0800") References: <20110204232933.B83052A6C12C@llvm.org> Message-ID: Nick Lewycky writes: > Yup, we use -Werror.?Are you going to commit the patch that makes use of these functions soon? Not until next week, likely. I will revert it. -Dave From greened at obbligato.org Fri Feb 4 18:24:41 2011 From: greened at obbligato.org (David Greene) Date: Sat, 05 Feb 2011 00:24:41 -0000 Subject: [llvm-commits] [llvm] r124912 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20110205002441.3E2532A6C12C@llvm.org> Author: greened Date: Fri Feb 4 18:24:41 2011 New Revision: 124912 URL: http://llvm.org/viewvc/llvm-project?rev=124912&view=rev Log: [AVX] Revert 124910 until clients are ready. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124912&r1=124911&r2=124912&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 4 18:24:41 2011 @@ -60,128 +60,6 @@ static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, SDValue V2); -static SDValue Insert128BitVector(SDValue Result, - SDValue Vec, - SDValue Idx, - SelectionDAG &DAG, - DebugLoc dl); -static SDValue Extract128BitVector(SDValue Vec, - SDValue Idx, - SelectionDAG &DAG, - DebugLoc dl); - -static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG &DAG); - -/// Generate a DAG to grab 128-bits from a vector > 128 bits. This -/// sets things up to match to an AVX VEXTRACTF128 instruction or a -/// simple subregister reference. -static SDValue Extract128BitVector(SDValue Vec, - SDValue Idx, - SelectionDAG &DAG, - DebugLoc dl) { - EVT VT = Vec.getValueType(); - assert(VT.getSizeInBits() == 256 && "Unexpected vector size!"); - - EVT ElVT = VT.getVectorElementType(); - - int Factor = VT.getSizeInBits() / 128; - - EVT ResultVT = EVT::getVectorVT(*DAG.getContext(), - ElVT, - VT.getVectorNumElements() / Factor); - - // Extract from UNDEF is UNDEF. - if (Vec.getOpcode() == ISD::UNDEF) - return DAG.getNode(ISD::UNDEF, dl, ResultVT); - - if (isa(Idx)) { - unsigned IdxVal = cast(Idx)->getZExtValue(); - - // Extract the relevant 128 bits. Generate an EXTRACT_SUBVECTOR - // we can match to VEXTRACTF128. - unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); - - // This is the index of the first element of the 128-bit chunk - // we want. - unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) - * ElemsPerChunk); - - SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); - - SDValue Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, Vec, - VecIdx); - - return Result; - } - - return SDValue(); -} - -/// Generate a DAG to put 128-bits into a vector > 128 bits. This -/// sets things up to match to an AVX VINSERTF128 instruction or a -/// simple superregister reference. -static SDValue Insert128BitVector(SDValue Result, - SDValue Vec, - SDValue Idx, - SelectionDAG &DAG, - DebugLoc dl) { - if (isa(Idx)) { - EVT VT = Vec.getValueType(); - assert(VT.getSizeInBits() == 128 && "Unexpected vector size!"); - - EVT ElVT = VT.getVectorElementType(); - - unsigned IdxVal = cast(Idx)->getZExtValue(); - - EVT ResultVT = Result.getValueType(); - - // Insert the relevant 128 bits. - unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits(); - - // This is the index of the first element of the 128-bit chunk - // we want. - unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128) - * ElemsPerChunk); - - SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32); - - Result = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec, - VecIdx); - return Result; - } - - return SDValue(); -} - -/// Given two vectors, concat them. -static SDValue ConcatVectors(SDValue Lower, SDValue Upper, SelectionDAG &DAG) { - DebugLoc dl = Lower.getDebugLoc(); - - assert(Lower.getValueType() == Upper.getValueType() && "Mismatched vectors!"); - - EVT VT = EVT::getVectorVT(*DAG.getContext(), - Lower.getValueType().getVectorElementType(), - Lower.getValueType().getVectorNumElements() * 2); - - // TODO: Generalize to arbitrary vector length (this assumes 256-bit vectors). - assert(VT.getSizeInBits() == 256 && "Unsupported vector concat!"); - - // Insert the upper subvector. - SDValue Vec = Insert128BitVector(DAG.getNode(ISD::UNDEF, dl, VT), Upper, - DAG.getConstant( - // This is half the length of the result - // vector. Start inserting the upper 128 - // bits here. - Lower.getValueType(). - getVectorNumElements(), - MVT::i32), - DAG, dl); - - // Insert the lower subvector. - Vec = Insert128BitVector(Vec, Lower, DAG.getConstant(0, MVT::i32), DAG, dl); - return Vec; -} - static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { const X86Subtarget *Subtarget = &TM.getSubtarget(); bool is64Bit = Subtarget->is64Bit(); From greened at obbligato.org Fri Feb 4 18:28:22 2011 From: greened at obbligato.org (David A. Greene) Date: Fri, 04 Feb 2011 18:28:22 -0600 Subject: [llvm-commits] [llvm] r124910 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: (Nick Lewycky's message of "Fri, 4 Feb 2011 16:07:20 -0800") References: <20110204232933.B83052A6C12C@llvm.org> Message-ID: Nick Lewycky writes: > Yup, we use -Werror.?Are you going to commit the patch that makes use of these functions soon? Reverted. -Dave From nlewycky at google.com Fri Feb 4 18:30:00 2011 From: nlewycky at google.com (Nick Lewycky) Date: Fri, 4 Feb 2011 16:30:00 -0800 Subject: [llvm-commits] [llvm] r124910 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <20110204232933.B83052A6C12C@llvm.org> Message-ID: On 4 February 2011 16:28, David A. Greene wrote: > Nick Lewycky writes: > > > Yup, we use -Werror. Are you going to commit the patch that makes use of > these functions soon? > > Reverted. > Thanks! Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110204/ce6f81e0/attachment.html From aggarwa4 at illinois.edu Fri Feb 4 18:31:57 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 00:31:57 -0000 Subject: [llvm-commits] [poolalloc] r124913 - /poolalloc/trunk/lib/DSA/Local.cpp Message-ID: <20110205003157.123042A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 4 18:31:56 2011 New Revision: 124913 URL: http://llvm.org/viewvc/llvm-project?rev=124913&view=rev Log: Make sure we increment the size correctly. Modified: poolalloc/trunk/lib/DSA/Local.cpp Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=124913&r1=124912&r2=124913&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Fri Feb 4 18:31:56 2011 @@ -512,8 +512,8 @@ if(GEPInst->getType() == llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext())) if(GEPInst->getNumIndices() == 1) { Offset = (cast(GEPInst->getOperand(1)))->getSExtValue(); - if(Value.getNode()->getSize() <= (Offset+1)) { - Value.getNode()->growSize(Offset + 1); + if(Value.getNode()->getSize() <= Value.getOffset() + (Offset+1)) { + Value.getNode()->growSize(Value.getOffset() + Offset + 1); } Value.setOffset(Value.getOffset()+Offset); DSNode *N = Value.getNode(); From jasonwkim at google.com Fri Feb 4 18:43:11 2011 From: jasonwkim at google.com (Jason Kim) Date: Fri, 4 Feb 2011 16:43:11 -0800 Subject: [llvm-commits] [llvm] r124899 - in /llvm/trunk: include/llvm/Support/ELF.h lib/MC/ELFObjectWriter.cpp test/MC/ARM/elf-eflags-eabi.s In-Reply-To: References: <20110204214111.33F562A6C12C@llvm.org> Message-ID: On Fri, Feb 4, 2011 at 1:51 PM, Anton Korobeynikov wrote: > Hi Jason, > >> Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to >> 5 to match the current doc. >> Added FIXME reminder Make it really configurable later. > Shouldn't this be printed in text mode as well? Hmm. Sure, why not? Might as well as make it explicit - observed behavior seems to be GNU as emitting value of 4 by default to the ELF.o. Thanks! -jason > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University > From echristo at apple.com Fri Feb 4 18:49:15 2011 From: echristo at apple.com (Eric Christopher) Date: Sat, 05 Feb 2011 00:49:15 -0000 Subject: [llvm-commits] [llvm] r124916 - in /llvm/trunk: include/llvm/Analysis/InlineCost.h lib/Analysis/InlineCost.cpp Message-ID: <20110205004915.89D672A6C12C@llvm.org> Author: echristo Date: Fri Feb 4 18:49:15 2011 New Revision: 124916 URL: http://llvm.org/viewvc/llvm-project?rev=124916&view=rev Log: Rewrite how the indirect call bonus is handled. This now works by: a) Making it a per call site bonus for functions that we can move from indirect to direct calls. b) Reduces the bonus from 500 to 100 per call site. c) Subtracts the size of the possible newly inlineable call from the bonus to only add a bonus if we can inline a small function to devirtualize it. Also changes the bonus from a positive that's subtracted to a negative that's added. Fixes the remainder of rdar://8546196 by reducing the object file size after inlining by 84%. Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h llvm/trunk/lib/Analysis/InlineCost.cpp Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/InlineCost.h?rev=124916&r1=124915&r2=124916&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/InlineCost.h (original) +++ llvm/trunk/include/llvm/Analysis/InlineCost.h Fri Feb 4 18:49:15 2011 @@ -33,7 +33,7 @@ namespace InlineConstants { // Various magic constants used to adjust heuristics. const int InstrCost = 5; - const int IndirectCallBonus = 500; + const int IndirectCallBonus = -100; const int CallPenalty = 25; const int LastCallToStaticBonus = -15000; const int ColdccPenalty = 2000; @@ -124,7 +124,10 @@ // the ValueMap will update itself when this happens. ValueMap CachedFunctionInfo; - unsigned CountBonusForConstant(Value *V); + int CountBonusForConstant(Value *V, Constant *C = NULL); + int ConstantFunctionBonus(CallSite CS, Constant *C); + int getInlineSize(CallSite CS, Function *Callee); + int getInlineBonuses(CallSite CS, Function *Callee); public: /// getInlineCost - The heuristic used to determine if we should inline the Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=124916&r1=124915&r2=124916&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Fri Feb 4 18:49:15 2011 @@ -16,6 +16,7 @@ #include "llvm/CallingConv.h" #include "llvm/IntrinsicInst.h" #include "llvm/ADT/SmallPtrSet.h" + using namespace llvm; /// callIsSmall - If a call is likely to lower to a single target instruction, @@ -298,22 +299,38 @@ return Bonus; } +// ConstantFunctionBonus - Figure out how much of a bonus we can get for +// possibly devirtualizing a function. We'll subtract the size of the function +// we may wish to inline from the indirect call bonus providing a limit on +// growth. Leave an upper limit of 0 for the bonus - we don't want to penalize +// inlining because we decide we don't want to give a bonus for +// devirtualizing. +int InlineCostAnalyzer::ConstantFunctionBonus(CallSite CS, Constant *C) { + + // This could just be NULL. + if (!C) return 0; + + Function *F = dyn_cast(C); + if (!F) return 0; + + int Bonus = InlineConstants::IndirectCallBonus + getInlineSize(CS, F); + return (Bonus > 0) ? 0 : Bonus; +} + // CountBonusForConstant - Figure out an approximation for how much per-call // performance boost we can expect if the specified value is constant. -unsigned InlineCostAnalyzer::CountBonusForConstant(Value *V) { +int InlineCostAnalyzer::CountBonusForConstant(Value *V, Constant *C) { unsigned Bonus = 0; - bool indirectCallBonus = false; for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ User *U = *UI; if (CallInst *CI = dyn_cast(U)) { // Turning an indirect call into a direct call is a BIG win if (CI->getCalledValue() == V) - indirectCallBonus = true; - } - else if (InvokeInst *II = dyn_cast(U)) { + Bonus += ConstantFunctionBonus(CallSite(CI), C); + } else if (InvokeInst *II = dyn_cast(U)) { // Turning an indirect call into a direct call is a BIG win if (II->getCalledValue() == V) - indirectCallBonus = true; + Bonus += ConstantFunctionBonus(CallSite(CI), C); } // FIXME: Eliminating conditional branches and switches should // also yield a per-call performance boost. @@ -345,13 +362,106 @@ } } - // FIXME: The only reason we're applying the bonus once is while it's great - // to devirtualize calls the magnitude of the bonus x number of call sites - // can lead to a huge code explosion when we prefer to inline 1000 instruction - // functions that have 10 call sites. This should be made a function of the - // estimated inline penalty/benefit + the indirect call bonus. - if (indirectCallBonus) Bonus += InlineConstants::IndirectCallBonus; + return Bonus; +} + +int InlineCostAnalyzer::getInlineSize(CallSite CS, Function *Callee) { + // Get information about the callee. + FunctionInfo *CalleeFI = &CachedFunctionInfo[Callee]; + + // If we haven't calculated this information yet, do so now. + if (CalleeFI->Metrics.NumBlocks == 0) + CalleeFI->analyzeFunction(Callee); + + // InlineCost - This value measures how good of an inline candidate this call + // site is to inline. A lower inline cost make is more likely for the call to + // be inlined. This value may go negative. + // + int InlineCost = 0; + + // Compute any size reductions we can expect due to arguments being passed into + // the function. + // + unsigned ArgNo = 0; + CallSite::arg_iterator I = CS.arg_begin(); + for (Function::arg_iterator FI = Callee->arg_begin(), FE = Callee->arg_end(); + FI != FE; ++I, ++FI, ++ArgNo) { + + // If an alloca is passed in, inlining this function is likely to allow + // significant future optimization possibilities (like scalar promotion, and + // scalarization), so encourage the inlining of the function. + // + if (isa(I)) + InlineCost -= CalleeFI->ArgumentWeights[ArgNo].AllocaWeight; + + // If this is a constant being passed into the function, use the argument + // weights calculated for the callee to determine how much will be folded + // away with this information. + else if (isa(I)) + InlineCost -= CalleeFI->ArgumentWeights[ArgNo].ConstantWeight; + } + + // Each argument passed in has a cost at both the caller and the callee + // sides. Measurements show that each argument costs about the same as an + // instruction. + InlineCost -= (CS.arg_size() * InlineConstants::InstrCost); + + // Now that we have considered all of the factors that make the call site more + // likely to be inlined, look at factors that make us not want to inline it. + + // Calls usually take a long time, so they make the inlining gain smaller. + InlineCost += CalleeFI->Metrics.NumCalls * InlineConstants::CallPenalty; + + // Look at the size of the callee. Each instruction counts as 5. + InlineCost += CalleeFI->Metrics.NumInsts*InlineConstants::InstrCost; + + return InlineCost; +} + +int InlineCostAnalyzer::getInlineBonuses(CallSite CS, Function *Callee) { + // Get information about the callee. + FunctionInfo *CalleeFI = &CachedFunctionInfo[Callee]; + + // If we haven't calculated this information yet, do so now. + if (CalleeFI->Metrics.NumBlocks == 0) + CalleeFI->analyzeFunction(Callee); + + bool isDirectCall = CS.getCalledFunction() == Callee; + Instruction *TheCall = CS.getInstruction(); + int Bonus = 0; + + // If there is only one call of the function, and it has internal linkage, + // make it almost guaranteed to be inlined. + // + if (Callee->hasLocalLinkage() && Callee->hasOneUse() && isDirectCall) + Bonus += InlineConstants::LastCallToStaticBonus; + + // If the instruction after the call, or if the normal destination of the + // invoke is an unreachable instruction, the function is noreturn. As such, + // there is little point in inlining this. + if (InvokeInst *II = dyn_cast(TheCall)) { + if (isa(II->getNormalDest()->begin())) + Bonus += InlineConstants::NoreturnPenalty; + } else if (isa(++BasicBlock::iterator(TheCall))) + Bonus += InlineConstants::NoreturnPenalty; + + // If this function uses the coldcc calling convention, prefer not to inline + // it. + if (Callee->getCallingConv() == CallingConv::Cold) + Bonus += InlineConstants::ColdccPenalty; + // Add to the inline quality for properties that make the call valuable to + // inline. This includes factors that indicate that the result of inlining + // the function will be optimizable. Currently this just looks at arguments + // passed into the function. + // + CallSite::arg_iterator I = CS.arg_begin(); + for (Function::arg_iterator FI = Callee->arg_begin(), FE = Callee->arg_end(); + FI != FE; ++I, ++FI) + // Compute any constant bonus due to inlining we want to give here. + if (isa(I)) + Bonus += CountBonusForConstant(FI, cast(I)); + return Bonus; } @@ -368,7 +478,6 @@ SmallPtrSet &NeverInline) { Instruction *TheCall = CS.getInstruction(); Function *Caller = TheCall->getParent()->getParent(); - bool isDirectCall = CS.getCalledFunction() == Callee; // Don't inline functions which can be redefined at link-time to mean // something else. Don't inline functions marked noinline or call sites @@ -418,72 +527,10 @@ // InlineCost - This value measures how good of an inline candidate this call // site is to inline. A lower inline cost make is more likely for the call to - // be inlined. This value may go negative. - // - int InlineCost = 0; - - // Add to the inline quality for properties that make the call valuable to - // inline. This includes factors that indicate that the result of inlining - // the function will be optimizable. Currently this just looks at arguments - // passed into the function. - // - unsigned ArgNo = 0; - CallSite::arg_iterator I = CS.arg_begin(); - for (Function::arg_iterator FI = Callee->arg_begin(), FE = Callee->arg_end(); - FI != FE; ++I, ++FI, ++ArgNo) { - - // If an alloca is passed in, inlining this function is likely to allow - // significant future optimization possibilities (like scalar promotion, and - // scalarization), so encourage the inlining of the function. - // - if (isa(I)) - InlineCost -= CalleeFI->ArgumentWeights[ArgNo].AllocaWeight; - - // If this is a constant being passed into the function, use the argument - // weights calculated for the callee to determine how much will be folded - // away with this information. - else if (isa(I)) { - InlineCost -= CalleeFI->ArgumentWeights[ArgNo].ConstantWeight; - - // Compute any constant bonus due to inlining we want to give here. - InlineCost -= CountBonusForConstant(FI); - } - } - - // Each argument passed in has a cost at both the caller and the callee - // sides. Measurements show that each argument costs about the same as an - // instruction. - InlineCost -= (CS.arg_size() * InlineConstants::InstrCost); - - // If there is only one call of the function, and it has internal linkage, - // make it almost guaranteed to be inlined. + // be inlined. This value may go negative due to the fact that bonuses + // are negative numbers. // - if (Callee->hasLocalLinkage() && Callee->hasOneUse() && isDirectCall) - InlineCost += InlineConstants::LastCallToStaticBonus; - - // Now that we have considered all of the factors that make the call site more - // likely to be inlined, look at factors that make us not want to inline it. - - // If the instruction after the call, or if the normal destination of the - // invoke is an unreachable instruction, the function is noreturn. As such, - // there is little point in inlining this. - if (InvokeInst *II = dyn_cast(TheCall)) { - if (isa(II->getNormalDest()->begin())) - InlineCost += InlineConstants::NoreturnPenalty; - } else if (isa(++BasicBlock::iterator(TheCall))) - InlineCost += InlineConstants::NoreturnPenalty; - - // If this function uses the coldcc calling convention, prefer not to inline - // it. - if (Callee->getCallingConv() == CallingConv::Cold) - InlineCost += InlineConstants::ColdccPenalty; - - // Calls usually take a long time, so they make the inlining gain smaller. - InlineCost += CalleeFI->Metrics.NumCalls * InlineConstants::CallPenalty; - - // Look at the size of the callee. Each instruction counts as 5. - InlineCost += CalleeFI->Metrics.NumInsts*InlineConstants::InstrCost; - + int InlineCost = getInlineSize(CS, Callee) + getInlineBonuses(CS, Callee); return llvm::InlineCost::get(InlineCost); } From grosbach at apple.com Fri Feb 4 18:59:14 2011 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 4 Feb 2011 16:59:14 -0800 Subject: [llvm-commits] [llvm] r124904 - in /llvm/trunk: include/llvm/CodeGen/MachineLocation.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/CodeGen/X86/dbg-merge-loc-entry.ll In-Reply-To: <20110204225719.099202A6C12C@llvm.org> References: <20110204225719.099202A6C12C@llvm.org> Message-ID: <96BB600C-3DCE-42EF-BCEB-7FA471E3C720@apple.com> Nice. I'm curious. How much size reduction does this tend to produce? I'd expect a fair bit. On Feb 4, 2011, at 2:57 PM, Devang Patel wrote: > Author: dpatel > Date: Fri Feb 4 16:57:18 2011 > New Revision: 124904 > > URL: http://llvm.org/viewvc/llvm-project?rev=124904&view=rev > Log: > Merge .debug_loc entries whenever possible to reduce debug_loc size. > > Added: > llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll > Modified: > llvm/trunk/include/llvm/CodeGen/MachineLocation.h > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > > Modified: llvm/trunk/include/llvm/CodeGen/MachineLocation.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLocation.h?rev=124904&r1=124903&r2=124904&view=diff > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineLocation.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineLocation.h Fri Feb 4 16:57:18 2011 > @@ -41,6 +41,11 @@ > : IsRegister(true), Register(R), Offset(0) {} > MachineLocation(unsigned R, int O) > : IsRegister(false), Register(R), Offset(O) {} > + > + bool operator==(const MachineLocation &Other) const { > + return IsRegister == Other.IsRegister && Register == Other.Register && > + Offset == Other.Offset; > + } > > // Accessors > bool isReg() const { return IsRegister; } > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=124904&r1=124903&r2=124904&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Feb 4 16:57:18 2011 > @@ -3580,6 +3580,14 @@ > if (DotDebugLocEntries.empty()) > return; > > + for (SmallVector::iterator > + I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); > + I != E; ++I) { > + DotDebugLocEntry &Entry = *I; > + if (I + 1 != DotDebugLocEntries.end()) > + Entry.Merge(I+1); > + } > + > // Start the dwarf loc section. > Asm->OutStreamer.SwitchSection( > Asm->getObjFileLowering().getDwarfLocSection()); > @@ -3589,7 +3597,8 @@ > for (SmallVector::iterator > I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); > I != E; ++I, ++index) { > - DotDebugLocEntry Entry = *I; > + DotDebugLocEntry &Entry = *I; > + if (Entry.isMerged()) continue; > if (Entry.isEmpty()) { > Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); > Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=124904&r1=124903&r2=124904&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Feb 4 16:57:18 2011 > @@ -74,6 +74,28 @@ > MCSymbol *getLabel() const { return Label; } > }; > > +/// DotDebugLocEntry - This struct describes location entries emitted in > +/// .debug_loc section. > +typedef struct DotDebugLocEntry { > + const MCSymbol *Begin; > + const MCSymbol *End; > + MachineLocation Loc; > + bool Merged; > + DotDebugLocEntry() : Begin(0), End(0), Merged(false) {} > + DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L) > + : Begin(B), End(E), Loc(L), Merged(false) {} > + /// Empty entries are also used as a trigger to emit temp label. Such > + /// labels are referenced is used to find debug_loc offset for a given DIE. > + bool isEmpty() { return Begin == 0 && End == 0; } > + bool isMerged() { return Merged; } > + void Merge(DotDebugLocEntry *Next) { > + if (!(Begin && Loc == Next->Loc && End == Next->Begin)) > + return; > + Next->Begin = Begin; > + Merged = true; > + } > +} DotDebugLocEntry; > + > class DwarfDebug { > /// Asm - Target of Dwarf emission. > AsmPrinter *Asm; > @@ -153,20 +175,6 @@ > /// machine instruction. > DenseMap DbgVariableToDbgInstMap; > > - /// DotDebugLocEntry - This struct describes location entries emitted in > - /// .debug_loc section. > - typedef struct DotDebugLocEntry { > - const MCSymbol *Begin; > - const MCSymbol *End; > - MachineLocation Loc; > - DotDebugLocEntry() : Begin(0), End(0) {} > - DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, > - MachineLocation &L) : Begin(B), End(E), Loc(L) {} > - /// Empty entries are also used as a trigger to emit temp label. Such > - /// labels are referenced is used to find debug_loc offset for a given DIE. > - bool isEmpty() { return Begin == 0 && End == 0; } > - } DotDebugLocEntry; > - > /// DotDebugLocEntries - Collection of DotDebugLocEntry. > SmallVector DotDebugLocEntries; > > > Added: llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll?rev=124904&view=auto > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll (added) > +++ llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll Fri Feb 4 16:57:18 2011 > @@ -0,0 +1,827 @@ > +; RUN: llc < %s | FileCheck %s > +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" > +target triple = "x86_64-apple-darwin8" > + > +;CHECK: Ldebug_loc2: > +;CHECK-NEXT: .quad Ltmp11 > +;CHECK-NEXT: .quad Lfunc_end0 > +;CHECK-NEXT: .short 1 ## Loc expr size > +;CHECK-NEXT: .byte 85 ## DW_OP_reg5 > +;CHECK-NEXT: .quad 0 > +;CHECK-NEXT: .quad 0 > + > + > +%0 = type { i64, i1 } > + > + at __clz_tab = external unnamed_addr constant [256 x i8] > + > +define hidden i128 @__divti3(i128 %u, i128 %v) nounwind readnone { > +entry: > + tail call void @llvm.dbg.value(metadata !{i128 %u}, i64 0, metadata !103), !dbg !111 > + tail call void @llvm.dbg.value(metadata !{i128 %v}, i64 0, metadata !104), !dbg !111 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !108), !dbg !112 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !109), !dbg !113 > + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !105), !dbg !115 > + %0 = trunc i128 %u to i64 > + %sroa.store.elt15 = lshr i128 %u, 64 > + %1 = trunc i128 %sroa.store.elt15 to i64 > + %2 = trunc i128 %v to i64 > + %sroa.store.elt = lshr i128 %v, 64 > + %3 = trunc i128 %sroa.store.elt to i64 > + %4 = icmp slt i64 %1, 0, !dbg !116 > + br i1 %4, label %bb, label %bb1, !dbg !116 > + > +bb: ; preds = %entry > + tail call void @llvm.dbg.value(metadata !117, i64 0, metadata !105), !dbg !118 > + %5 = sub nsw i128 0, %u, !dbg !118 > + %6 = trunc i128 %5 to i64 > + %sroa.store.elt18 = lshr i128 %5, 64 > + %7 = trunc i128 %sroa.store.elt18 to i64 > + br label %bb1, !dbg !118 > + > +bb1: ; preds = %bb, %entry > + %uu.0.1.0 = phi i64 [ %7, %bb ], [ %1, %entry ] > + %uu.0.0.0 = phi i64 [ %6, %bb ], [ %0, %entry ] > + %c.0 = phi i64 [ -1, %bb ], [ 0, %entry ] > + %8 = icmp slt i64 %3, 0, !dbg !119 > + br i1 %8, label %bb2, label %bb4, !dbg !119 > + > +bb2: ; preds = %bb1 > + %not3 = xor i64 %c.0, -1, !dbg !120 > + tail call void @llvm.dbg.value(metadata !{i64 %not3}, i64 0, metadata !105), !dbg !120 > + %9 = sub nsw i128 0, %v, !dbg !120 > + %10 = trunc i128 %9 to i64 > + %sroa.store.elt11 = lshr i128 %9, 64 > + %11 = trunc i128 %sroa.store.elt11 to i64 > + br label %bb4, !dbg !120 > + > +bb4: ; preds = %bb2, %bb1 > + %vv.0.1.0 = phi i64 [ %11, %bb2 ], [ %3, %bb1 ] > + %vv.0.0.0 = phi i64 [ %10, %bb2 ], [ %2, %bb1 ] > + %c.1 = phi i64 [ %not3, %bb2 ], [ %c.0, %bb1 ] > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !14) nounwind, !dbg !121 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !15) nounwind, !dbg !121 > + tail call void @llvm.dbg.value(metadata !123, i64 0, metadata !16) nounwind, !dbg !121 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !17) nounwind, !dbg !124 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !30) nounwind, !dbg !125 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !31) nounwind, !dbg !126 > + tail call void @llvm.dbg.declare(metadata !{null}, metadata !43) nounwind, !dbg !127 > + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.0.0}, i64 0, metadata !32) nounwind, !dbg !128 > + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.1.0}, i64 0, metadata !35) nounwind, !dbg !129 > + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.0.0}, i64 0, metadata !36) nounwind, !dbg !130 > + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.1.0}, i64 0, metadata !37) nounwind, !dbg !131 > + %12 = icmp eq i64 %vv.0.1.0, 0, !dbg !132 > + br i1 %12, label %bb.i, label %bb73.i, !dbg !132 > + > +bb.i: ; preds = %bb4 > + %13 = icmp ugt i64 %vv.0.0.0, %uu.0.1.0, !dbg !133 > + br i1 %13, label %bb4.i, label %bb21.i, !dbg !133 > + > +bb2.i: ; preds = %bb4.i > + %tmp154.i = shl i64 255, %.cast.i > + %14 = and i64 %tmp154.i, %vv.0.0.0 > + %15 = icmp eq i64 %14, 0, !dbg !134 > + br i1 %15, label %bb3.i, label %bb5.i, !dbg !134 > + > +bb3.i: ; preds = %bb2.i > + %indvar.next20.i = add i64 %indvar19.i, 1 > + br label %bb4.i, !dbg !134 > + > +bb4.i: ; preds = %bb.i, %bb3.i > + %indvar19.i = phi i64 [ %indvar.next20.i, %bb3.i ], [ 0, %bb.i ] > + %tmp24 = mul i64 %indvar19.i, -8 > + %.cast.i = add i64 %tmp24, 56 > + %16 = icmp eq i64 %.cast.i, 0, !dbg !134 > + br i1 %16, label %bb5.i, label %bb2.i, !dbg !134 > + > +bb5.i: ; preds = %bb4.i, %bb2.i > + %.cast6.i = and i64 %.cast.i, 4294967288 > + %17 = lshr i64 %vv.0.0.0, %.cast6.i, !dbg !134 > + %18 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %17, !dbg !134 > + %19 = load i8* %18, align 1, !dbg !134 > + %20 = zext i8 %19 to i64, !dbg !134 > + %21 = add i64 %20, %.cast.i, !dbg !134 > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !134 > + %22 = icmp eq i64 %21, 64 > + br i1 %22, label %bb12.i, label %bb7.i, !dbg !136 > + > +bb7.i: ; preds = %bb5.i > + %23 = sub i64 64, %21, !dbg !134 > + %.cast8.i = and i64 %23, 4294967295 > + %24 = shl i64 %vv.0.0.0, %.cast8.i, !dbg !137 > + tail call void @llvm.dbg.value(metadata !{i64 %24}, i64 0, metadata !32) nounwind, !dbg !137 > + %25 = shl i64 %uu.0.1.0, %.cast8.i, !dbg !138 > + %.cast10.i = and i64 %21, 4294967295 > + %26 = lshr i64 %uu.0.0.0, %.cast10.i, !dbg !138 > + %27 = or i64 %25, %26, !dbg !138 > + tail call void @llvm.dbg.value(metadata !{i64 %27}, i64 0, metadata !37) nounwind, !dbg !138 > + %28 = shl i64 %uu.0.0.0, %.cast8.i, !dbg !139 > + tail call void @llvm.dbg.value(metadata !{i64 %28}, i64 0, metadata !36) nounwind, !dbg !139 > + br label %bb12.i, !dbg !139 > + > +bb12.i: ; preds = %bb7.i, %bb5.i > + %n1.0.i = phi i64 [ %27, %bb7.i ], [ %uu.0.1.0, %bb5.i ] > + %n0.0.i = phi i64 [ %28, %bb7.i ], [ %uu.0.0.0, %bb5.i ] > + %d0.0.i = phi i64 [ %24, %bb7.i ], [ %vv.0.0.0, %bb5.i ] > + %29 = lshr i64 %d0.0.i, 32, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %29}, i64 0, metadata !47) nounwind, !dbg !140 > + %30 = and i64 %d0.0.i, 4294967295, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %30}, i64 0, metadata !49) nounwind, !dbg !140 > + %31 = urem i64 %n1.0.i, %29, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %31}, i64 0, metadata !52) nounwind, !dbg !140 > + %32 = udiv i64 %n1.0.i, %29, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %32}, i64 0, metadata !50) nounwind, !dbg !140 > + %33 = mul i64 %32, %30, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %33}, i64 0, metadata !54) nounwind, !dbg !140 > + %34 = shl i64 %31, 32 > + %35 = lshr i64 %n0.0.i, 32, !dbg !140 > + %36 = or i64 %34, %35, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %36}, i64 0, metadata !52) nounwind, !dbg !140 > + %37 = icmp ult i64 %36, %33, !dbg !140 > + br i1 %37, label %bb13.i, label %bb16.i, !dbg !140 > + > +bb13.i: ; preds = %bb12.i > + %38 = add i64 %32, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %38}, i64 0, metadata !50) nounwind, !dbg !140 > + %uadd153.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %36, i64 %d0.0.i) nounwind > + %39 = extractvalue %0 %uadd153.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %39}, i64 0, metadata !52) nounwind, !dbg !140 > + %40 = extractvalue %0 %uadd153.i, 1 > + %.not.i = xor i1 %40, true > + %41 = icmp ult i64 %39, %33, !dbg !140 > + %or.cond.i = and i1 %41, %.not.i > + br i1 %or.cond.i, label %bb15.i, label %bb16.i, !dbg !140 > + > +bb15.i: ; preds = %bb13.i > + %42 = add i64 %32, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %42}, i64 0, metadata !50) nounwind, !dbg !140 > + %43 = add i64 %39, %d0.0.i, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %43}, i64 0, metadata !52) nounwind, !dbg !140 > + br label %bb16.i, !dbg !140 > + > +bb16.i: ; preds = %bb15.i, %bb13.i, %bb12.i > + %__r1.0.i = phi i64 [ %43, %bb15.i ], [ %39, %bb13.i ], [ %36, %bb12.i ] > + %__q1.0.i = phi i64 [ %42, %bb15.i ], [ %38, %bb13.i ], [ %32, %bb12.i ] > + %44 = sub i64 %__r1.0.i, %33, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %44}, i64 0, metadata !52) nounwind, !dbg !140 > + %45 = urem i64 %44, %29, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %45}, i64 0, metadata !53) nounwind, !dbg !140 > + %46 = udiv i64 %44, %29, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %46}, i64 0, metadata !51) nounwind, !dbg !140 > + %47 = mul i64 %46, %30, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %47}, i64 0, metadata !54) nounwind, !dbg !140 > + %48 = shl i64 %45, 32 > + %49 = and i64 %n0.0.i, 4294967295, !dbg !140 > + %50 = or i64 %48, %49, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %50}, i64 0, metadata !53) nounwind, !dbg !140 > + %51 = icmp ult i64 %50, %47, !dbg !140 > + br i1 %51, label %bb17.i, label %bb20.i, !dbg !140 > + > +bb17.i: ; preds = %bb16.i > + %52 = add i64 %46, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %52}, i64 0, metadata !51) nounwind, !dbg !140 > + %uadd152.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %50, i64 %d0.0.i) nounwind > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !53) nounwind, !dbg !140 > + %53 = extractvalue %0 %uadd152.i, 1 > + br i1 %53, label %bb20.i, label %bb18.i, !dbg !140 > + > +bb18.i: ; preds = %bb17.i > + %54 = extractvalue %0 %uadd152.i, 0 > + %55 = add i64 %46, -2 > + %56 = icmp ult i64 %54, %47, !dbg !140 > + %..i = select i1 %56, i64 %55, i64 %52 > + br label %bb20.i > + > +bb20.i: ; preds = %bb18.i, %bb17.i, %bb16.i > + %__q0.0.i = phi i64 [ %52, %bb17.i ], [ %46, %bb16.i ], [ %..i, %bb18.i ] > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !53) nounwind, !dbg !140 > + %57 = shl i64 %__q1.0.i, 32 > + %58 = or i64 %__q0.0.i, %57, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{i64 %58}, i64 0, metadata !39) nounwind, !dbg !140 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !140 > + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !141 > + br label %__udivmodti4.exit, !dbg !141 > + > +bb21.i: ; preds = %bb.i > + %59 = icmp eq i64 %vv.0.0.0, 0, !dbg !142 > + br i1 %59, label %bb22.i, label %bb23.i, !dbg !142 > + > +bb22.i: ; preds = %bb21.i > + %60 = udiv i64 1, %vv.0.0.0, !dbg !143 > + tail call void @llvm.dbg.value(metadata !{i64 %60}, i64 0, metadata !32) nounwind, !dbg !143 > + br label %bb23.i, !dbg !143 > + > +bb23.i: ; preds = %bb22.i, %bb21.i > + %d0.1.i = phi i64 [ %60, %bb22.i ], [ %vv.0.0.0, %bb21.i ] > + tail call void @llvm.dbg.value(metadata !{i64 %d0.1.i}, i64 0, metadata !55) nounwind, !dbg !144 > + tail call void @llvm.dbg.value(metadata !145, i64 0, metadata !57) nounwind, !dbg !144 > + br label %bb29.i, !dbg !144 > + > +bb26.i: ; preds = %bb29.i > + %tmp151.i = shl i64 255, %.cast27.i > + %61 = and i64 %tmp151.i, %d0.1.i > + %62 = icmp eq i64 %61, 0, !dbg !144 > + br i1 %62, label %bb28.i, label %bb30.i, !dbg !144 > + > +bb28.i: ; preds = %bb26.i > + %indvar.next16.i = add i64 %indvar15.i, 1 > + br label %bb29.i, !dbg !144 > + > +bb29.i: ; preds = %bb28.i, %bb23.i > + %indvar15.i = phi i64 [ %indvar.next16.i, %bb28.i ], [ 0, %bb23.i ] > + %tmp22 = mul i64 %indvar15.i, -8 > + %.cast27.i = add i64 %tmp22, 56 > + %63 = icmp eq i64 %.cast27.i, 0, !dbg !144 > + br i1 %63, label %bb30.i, label %bb26.i, !dbg !144 > + > +bb30.i: ; preds = %bb29.i, %bb26.i > + %.cast31.i = and i64 %.cast27.i, 4294967288 > + %64 = lshr i64 %d0.1.i, %.cast31.i, !dbg !144 > + %65 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %64, !dbg !144 > + %66 = load i8* %65, align 1, !dbg !144 > + %67 = zext i8 %66 to i64, !dbg !144 > + %68 = add i64 %67, %.cast27.i, !dbg !144 > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !144 > + %69 = icmp eq i64 %68, 64 > + br i1 %69, label %bb32.i, label %bb33.i, !dbg !146 > + > +bb32.i: ; preds = %bb30.i > + %70 = sub i64 %uu.0.1.0, %d0.1.i, !dbg !147 > + tail call void @llvm.dbg.value(metadata !{i64 %70}, i64 0, metadata !37) nounwind, !dbg !147 > + tail call void @llvm.dbg.value(metadata !148, i64 0, metadata !40) nounwind, !dbg !149 > + br label %bb54.i, !dbg !149 > + > +bb33.i: ; preds = %bb30.i > + %71 = sub i64 64, %68, !dbg !144 > + tail call void @llvm.dbg.value(metadata !{i64 %68}, i64 0, metadata !41) nounwind, !dbg !150 > + %.cast34.i = and i64 %71, 4294967295 > + %72 = shl i64 %d0.1.i, %.cast34.i, !dbg !151 > + tail call void @llvm.dbg.value(metadata !{i64 %72}, i64 0, metadata !32) nounwind, !dbg !151 > + %.cast35.i = and i64 %68, 4294967295 > + %73 = lshr i64 %uu.0.1.0, %.cast35.i, !dbg !152 > + tail call void @llvm.dbg.value(metadata !{i64 %73}, i64 0, metadata !38) nounwind, !dbg !152 > + %74 = shl i64 %uu.0.1.0, %.cast34.i, !dbg !153 > + %75 = lshr i64 %uu.0.0.0, %.cast35.i, !dbg !153 > + %76 = or i64 %74, %75, !dbg !153 > + tail call void @llvm.dbg.value(metadata !{i64 %76}, i64 0, metadata !37) nounwind, !dbg !153 > + %77 = shl i64 %uu.0.0.0, %.cast34.i, !dbg !154 > + tail call void @llvm.dbg.value(metadata !{i64 %77}, i64 0, metadata !36) nounwind, !dbg !154 > + %78 = lshr i64 %72, 32, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %78}, i64 0, metadata !58) nounwind, !dbg !155 > + %79 = and i64 %72, 4294967295, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %79}, i64 0, metadata !60) nounwind, !dbg !155 > + %80 = urem i64 %73, %78, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %80}, i64 0, metadata !63) nounwind, !dbg !155 > + %81 = udiv i64 %73, %78, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %81}, i64 0, metadata !61) nounwind, !dbg !155 > + %82 = mul i64 %81, %79, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %82}, i64 0, metadata !65) nounwind, !dbg !155 > + %83 = shl i64 %80, 32 > + %84 = lshr i64 %76, 32, !dbg !155 > + %85 = or i64 %83, %84, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %85}, i64 0, metadata !63) nounwind, !dbg !155 > + %86 = icmp ult i64 %85, %82, !dbg !155 > + br i1 %86, label %bb46.i, label %bb49.i, !dbg !155 > + > +bb46.i: ; preds = %bb33.i > + %87 = add i64 %81, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %87}, i64 0, metadata !61) nounwind, !dbg !155 > + %uadd150.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %85, i64 %72) nounwind > + %88 = extractvalue %0 %uadd150.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %88}, i64 0, metadata !63) nounwind, !dbg !155 > + %89 = extractvalue %0 %uadd150.i, 1 > + %.not1.i = xor i1 %89, true > + %90 = icmp ult i64 %88, %82, !dbg !155 > + %or.cond2.i = and i1 %90, %.not1.i > + br i1 %or.cond2.i, label %bb48.i, label %bb49.i, !dbg !155 > + > +bb48.i: ; preds = %bb46.i > + %91 = add i64 %81, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %91}, i64 0, metadata !61) nounwind, !dbg !155 > + %92 = add i64 %88, %72, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %92}, i64 0, metadata !63) nounwind, !dbg !155 > + br label %bb49.i, !dbg !155 > + > +bb49.i: ; preds = %bb48.i, %bb46.i, %bb33.i > + %__q141.0.i = phi i64 [ %91, %bb48.i ], [ %87, %bb46.i ], [ %81, %bb33.i ] > + %__r143.0.i = phi i64 [ %92, %bb48.i ], [ %88, %bb46.i ], [ %85, %bb33.i ] > + %93 = sub i64 %__r143.0.i, %82, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %93}, i64 0, metadata !63) nounwind, !dbg !155 > + %94 = urem i64 %93, %78, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %94}, i64 0, metadata !64) nounwind, !dbg !155 > + %95 = udiv i64 %93, %78, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %95}, i64 0, metadata !62) nounwind, !dbg !155 > + %96 = mul i64 %95, %79, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %96}, i64 0, metadata !65) nounwind, !dbg !155 > + %97 = shl i64 %94, 32 > + %98 = and i64 %76, 4294967295, !dbg !155 > + %99 = or i64 %97, %98, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %99}, i64 0, metadata !64) nounwind, !dbg !155 > + %100 = icmp ult i64 %99, %96, !dbg !155 > + br i1 %100, label %bb50.i, label %bb53.i, !dbg !155 > + > +bb50.i: ; preds = %bb49.i > + %101 = add i64 %95, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %101}, i64 0, metadata !62) nounwind, !dbg !155 > + %uadd149.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %99, i64 %72) nounwind > + %102 = extractvalue %0 %uadd149.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %102}, i64 0, metadata !64) nounwind, !dbg !155 > + %103 = extractvalue %0 %uadd149.i, 1 > + %.not3.i = xor i1 %103, true > + %104 = icmp ult i64 %102, %96, !dbg !155 > + %or.cond4.i = and i1 %104, %.not3.i > + br i1 %or.cond4.i, label %bb52.i, label %bb53.i, !dbg !155 > + > +bb52.i: ; preds = %bb50.i > + %105 = add i64 %95, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %105}, i64 0, metadata !62) nounwind, !dbg !155 > + %106 = add i64 %102, %72, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %106}, i64 0, metadata !64) nounwind, !dbg !155 > + br label %bb53.i, !dbg !155 > + > +bb53.i: ; preds = %bb52.i, %bb50.i, %bb49.i > + %__q042.0.i = phi i64 [ %105, %bb52.i ], [ %101, %bb50.i ], [ %95, %bb49.i ] > + %__r044.0.i = phi i64 [ %106, %bb52.i ], [ %102, %bb50.i ], [ %99, %bb49.i ] > + %107 = sub i64 %__r044.0.i, %96, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !64) nounwind, !dbg !155 > + %108 = shl i64 %__q141.0.i, 32 > + %109 = or i64 %__q042.0.i, %108, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %109}, i64 0, metadata !40) nounwind, !dbg !155 > + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !37) nounwind, !dbg !155 > + br label %bb54.i, !dbg !155 > + > +bb54.i: ; preds = %bb53.i, %bb32.i > + %q1.0.i = phi i64 [ 1, %bb32.i ], [ %109, %bb53.i ] > + %n1.1.i = phi i64 [ %70, %bb32.i ], [ %107, %bb53.i ] > + %n0.1.i = phi i64 [ %uu.0.0.0, %bb32.i ], [ %77, %bb53.i ] > + %d0.2.i = phi i64 [ %d0.1.i, %bb32.i ], [ %72, %bb53.i ] > + %110 = lshr i64 %d0.2.i, 32, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %110}, i64 0, metadata !66) nounwind, !dbg !156 > + %111 = and i64 %d0.2.i, 4294967295, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %111}, i64 0, metadata !68) nounwind, !dbg !156 > + %112 = urem i64 %n1.1.i, %110, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %112}, i64 0, metadata !71) nounwind, !dbg !156 > + %113 = udiv i64 %n1.1.i, %110, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %113}, i64 0, metadata !69) nounwind, !dbg !156 > + %114 = mul i64 %113, %111, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %114}, i64 0, metadata !73) nounwind, !dbg !156 > + %115 = shl i64 %112, 32 > + %116 = lshr i64 %n0.1.i, 32, !dbg !156 > + %117 = or i64 %115, %116, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %117}, i64 0, metadata !71) nounwind, !dbg !156 > + %118 = icmp ult i64 %117, %114, !dbg !156 > + br i1 %118, label %bb62.i, label %bb65.i, !dbg !156 > + > +bb62.i: ; preds = %bb54.i > + %119 = add i64 %113, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %119}, i64 0, metadata !69) nounwind, !dbg !156 > + %uadd148.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %117, i64 %d0.2.i) nounwind > + %120 = extractvalue %0 %uadd148.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %120}, i64 0, metadata !71) nounwind, !dbg !156 > + %121 = extractvalue %0 %uadd148.i, 1 > + %.not5.i = xor i1 %121, true > + %122 = icmp ult i64 %120, %114, !dbg !156 > + %or.cond6.i = and i1 %122, %.not5.i > + br i1 %or.cond6.i, label %bb64.i, label %bb65.i, !dbg !156 > + > +bb64.i: ; preds = %bb62.i > + %123 = add i64 %113, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %123}, i64 0, metadata !69) nounwind, !dbg !156 > + %124 = add i64 %120, %d0.2.i, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %124}, i64 0, metadata !71) nounwind, !dbg !156 > + br label %bb65.i, !dbg !156 > + > +bb65.i: ; preds = %bb64.i, %bb62.i, %bb54.i > + %__q157.0.i = phi i64 [ %123, %bb64.i ], [ %119, %bb62.i ], [ %113, %bb54.i ] > + %__r159.0.i = phi i64 [ %124, %bb64.i ], [ %120, %bb62.i ], [ %117, %bb54.i ] > + %125 = sub i64 %__r159.0.i, %114, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %125}, i64 0, metadata !71) nounwind, !dbg !156 > + %126 = urem i64 %125, %110, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %126}, i64 0, metadata !72) nounwind, !dbg !156 > + %127 = udiv i64 %125, %110, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %127}, i64 0, metadata !70) nounwind, !dbg !156 > + %128 = mul i64 %127, %111, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %128}, i64 0, metadata !73) nounwind, !dbg !156 > + %129 = shl i64 %126, 32 > + %130 = and i64 %n0.1.i, 4294967295, !dbg !156 > + %131 = or i64 %129, %130, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %131}, i64 0, metadata !72) nounwind, !dbg !156 > + %132 = icmp ult i64 %131, %128, !dbg !156 > + br i1 %132, label %bb66.i, label %bb69.i, !dbg !156 > + > +bb66.i: ; preds = %bb65.i > + %133 = add i64 %127, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %133}, i64 0, metadata !70) nounwind, !dbg !156 > + %uadd147.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %131, i64 %d0.2.i) nounwind > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !72) nounwind, !dbg !156 > + %134 = extractvalue %0 %uadd147.i, 1 > + br i1 %134, label %bb69.i, label %bb67.i, !dbg !156 > + > +bb67.i: ; preds = %bb66.i > + %135 = extractvalue %0 %uadd147.i, 0 > + %136 = add i64 %127, -2 > + %137 = icmp ult i64 %135, %128, !dbg !156 > + %.7.i = select i1 %137, i64 %136, i64 %133 > + br label %bb69.i > + > +bb69.i: ; preds = %bb67.i, %bb66.i, %bb65.i > + %__q058.0.i = phi i64 [ %133, %bb66.i ], [ %127, %bb65.i ], [ %.7.i, %bb67.i ] > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !72) nounwind, !dbg !156 > + %138 = shl i64 %__q157.0.i, 32 > + %139 = or i64 %__q058.0.i, %138, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{i64 %139}, i64 0, metadata !39) nounwind, !dbg !156 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !156 > + br label %__udivmodti4.exit, !dbg !156 > + > +bb73.i: ; preds = %bb4 > + %140 = icmp ugt i64 %vv.0.1.0, %uu.0.1.0, !dbg !157 > + br i1 %140, label %__udivmodti4.exit, label %bb82.i, !dbg !157 > + > +bb79.i: ; preds = %bb82.i > + %tmp.i = shl i64 255, %.cast80.i > + %141 = and i64 %tmp.i, %vv.0.1.0 > + %142 = icmp eq i64 %141, 0, !dbg !158 > + br i1 %142, label %bb81.i, label %bb83.i, !dbg !158 > + > +bb81.i: ; preds = %bb79.i > + %indvar.next.i = add i64 %indvar.i, 1 > + br label %bb82.i, !dbg !158 > + > +bb82.i: ; preds = %bb73.i, %bb81.i > + %indvar.i = phi i64 [ %indvar.next.i, %bb81.i ], [ 0, %bb73.i ] > + %tmp = mul i64 %indvar.i, -8 > + %.cast80.i = add i64 %tmp, 56 > + %143 = icmp eq i64 %.cast80.i, 0, !dbg !158 > + br i1 %143, label %bb83.i, label %bb79.i, !dbg !158 > + > +bb83.i: ; preds = %bb82.i, %bb79.i > + %.cast84.i = and i64 %.cast80.i, 4294967288 > + %144 = lshr i64 %vv.0.1.0, %.cast84.i, !dbg !158 > + %145 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %144, !dbg !158 > + %146 = load i8* %145, align 1, !dbg !158 > + %147 = zext i8 %146 to i64, !dbg !158 > + %148 = add i64 %147, %.cast80.i, !dbg !158 > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !158 > + %149 = icmp eq i64 %148, 64 > + br i1 %149, label %bb85.i, label %bb92.i, !dbg !159 > + > +bb85.i: ; preds = %bb83.i > + %150 = icmp ugt i64 %uu.0.1.0, %vv.0.1.0, !dbg !160 > + %151 = icmp uge i64 %uu.0.0.0, %vv.0.0.0, !dbg !160 > + %152 = or i1 %150, %151, !dbg !160 > + %.8.i = zext i1 %152 to i64 > + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !161 > + br label %__udivmodti4.exit > + > +bb92.i: ; preds = %bb83.i > + %153 = sub i64 64, %148, !dbg !158 > + tail call void @llvm.dbg.value(metadata !{i64 %148}, i64 0, metadata !41) nounwind, !dbg !162 > + %.cast93.i = and i64 %153, 4294967295 > + %154 = shl i64 %vv.0.1.0, %.cast93.i, !dbg !163 > + %.cast94.i = and i64 %148, 4294967295 > + %155 = lshr i64 %vv.0.0.0, %.cast94.i, !dbg !163 > + %156 = or i64 %154, %155, !dbg !163 > + tail call void @llvm.dbg.value(metadata !{i64 %156}, i64 0, metadata !35) nounwind, !dbg !163 > + %157 = shl i64 %vv.0.0.0, %.cast93.i, !dbg !164 > + tail call void @llvm.dbg.value(metadata !{i64 %157}, i64 0, metadata !32) nounwind, !dbg !164 > + %158 = lshr i64 %uu.0.1.0, %.cast94.i, !dbg !165 > + tail call void @llvm.dbg.value(metadata !{i64 %158}, i64 0, metadata !38) nounwind, !dbg !165 > + %159 = shl i64 %uu.0.1.0, %.cast93.i, !dbg !166 > + %160 = lshr i64 %uu.0.0.0, %.cast94.i, !dbg !166 > + %161 = or i64 %159, %160, !dbg !166 > + tail call void @llvm.dbg.value(metadata !{i64 %161}, i64 0, metadata !37) nounwind, !dbg !166 > + %162 = shl i64 %uu.0.0.0, %.cast93.i, !dbg !167 > + tail call void @llvm.dbg.value(metadata !{i64 %162}, i64 0, metadata !36) nounwind, !dbg !167 > + %163 = lshr i64 %156, 32, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %163}, i64 0, metadata !82) nounwind, !dbg !168 > + %164 = and i64 %156, 4294967295, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %164}, i64 0, metadata !84) nounwind, !dbg !168 > + %165 = urem i64 %158, %163, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %165}, i64 0, metadata !87) nounwind, !dbg !168 > + %166 = udiv i64 %158, %163, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %166}, i64 0, metadata !85) nounwind, !dbg !168 > + %167 = mul i64 %166, %164, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %167}, i64 0, metadata !89) nounwind, !dbg !168 > + %168 = shl i64 %165, 32 > + %169 = lshr i64 %161, 32, !dbg !168 > + %170 = or i64 %168, %169, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %170}, i64 0, metadata !87) nounwind, !dbg !168 > + %171 = icmp ult i64 %170, %167, !dbg !168 > + br i1 %171, label %bb107.i, label %bb110.i, !dbg !168 > + > +bb107.i: ; preds = %bb92.i > + %172 = add i64 %166, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %172}, i64 0, metadata !85) nounwind, !dbg !168 > + %uadd146.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %170, i64 %156) nounwind > + %173 = extractvalue %0 %uadd146.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %173}, i64 0, metadata !87) nounwind, !dbg !168 > + %174 = extractvalue %0 %uadd146.i, 1 > + %.not9.i = xor i1 %174, true > + %175 = icmp ult i64 %173, %167, !dbg !168 > + %or.cond10.i = and i1 %175, %.not9.i > + br i1 %or.cond10.i, label %bb109.i, label %bb110.i, !dbg !168 > + > +bb109.i: ; preds = %bb107.i > + %176 = add i64 %166, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %176}, i64 0, metadata !85) nounwind, !dbg !168 > + %177 = add i64 %173, %156, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %177}, i64 0, metadata !87) nounwind, !dbg !168 > + br label %bb110.i, !dbg !168 > + > +bb110.i: ; preds = %bb109.i, %bb107.i, %bb92.i > + %__q1102.0.i = phi i64 [ %176, %bb109.i ], [ %172, %bb107.i ], [ %166, %bb92.i ] > + %__r1104.0.i = phi i64 [ %177, %bb109.i ], [ %173, %bb107.i ], [ %170, %bb92.i ] > + %178 = sub i64 %__r1104.0.i, %167, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %178}, i64 0, metadata !87) nounwind, !dbg !168 > + %179 = urem i64 %178, %163, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %179}, i64 0, metadata !88) nounwind, !dbg !168 > + %180 = udiv i64 %178, %163, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %180}, i64 0, metadata !86) nounwind, !dbg !168 > + %181 = mul i64 %180, %164, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %181}, i64 0, metadata !89) nounwind, !dbg !168 > + %182 = shl i64 %179, 32 > + %183 = and i64 %161, 4294967295, !dbg !168 > + %184 = or i64 %182, %183, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %184}, i64 0, metadata !88) nounwind, !dbg !168 > + %185 = icmp ult i64 %184, %181, !dbg !168 > + br i1 %185, label %bb111.i, label %bb114.i, !dbg !168 > + > +bb111.i: ; preds = %bb110.i > + %186 = add i64 %180, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %186}, i64 0, metadata !86) nounwind, !dbg !168 > + %uadd145.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %184, i64 %156) nounwind > + %187 = extractvalue %0 %uadd145.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %187}, i64 0, metadata !88) nounwind, !dbg !168 > + %188 = extractvalue %0 %uadd145.i, 1 > + %.not11.i = xor i1 %188, true > + %189 = icmp ult i64 %187, %181, !dbg !168 > + %or.cond12.i = and i1 %189, %.not11.i > + br i1 %or.cond12.i, label %bb113.i, label %bb114.i, !dbg !168 > + > +bb113.i: ; preds = %bb111.i > + %190 = add i64 %180, -2 > + tail call void @llvm.dbg.value(metadata !{i64 %190}, i64 0, metadata !86) nounwind, !dbg !168 > + %191 = add i64 %187, %156, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %191}, i64 0, metadata !88) nounwind, !dbg !168 > + br label %bb114.i, !dbg !168 > + > +bb114.i: ; preds = %bb113.i, %bb111.i, %bb110.i > + %__q0103.0.i = phi i64 [ %190, %bb113.i ], [ %186, %bb111.i ], [ %180, %bb110.i ] > + %__r0105.0.i = phi i64 [ %191, %bb113.i ], [ %187, %bb111.i ], [ %184, %bb110.i ] > + %192 = sub i64 %__r0105.0.i, %181, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !88) nounwind, !dbg !168 > + %193 = shl i64 %__q1102.0.i, 32 > + %194 = or i64 %__q0103.0.i, %193, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %194}, i64 0, metadata !39) nounwind, !dbg !168 > + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !37) nounwind, !dbg !168 > + %195 = and i64 %__q0103.0.i, 4294967295, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %195}, i64 0, metadata !95) nounwind, !dbg !169 > + %196 = lshr i64 %194, 32, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %196}, i64 0, metadata !97) nounwind, !dbg !169 > + %197 = and i64 %157, 4294967295, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %197}, i64 0, metadata !96) nounwind, !dbg !169 > + %198 = lshr i64 %157, 32, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %198}, i64 0, metadata !98) nounwind, !dbg !169 > + %199 = mul i64 %195, %197, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %199}, i64 0, metadata !90) nounwind, !dbg !169 > + %200 = mul i64 %195, %198, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %200}, i64 0, metadata !92) nounwind, !dbg !169 > + %201 = mul i64 %196, %197, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %201}, i64 0, metadata !93) nounwind, !dbg !169 > + %202 = mul i64 %196, %198, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %202}, i64 0, metadata !94) nounwind, !dbg !169 > + %203 = lshr i64 %199, 32, !dbg !169 > + %204 = add i64 %203, %200, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %204}, i64 0, metadata !92) nounwind, !dbg !169 > + %uadd.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %204, i64 %201) nounwind > + %205 = extractvalue %0 %uadd.i, 0 > + tail call void @llvm.dbg.value(metadata !{i64 %205}, i64 0, metadata !92) nounwind, !dbg !169 > + %206 = extractvalue %0 %uadd.i, 1 > + %207 = add i64 %202, 4294967296, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %207}, i64 0, metadata !94) nounwind, !dbg !169 > + %__x3.0.i = select i1 %206, i64 %207, i64 %202 > + %208 = lshr i64 %205, 32, !dbg !169 > + %209 = add i64 %__x3.0.i, %208, !dbg !169 > + tail call void @llvm.dbg.value(metadata !{i64 %209}, i64 0, metadata !79) nounwind, !dbg !169 > + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !81) nounwind, !dbg !169 > + %210 = icmp ugt i64 %209, %192, !dbg !170 > + br i1 %210, label %bb121.i, label %bb117.i, !dbg !170 > + > +bb117.i: ; preds = %bb114.i > + %211 = and i64 %199, 4294967295, !dbg !169 > + %212 = shl i64 %205, 32 > + %213 = or i64 %212, %211 > + %214 = icmp eq i64 %209, %192, !dbg !170 > + %215 = icmp ugt i64 %213, %162, !dbg !170 > + %216 = and i1 %214, %215, !dbg !170 > + br i1 %216, label %bb121.i, label %__udivmodti4.exit, !dbg !170 > + > +bb121.i: ; preds = %bb117.i, %bb114.i > + %217 = add i64 %194, -1 > + tail call void @llvm.dbg.value(metadata !{i64 %217}, i64 0, metadata !39) nounwind, !dbg !171 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !99) nounwind, !dbg !172 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !79) nounwind, !dbg !172 > + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !81) nounwind, !dbg !172 > + br label %__udivmodti4.exit, !dbg !172 > + > +__udivmodti4.exit: ; preds = %bb20.i, %bb69.i, %bb73.i, %bb85.i, %bb117.i, %bb121.i > + %q1.2.i = phi i64 [ 0, %bb85.i ], [ 0, %bb20.i ], [ %q1.0.i, %bb69.i ], [ 0, %bb73.i ], [ 0, %bb121.i ], [ 0, %bb117.i ] > + %q0.3.i = phi i64 [ %.8.i, %bb85.i ], [ %58, %bb20.i ], [ %139, %bb69.i ], [ 0, %bb73.i ], [ %217, %bb121.i ], [ %194, %bb117.i ] > + %218 = zext i64 %q0.3.i to i128 > + %219 = zext i64 %q1.2.i to i128 > + %220 = shl i128 %219, 64 > + %221 = or i128 %220, %218 > + tail call void @llvm.dbg.value(metadata !{i128 %221}, i64 0, metadata !110), !dbg !122 > + %222 = icmp eq i64 %c.1, 0, !dbg !173 > + %223 = sub nsw i128 0, %221, !dbg !174 > + tail call void @llvm.dbg.value(metadata !{i128 %223}, i64 0, metadata !110), !dbg !174 > + %w.0 = select i1 %222, i128 %221, i128 %223 > + ret i128 %w.0, !dbg !175 > +} > + > +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone > + > +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone > + > +declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone > + > +!llvm.dbg.sp = !{!0, !9} > +!llvm.dbg.lv.__udivmodti4 = !{!14, !15, !16, !17, !30, !31, !32, !35, !36, !37, !38, !39, !40, !41, !42, !43, !44, !46, !47, !49, !50, !51, !52, !53, !54, !55, !57, !58, !60, !61, !62, !63, !64, !65, !66, !68, !69, !70, !71, !72, !73, !74, !76, !77, !79, !81, !82, !84, !85, !86, !87, !88, !89, !90, !92, !93, !94, !95, !96, !97, !98, !99, !101} > +!llvm.dbg.lv.__divti3 = !{!103, !104, !105, !108, !109, !110} > + > +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__udivmodti4", metadata !"__udivmodti4", metadata !"", metadata !1, i32 879, metadata !3, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, null} ; [ DW_TAG_subprogram ] > +!1 = metadata !{i32 589865, metadata !"foobar.c", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] > +!2 = metadata !{i32 589841, i32 0, i32 1, metadata !"foobar.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] > +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ] > +!4 = metadata !{metadata !5, metadata !5, metadata !5, metadata !8} > +!5 = metadata !{i32 589846, metadata !6, metadata !"UTItype", metadata !6, i32 166, i64 0, i64 0, i64 0, i32 0, metadata !7} ; [ DW_TAG_typedef ] > +!6 = metadata !{i32 589865, metadata !"foobar.h", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] > +!7 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] > +!8 = metadata !{i32 589839, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ] > +!9 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__divti3", metadata !"__divti3", metadata !"__divti3", metadata !1, i32 1094, metadata !10, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i128 (i128, i128)* @__divti3} ; [ DW_TAG_subprogram ] > +!10 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null} ; [ DW_TAG_subroutine_type ] > +!11 = metadata !{metadata !12, metadata !12, metadata !12} > +!12 = metadata !{i32 589846, metadata !6, metadata !"TItype", metadata !6, i32 160, i64 0, i64 0, i64 0, i32 0, metadata !13} ; [ DW_TAG_typedef ] > +!13 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] > +!14 = metadata !{i32 590081, metadata !0, metadata !"n", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!15 = metadata !{i32 590081, metadata !0, metadata !"d", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!16 = metadata !{i32 590081, metadata !0, metadata !"rp", metadata !1, i32 878, metadata !8, i32 0} ; [ DW_TAG_arg_variable ] > +!17 = metadata !{i32 590080, metadata !18, metadata !"nn", metadata !1, i32 880, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!18 = metadata !{i32 589835, metadata !0, i32 879, i32 0, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] > +!19 = metadata !{i32 589846, metadata !1, metadata !"DWunion", metadata !1, i32 879, i64 0, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_typedef ] > +!20 = metadata !{i32 589847, metadata !1, metadata !"", metadata !6, i32 432, i64 128, i64 128, i64 0, i32 0, null, metadata !21, i32 0, null} ; [ DW_TAG_union_type ] > +!21 = metadata !{metadata !22, metadata !29} > +!22 = metadata !{i32 589837, metadata !20, metadata !"s", metadata !6, i32 433, i64 128, i64 64, i64 0, i32 0, metadata !23} ; [ DW_TAG_member ] > +!23 = metadata !{i32 589843, metadata !1, metadata !"DWstruct", metadata !6, i32 424, i64 128, i64 64, i64 0, i32 0, null, metadata !24, i32 0, null} ; [ DW_TAG_structure_type ] > +!24 = metadata !{metadata !25, metadata !28} > +!25 = metadata !{i32 589837, metadata !23, metadata !"low", metadata !6, i32 424, i64 64, i64 64, i64 0, i32 0, metadata !26} ; [ DW_TAG_member ] > +!26 = metadata !{i32 589846, metadata !6, metadata !"DItype", metadata !6, i32 156, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] > +!27 = metadata !{i32 589860, metadata !1, metadata !"long int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] > +!28 = metadata !{i32 589837, metadata !23, metadata !"high", metadata !6, i32 424, i64 64, i64 64, i64 64, i32 0, metadata !26} ; [ DW_TAG_member ] > +!29 = metadata !{i32 589837, metadata !20, metadata !"ll", metadata !6, i32 434, i64 128, i64 128, i64 0, i32 0, metadata !12} ; [ DW_TAG_member ] > +!30 = metadata !{i32 590080, metadata !18, metadata !"dd", metadata !1, i32 881, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!31 = metadata !{i32 590080, metadata !18, metadata !"rr", metadata !1, i32 882, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!32 = metadata !{i32 590080, metadata !18, metadata !"d0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!33 = metadata !{i32 589846, metadata !6, metadata !"UDItype", metadata !6, i32 159, i64 0, i64 0, i64 0, i32 0, metadata !34} ; [ DW_TAG_typedef ] > +!34 = metadata !{i32 589860, metadata !1, metadata !"long unsigned int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] > +!35 = metadata !{i32 590080, metadata !18, metadata !"d1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!36 = metadata !{i32 590080, metadata !18, metadata !"n0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!37 = metadata !{i32 590080, metadata !18, metadata !"n1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!38 = metadata !{i32 590080, metadata !18, metadata !"n2", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!39 = metadata !{i32 590080, metadata !18, metadata !"q0", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!40 = metadata !{i32 590080, metadata !18, metadata !"q1", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!41 = metadata !{i32 590080, metadata !18, metadata !"b", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!42 = metadata !{i32 590080, metadata !18, metadata !"bm", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!43 = metadata !{i32 590080, metadata !18, metadata !"ww", metadata !1, i32 1086, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!44 = metadata !{i32 590080, metadata !45, metadata !"__xr", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!45 = metadata !{i32 589835, metadata !18, i32 933, i32 0, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] > +!46 = metadata !{i32 590080, metadata !45, metadata !"__a", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!47 = metadata !{i32 590080, metadata !48, metadata !"__d1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!48 = metadata !{i32 589835, metadata !18, i32 945, i32 0, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] > +!49 = metadata !{i32 590080, metadata !48, metadata !"__d0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!50 = metadata !{i32 590080, metadata !48, metadata !"__q1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!51 = metadata !{i32 590080, metadata !48, metadata !"__q0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!52 = metadata !{i32 590080, metadata !48, metadata !"__r1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!53 = metadata !{i32 590080, metadata !48, metadata !"__r0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!54 = metadata !{i32 590080, metadata !48, metadata !"__m", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!55 = metadata !{i32 590080, metadata !56, metadata !"__xr", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!56 = metadata !{i32 589835, metadata !18, i32 957, i32 0, metadata !1, i32 3} ; [ DW_TAG_lexical_block ] > +!57 = metadata !{i32 590080, metadata !56, metadata !"__a", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!58 = metadata !{i32 590080, metadata !59, metadata !"__d1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!59 = metadata !{i32 589835, metadata !18, i32 982, i32 0, metadata !1, i32 4} ; [ DW_TAG_lexical_block ] > +!60 = metadata !{i32 590080, metadata !59, metadata !"__d0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!61 = metadata !{i32 590080, metadata !59, metadata !"__q1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!62 = metadata !{i32 590080, metadata !59, metadata !"__q0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!63 = metadata !{i32 590080, metadata !59, metadata !"__r1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!64 = metadata !{i32 590080, metadata !59, metadata !"__r0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!65 = metadata !{i32 590080, metadata !59, metadata !"__m", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!66 = metadata !{i32 590080, metadata !67, metadata !"__d1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!67 = metadata !{i32 589835, metadata !18, i32 987, i32 0, metadata !1, i32 5} ; [ DW_TAG_lexical_block ] > +!68 = metadata !{i32 590080, metadata !67, metadata !"__d0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!69 = metadata !{i32 590080, metadata !67, metadata !"__q1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!70 = metadata !{i32 590080, metadata !67, metadata !"__q0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!71 = metadata !{i32 590080, metadata !67, metadata !"__r1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!72 = metadata !{i32 590080, metadata !67, metadata !"__r0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!73 = metadata !{i32 590080, metadata !67, metadata !"__m", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!74 = metadata !{i32 590080, metadata !75, metadata !"__xr", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!75 = metadata !{i32 589835, metadata !18, i32 1022, i32 0, metadata !1, i32 6} ; [ DW_TAG_lexical_block ] > +!76 = metadata !{i32 590080, metadata !75, metadata !"__a", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!77 = metadata !{i32 590080, metadata !78, metadata !"__x", metadata !1, i32 1036, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!78 = metadata !{i32 589835, metadata !18, i32 1036, i32 0, metadata !1, i32 7} ; [ DW_TAG_lexical_block ] > +!79 = metadata !{i32 590080, metadata !80, metadata !"m1", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!80 = metadata !{i32 589835, metadata !18, i32 1055, i32 0, metadata !1, i32 8} ; [ DW_TAG_lexical_block ] > +!81 = metadata !{i32 590080, metadata !80, metadata !"m0", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!82 = metadata !{i32 590080, metadata !83, metadata !"__d1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!83 = metadata !{i32 589835, metadata !80, i32 1063, i32 0, metadata !1, i32 9} ; [ DW_TAG_lexical_block ] > +!84 = metadata !{i32 590080, metadata !83, metadata !"__d0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!85 = metadata !{i32 590080, metadata !83, metadata !"__q1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!86 = metadata !{i32 590080, metadata !83, metadata !"__q0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!87 = metadata !{i32 590080, metadata !83, metadata !"__r1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!88 = metadata !{i32 590080, metadata !83, metadata !"__r0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!89 = metadata !{i32 590080, metadata !83, metadata !"__m", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!90 = metadata !{i32 590080, metadata !91, metadata !"__x0", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!91 = metadata !{i32 589835, metadata !80, i32 1064, i32 0, metadata !1, i32 10} ; [ DW_TAG_lexical_block ] > +!92 = metadata !{i32 590080, metadata !91, metadata !"__x1", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!93 = metadata !{i32 590080, metadata !91, metadata !"__x2", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!94 = metadata !{i32 590080, metadata !91, metadata !"__x3", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!95 = metadata !{i32 590080, metadata !91, metadata !"__ul", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!96 = metadata !{i32 590080, metadata !91, metadata !"__vl", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!97 = metadata !{i32 590080, metadata !91, metadata !"__uh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!98 = metadata !{i32 590080, metadata !91, metadata !"__vh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!99 = metadata !{i32 590080, metadata !100, metadata !"__x", metadata !1, i32 1069, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!100 = metadata !{i32 589835, metadata !80, i32 1069, i32 0, metadata !1, i32 11} ; [ DW_TAG_lexical_block ] > +!101 = metadata !{i32 590080, metadata !102, metadata !"__x", metadata !1, i32 1077, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] > +!102 = metadata !{i32 589835, metadata !80, i32 1077, i32 0, metadata !1, i32 12} ; [ DW_TAG_lexical_block ] > +!103 = metadata !{i32 590081, metadata !9, metadata !"u", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] > +!104 = metadata !{i32 590081, metadata !9, metadata !"v", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] > +!105 = metadata !{i32 590080, metadata !106, metadata !"c", metadata !1, i32 1095, metadata !107, i32 0} ; [ DW_TAG_auto_variable ] > +!106 = metadata !{i32 589835, metadata !9, i32 1094, i32 0, metadata !1, i32 13} ; [ DW_TAG_lexical_block ] > +!107 = metadata !{i32 589846, metadata !6, metadata !"word_type", metadata !6, i32 424, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] > +!108 = metadata !{i32 590080, metadata !106, metadata !"uu", metadata !1, i32 1096, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!109 = metadata !{i32 590080, metadata !106, metadata !"vv", metadata !1, i32 1097, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] > +!110 = metadata !{i32 590080, metadata !106, metadata !"w", metadata !1, i32 1098, metadata !12, i32 0} ; [ DW_TAG_auto_variable ] > +!111 = metadata !{i32 1093, i32 0, metadata !9, null} > +!112 = metadata !{i32 1096, i32 0, metadata !106, null} > +!113 = metadata !{i32 1097, i32 0, metadata !106, null} > +!114 = metadata !{i64 0} > +!115 = metadata !{i32 1095, i32 0, metadata !106, null} > +!116 = metadata !{i32 1100, i32 0, metadata !106, null} > +!117 = metadata !{i64 -1} > +!118 = metadata !{i32 1101, i32 0, metadata !106, null} > +!119 = metadata !{i32 1103, i32 0, metadata !106, null} > +!120 = metadata !{i32 1104, i32 0, metadata !106, null} > +!121 = metadata !{i32 878, i32 0, metadata !0, metadata !122} > +!122 = metadata !{i32 1107, i32 0, metadata !106, null} > +!123 = metadata !{i128* null} > +!124 = metadata !{i32 880, i32 0, metadata !18, metadata !122} > +!125 = metadata !{i32 881, i32 0, metadata !18, metadata !122} > +!126 = metadata !{i32 882, i32 0, metadata !18, metadata !122} > +!127 = metadata !{i32 1086, i32 0, metadata !18, metadata !122} > +!128 = metadata !{i32 887, i32 0, metadata !18, metadata !122} > +!129 = metadata !{i32 888, i32 0, metadata !18, metadata !122} > +!130 = metadata !{i32 889, i32 0, metadata !18, metadata !122} > +!131 = metadata !{i32 890, i32 0, metadata !18, metadata !122} > +!132 = metadata !{i32 927, i32 0, metadata !18, metadata !122} > +!133 = metadata !{i32 929, i32 0, metadata !18, metadata !122} > +!134 = metadata !{i32 933, i32 0, metadata !45, metadata !122} > +!135 = metadata !{null} > +!136 = metadata !{i32 935, i32 0, metadata !18, metadata !122} > +!137 = metadata !{i32 940, i32 0, metadata !18, metadata !122} > +!138 = metadata !{i32 941, i32 0, metadata !18, metadata !122} > +!139 = metadata !{i32 942, i32 0, metadata !18, metadata !122} > +!140 = metadata !{i32 945, i32 0, metadata !48, metadata !122} > +!141 = metadata !{i32 946, i32 0, metadata !18, metadata !122} > +!142 = metadata !{i32 954, i32 0, metadata !18, metadata !122} > +!143 = metadata !{i32 955, i32 0, metadata !18, metadata !122} > +!144 = metadata !{i32 957, i32 0, metadata !56, metadata !122} > +!145 = metadata !{i64 56} > +!146 = metadata !{i32 959, i32 0, metadata !18, metadata !122} > +!147 = metadata !{i32 968, i32 0, metadata !18, metadata !122} > +!148 = metadata !{i64 1} > +!149 = metadata !{i32 969, i32 0, metadata !18, metadata !122} > +!150 = metadata !{i32 975, i32 0, metadata !18, metadata !122} > +!151 = metadata !{i32 977, i32 0, metadata !18, metadata !122} > +!152 = metadata !{i32 978, i32 0, metadata !18, metadata !122} > +!153 = metadata !{i32 979, i32 0, metadata !18, metadata !122} > +!154 = metadata !{i32 980, i32 0, metadata !18, metadata !122} > +!155 = metadata !{i32 982, i32 0, metadata !59, metadata !122} > +!156 = metadata !{i32 987, i32 0, metadata !67, metadata !122} > +!157 = metadata !{i32 1003, i32 0, metadata !18, metadata !122} > +!158 = metadata !{i32 1022, i32 0, metadata !75, metadata !122} > +!159 = metadata !{i32 1023, i32 0, metadata !18, metadata !122} > +!160 = metadata !{i32 1033, i32 0, metadata !18, metadata !122} > +!161 = metadata !{i32 1041, i32 0, metadata !18, metadata !122} > +!162 = metadata !{i32 1055, i32 0, metadata !80, metadata !122} > +!163 = metadata !{i32 1057, i32 0, metadata !80, metadata !122} > +!164 = metadata !{i32 1058, i32 0, metadata !80, metadata !122} > +!165 = metadata !{i32 1059, i32 0, metadata !80, metadata !122} > +!166 = metadata !{i32 1060, i32 0, metadata !80, metadata !122} > +!167 = metadata !{i32 1061, i32 0, metadata !80, metadata !122} > +!168 = metadata !{i32 1063, i32 0, metadata !83, metadata !122} > +!169 = metadata !{i32 1064, i32 0, metadata !91, metadata !122} > +!170 = metadata !{i32 1066, i32 0, metadata !80, metadata !122} > +!171 = metadata !{i32 1068, i32 0, metadata !80, metadata !122} > +!172 = metadata !{i32 1069, i32 0, metadata !100, metadata !122} > +!173 = metadata !{i32 1108, i32 0, metadata !106, null} > +!174 = metadata !{i32 1109, i32 0, metadata !106, null} > +!175 = metadata !{i32 1111, i32 0, metadata !106, null} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From stoklund at 2pi.dk Fri Feb 4 19:06:36 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Sat, 05 Feb 2011 01:06:36 -0000 Subject: [llvm-commits] [llvm] r124917 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110205010636.EC9492A6C12C@llvm.org> Author: stoklund Date: Fri Feb 4 19:06:36 2011 New Revision: 124917 URL: http://llvm.org/viewvc/llvm-project?rev=124917&view=rev Log: Add assertions to verify that the new interval is clear of the interference. If these inequalities don't hold, we are creating a live range split that won't allocate. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124917&r1=124916&r2=124917&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Feb 4 19:06:36 2011 @@ -719,7 +719,8 @@ if (!BI.Uses) { // No uses in block, avoid interference by reloading as late as possible. DEBUG(dbgs() << ", no uses.\n"); - SE.enterIntvAtEnd(*BI.MBB); + SlotIndex SegStart = SE.enterIntvAtEnd(*BI.MBB); + assert(SegStart >= IP.second && "Couldn't avoid interference"); continue; } if (IP.second < BI.LastUse && IP.second <= BI.LastSplitPoint) { @@ -731,13 +732,16 @@ SlotIndex Use = *UI; DEBUG(dbgs() << ", free use at " << Use << ".\n"); assert(Use <= BI.LastUse && "Couldn't find last use"); - SE.useIntv(SE.enterIntvBefore(Use), Stop); + SlotIndex SegStart = SE.enterIntvBefore(Use); + assert(SegStart >= IP.second && "Couldn't avoid interference"); + SE.useIntv(SegStart, Stop); continue; } // Interference is after the last use. DEBUG(dbgs() << " after last use.\n"); - SE.enterIntvAtEnd(*BI.MBB); + SlotIndex SegStart = SE.enterIntvAtEnd(*BI.MBB); + assert(SegStart >= IP.second && "Couldn't avoid interference"); } // Now all defs leading to live bundles are handled, do everything else. @@ -797,7 +801,8 @@ if (!BI.Uses) { // No uses in block, avoid interference by spilling as soon as possible. DEBUG(dbgs() << ", no uses.\n"); - SE.leaveIntvAtTop(*BI.MBB); + SlotIndex SegEnd = SE.leaveIntvAtTop(*BI.MBB); + assert(SegEnd <= IP.first && "Couldn't avoid interference"); continue; } if (IP.first > BI.FirstUse) { @@ -808,14 +813,16 @@ assert(UI != SA->UseSlots.begin() && "Couldn't find first use"); SlotIndex Use = (--UI)->getBoundaryIndex(); DEBUG(dbgs() << ", free use at " << *UI << ".\n"); - assert(Use >= BI.FirstUse && Use < IP.first); - SE.useIntv(Start, SE.leaveIntvAfter(Use)); + SlotIndex SegEnd = SE.leaveIntvAfter(Use); + assert(SegEnd <= IP.first && "Couldn't avoid interference"); + SE.useIntv(Start, SegEnd); continue; } // Interference is before the first use. DEBUG(dbgs() << " before first use.\n"); - SE.leaveIntvAtTop(*BI.MBB); + SlotIndex SegEnd = SE.leaveIntvAtTop(*BI.MBB); + assert(SegEnd <= IP.first && "Couldn't avoid interference"); } SE.closeIntv(); From stoklund at 2pi.dk Fri Feb 4 19:06:39 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Sat, 05 Feb 2011 01:06:39 -0000 Subject: [llvm-commits] [llvm] r124918 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Message-ID: <20110205010639.7EB642A6C12D@llvm.org> Author: stoklund Date: Fri Feb 4 19:06:39 2011 New Revision: 124918 URL: http://llvm.org/viewvc/llvm-project?rev=124918&view=rev Log: Be more strict about the first/last interference-free use. If the interference overlaps the instruction, we cannot separate it. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=124918&r1=124917&r2=124918&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Feb 4 19:06:39 2011 @@ -716,6 +716,15 @@ // Block has interference. DEBUG(dbgs() << ", interference to " << IP.second); + + if (!BI.LiveThrough && IP.second <= BI.Def) { + // The interference doesn't reach the outgoing segment. + DEBUG(dbgs() << " doesn't affect def from " << BI.Def << '\n'); + SE.useIntv(BI.Def, Stop); + continue; + } + + if (!BI.Uses) { // No uses in block, avoid interference by reloading as late as possible. DEBUG(dbgs() << ", no uses.\n"); @@ -723,11 +732,14 @@ assert(SegStart >= IP.second && "Couldn't avoid interference"); continue; } - if (IP.second < BI.LastUse && IP.second <= BI.LastSplitPoint) { + + if (IP.second.getBoundaryIndex() < BI.LastUse && + IP.second.getBoundaryIndex() <= BI.LastSplitPoint) { // There are interference-free uses at the end of the block. // Find the first use that can get the live-out register. SmallVectorImpl::const_iterator UI = - std::lower_bound(SA->UseSlots.begin(), SA->UseSlots.end(), IP.second); + std::lower_bound(SA->UseSlots.begin(), SA->UseSlots.end(), + IP.second.getBoundaryIndex()); assert(UI != SA->UseSlots.end() && "Couldn't find last use"); SlotIndex Use = *UI; DEBUG(dbgs() << ", free use at " << Use << ".\n"); @@ -798,6 +810,14 @@ // Block has interference. DEBUG(dbgs() << ", interference from " << IP.first); + + if (!BI.LiveThrough && IP.first >= BI.Kill) { + // The interference doesn't reach the outgoing segment. + DEBUG(dbgs() << " doesn't affect kill at " << BI.Kill << '\n'); + SE.useIntv(Start, BI.Kill); + continue; + } + if (!BI.Uses) { // No uses in block, avoid interference by spilling as soon as possible. DEBUG(dbgs() << ", no uses.\n"); @@ -805,11 +825,12 @@ assert(SegEnd <= IP.first && "Couldn't avoid interference"); continue; } - if (IP.first > BI.FirstUse) { + if (IP.first.getBaseIndex() > BI.FirstUse) { // There are interference-free uses at the beginning of the block. // Find the last use that can get the register. SmallVectorImpl::const_iterator UI = - std::lower_bound(SA->UseSlots.begin(), SA->UseSlots.end(), IP.first); + std::lower_bound(SA->UseSlots.begin(), SA->UseSlots.end(), + IP.first.getBaseIndex()); assert(UI != SA->UseSlots.begin() && "Couldn't find first use"); SlotIndex Use = (--UI)->getBoundaryIndex(); DEBUG(dbgs() << ", free use at " << *UI << ".\n"); From aggarwa4 at illinois.edu Fri Feb 4 19:08:33 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 01:08:33 -0000 Subject: [llvm-commits] [poolalloc] r124919 - in /poolalloc/trunk/lib/AssistDS: FuncSpec.cpp IndCloner.cpp Message-ID: <20110205010833.5E7032A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 4 19:08:33 2011 New Revision: 124919 URL: http://llvm.org/viewvc/llvm-project?rev=124919&view=rev Log: Clean up some of the helper functions. Modified: poolalloc/trunk/lib/AssistDS/FuncSpec.cpp poolalloc/trunk/lib/AssistDS/IndCloner.cpp Modified: poolalloc/trunk/lib/AssistDS/FuncSpec.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/FuncSpec.cpp?rev=124919&r1=124918&r2=124919&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/FuncSpec.cpp (original) +++ poolalloc/trunk/lib/AssistDS/FuncSpec.cpp Fri Feb 4 19:08:33 2011 @@ -6,7 +6,11 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// - +// +// This pass clones functions that take constant function pointers as arguments +// from some call sites. It changes those call sites to call cloned functions. +// +//===----------------------------------------------------------------------===// #define DEBUG_TYPE "funcspec" #include "llvm/Instructions.h" @@ -15,6 +19,7 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" #include #include @@ -22,7 +27,7 @@ using namespace llvm; -STATISTIC(numCloned, "Number of Functions Cloned"); +STATISTIC(numCloned, "Number of Functions Cloned in FuncSpec"); STATISTIC(numReplaced, "Number of Calls Replaced"); namespace { @@ -42,26 +47,28 @@ if (const PointerType* Ty = dyn_cast(ii->getType())) { if (isa(Ty->getElementType())) { FPArgs.push_back(ii->getArgNo()); - errs() << "Eligable: " << I->getNameStr() << "\n"; + DEBUG(errs() << "Eligible: " << I->getNameStr() << "\n"); } } else if (isa(ii->getType())) { FPArgs.push_back(ii->getArgNo()); - errs() << "Eligable: " << I->getNameStr() << "\n"; - } + DEBUG(errs() << "Eligible: " << I->getNameStr() << "\n"); + } for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); - ui != ue; ++ui) + ui != ue; ++ui) { if (CallInst* CI = dyn_cast(ui)) { - std::vector > Consts; - for (unsigned x = 0; x < FPArgs.size(); ++x) - if (Constant* C = dyn_cast(ui->getOperand(x + 1))) { - Consts.push_back(std::make_pair(x, C)); - CI->dump(); + if(CI->getCalledValue()->stripPointerCasts() == I) { + std::vector > Consts; + for (unsigned x = 0; x < FPArgs.size(); ++x) + if (Constant* C = dyn_cast(ui->getOperand(FPArgs.at(x) + 1))) { + Consts.push_back(std::make_pair(FPArgs.at(x), C)); + } + if (!Consts.empty()) { + cloneSites[CI] = Consts; + toClone[std::make_pair(I, Consts)] = 0; } - if (!Consts.empty()) { - cloneSites[CI] = Consts; - toClone[std::make_pair(I, Consts)] = 0; } } + } } numCloned += toClone.size(); @@ -86,4 +93,4 @@ char FuncSpec::ID = 0; static RegisterPass -X("funcspec", "Specialize for Funnction Pointers"); +X("funcspec", "Specialize for Function Pointers"); Modified: poolalloc/trunk/lib/AssistDS/IndCloner.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/IndCloner.cpp?rev=124919&r1=124918&r2=124919&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/IndCloner.cpp (original) +++ poolalloc/trunk/lib/AssistDS/IndCloner.cpp Fri Feb 4 19:08:33 2011 @@ -31,7 +31,7 @@ X("indclone", "Indirect call cloning"); // Pass statistics -STATISTIC(numCloned, "Number of Functions Cloned"); +STATISTIC(numCloned, "Number of Functions Cloned in IndCloner"); STATISTIC(numReplaced, "Number of Calls Replaced"); // From daniel at zuster.org Fri Feb 4 19:13:47 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 05 Feb 2011 01:13:47 -0000 Subject: [llvm-commits] [test-suite] r124921 - in /test-suite/trunk/MultiSource/Benchmarks: ASCI_Purple/SMG2000/Makefile Fhourstones-3.1/Makefile Fhourstones/Makefile McCat/04-bisect/Makefile McCat/09-vor/Makefile McCat/17-bintr/Makefile Ptrdist/anagram/Makefile Ptrdist/bc/Makefile Message-ID: <20110205011347.6E72F2A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 4 19:13:47 2011 New Revision: 124921 URL: http://llvm.org/viewvc/llvm-project?rev=124921&view=rev Log: test-suite: Eliminate some spurious references to LLVM_OBJ_ROOT. Modified: test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/Makefile test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Makefile test-suite/trunk/MultiSource/Benchmarks/Fhourstones/Makefile test-suite/trunk/MultiSource/Benchmarks/McCat/04-bisect/Makefile test-suite/trunk/MultiSource/Benchmarks/McCat/09-vor/Makefile test-suite/trunk/MultiSource/Benchmarks/McCat/17-bintr/Makefile test-suite/trunk/MultiSource/Benchmarks/Ptrdist/anagram/Makefile test-suite/trunk/MultiSource/Benchmarks/Ptrdist/bc/Makefile Modified: test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/Makefile Fri Feb 4 19:13:47 2011 @@ -8,8 +8,6 @@ LIBS += -lm LDFLAGS += -lm -#include $(LLVM_OBJ_ROOT)/Makefile.config - ifdef SMALL_PROBLEM_SIZE RUN_OPTIONS ="-n 30 15 30 -c 0.1 1.0 10.0" else Modified: test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Makefile Fri Feb 4 19:13:47 2011 @@ -4,8 +4,6 @@ #CPPFLAGS = -DUNIX # -DTRANSIZE=1050011 -DPROBES=8 -DREPORTPLY=8 -#include $(LLVM_OBJ_ROOT)/Makefile.config - # Specify which file provides the contents of stdin for the test run ifdef LARGE_PROBLEM_SIZE STDIN_FILENAME = $(PROJ_SRC_DIR)/inputs_large Modified: test-suite/trunk/MultiSource/Benchmarks/Fhourstones/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Fhourstones/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Fhourstones/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/Fhourstones/Makefile Fri Feb 4 19:13:47 2011 @@ -3,8 +3,6 @@ PROG = fhourstones CPPFLAGS = -DUNIX -DTRANSIZE=1050011 -DPROBES=8 -DREPORTPLY=8 -#include $(LLVM_OBJ_ROOT)/Makefile.config - # Specify which file provides the contents of stdin for the test run STDIN_FILENAME = $(PROJ_SRC_DIR)/input Modified: test-suite/trunk/MultiSource/Benchmarks/McCat/04-bisect/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/McCat/04-bisect/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/McCat/04-bisect/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/McCat/04-bisect/Makefile Fri Feb 4 19:13:47 2011 @@ -5,8 +5,6 @@ FP_TOLERANCE := 0.001 -#include $(LLVM_OBJ_ROOT)/Makefile.config - STDIN_FILENAME = $(PROJ_SRC_DIR)/bisect_test.in include $(LEVEL)/MultiSource/Makefile.multisrc Modified: test-suite/trunk/MultiSource/Benchmarks/McCat/09-vor/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/McCat/09-vor/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/McCat/09-vor/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/McCat/09-vor/Makefile Fri Feb 4 19:13:47 2011 @@ -1,7 +1,5 @@ LEVEL = ../../../.. -#include $(LLVM_OBJ_ROOT)/Makefile.config - PROG = vor STDIN_FILENAME = $(PROJ_SRC_DIR)/vor.in3 LDFLAGS = -lm Modified: test-suite/trunk/MultiSource/Benchmarks/McCat/17-bintr/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/McCat/17-bintr/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/McCat/17-bintr/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/McCat/17-bintr/Makefile Fri Feb 4 19:13:47 2011 @@ -1,7 +1,5 @@ LEVEL = ../../../.. -#include $(LLVM_OBJ_ROOT)/Makefile.config - PROG = bintr LDFLAGS = -lm #RUN_OPTIONS += Modified: test-suite/trunk/MultiSource/Benchmarks/Ptrdist/anagram/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Ptrdist/anagram/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Ptrdist/anagram/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/Ptrdist/anagram/Makefile Fri Feb 4 19:13:47 2011 @@ -1,7 +1,5 @@ LEVEL=../../../.. -#include $(LLVM_OBJ_ROOT)/Makefile.config - PROG = anagram #OBJS = anagram.o RUN_OPTIONS = $(PROJ_SRC_DIR)/words 2 Modified: test-suite/trunk/MultiSource/Benchmarks/Ptrdist/bc/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Ptrdist/bc/Makefile?rev=124921&r1=124920&r2=124921&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Ptrdist/bc/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/Ptrdist/bc/Makefile Fri Feb 4 19:13:47 2011 @@ -1,7 +1,5 @@ LEVEL = ../../../.. -#include $(LLVM_OBJ_ROOT)/Makefile.config - PROG = bc OBJS = scan.o util.o main.o number.o storage.o load.o execute.o bc.o global.o STDIN_FILENAME = $(PROJ_SRC_DIR)/primes.b From daniel at zuster.org Fri Feb 4 19:13:55 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 05 Feb 2011 01:13:55 -0000 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules Message-ID: <20110205011355.AE9032A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 4 19:13:55 2011 New Revision: 124922 URL: http://llvm.org/viewvc/llvm-project?rev=124922&view=rev Log: test-suite: Start sketching support for using LLVM's test-suite w/o an LLVM source or object tree. Modified: test-suite/trunk/Makefile.config.in test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.config.in?rev=124922&r1=124921&r2=124922&view=diff ============================================================================== --- test-suite/trunk/Makefile.config.in (original) +++ test-suite/trunk/Makefile.config.in Fri Feb 4 19:13:55 2011 @@ -11,6 +11,18 @@ # LLVM_OBJ_ROOT = @LLVM_OBJ@ +# Set this variable based on whether or not we have access to LLVM source and +# object trees. +ifeq ($(LLVM_SRC_ROOT),no) +HAS_LLVM := 0 +else +ifeq ($(LLVM_OBJ_ROOT),no) +HAS_LLVM := 0 +else +HAS_LLVM := 1 +endif +endif + # Set the directory root of this project's source files PROJ_SRC_ROOT := $(subst //,/, at abs_top_srcdir@) @@ -20,8 +32,31 @@ # Set the root directory of this project's install prefix PROJ_INSTALL_ROOT := @prefix@ -# Include LLVM's configuration Makefile. +# Include LLVM's configuration Makefile, if available. +ifeq ($(HAS_LLVM),1) include $(LLVM_OBJ_ROOT)/Makefile.config +else + +# Otherwise, define specific things we know we need. +realpath = $(shell cd $(1); $(PWD)) +PROJ_OBJ_DIR := $(call realpath, .) +PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL)) +PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) + +CP := cp +DATE := date +DOT := dot +ECHO := echo +INSTALL := install +LIBS := +MKDIR := mkdir +MV := mv +PWD := pwd +RM := rm +SED := sed +TCLSH := tclsh + +endif # Ignore the LIBS set by $(LLVM_OBJ_ROOT)/Makefile.config LIBS := Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=124922&r1=124921&r2=124922&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Fri Feb 4 19:13:55 2011 @@ -66,7 +66,9 @@ ########################################################################### # Ensure people re-run configure when it gets updated +ifeq ($(HAS_LLVM),1) all::$(LLVM_OBJ_ROOT)/config.status +endif ifdef SHARED_LIBRARY # if SHARED_LIBRARY is specified, the default is to build the dynamic lib @@ -342,9 +344,11 @@ # LEVEL/include : config.h files for the project # LLVM_SRC_ROOT/include : Files global to LLVM. # -CPPFLAGS += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) -I$(LLVM_OBJ_ROOT)/include \ - -I$(PROJ_SRC_ROOT)/include -I$(LEVEL)/include \ - -I$(LLVM_SRC_ROOT)/include +CPPFLAGS += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ + -I$(PROJ_SRC_ROOT)/include -I$(LEVEL)/include +ifeq ($(HAS_LLVM),1) +CPPFLAGS += -I$(LLVM_OBJ_ROOT)/include -I$(LLVM_SRC_ROOT)/include +endif # By default, strip symbol information from executable ifndef KEEP_SYMBOLS @@ -977,12 +981,14 @@ # # Autoconf Dependencies. # +ifeq ($(HAS_LLVM),1) $(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure @${ECHO} "****************************************************************" @${ECHO} " You need to re-run $(LLVM_SRC_ROOT)/configure" @${ECHO} " in directory $(LLVM_OBJ_ROOT)" @${ECHO} "****************************************************************" $(VERB) exit 1 +endif # If the Makefile in the source tree has been updated, copy it over into the # build tree. From daniel at zuster.org Fri Feb 4 19:13:57 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 05 Feb 2011 01:13:57 -0000 Subject: [llvm-commits] [test-suite] r124923 - in /test-suite/trunk: Makefile.programs Makefile.rules Message-ID: <20110205011357.CC6E82A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 4 19:13:57 2011 New Revision: 124923 URL: http://llvm.org/viewvc/llvm-project?rev=124923&view=rev Log: test-suite: Allow fpcmp tool path to be specified. Modified: test-suite/trunk/Makefile.programs test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=124923&r1=124922&r2=124923&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Fri Feb 4 19:13:57 2011 @@ -69,7 +69,7 @@ # loop on some inputs, which blocks testing some historical revisions. We can # remove this once we build our own test tools. DIFFPROG := $(PROGDIR)/RunToolSafely.sh 60 \ - $(PROGDIR)/DiffOutput.sh "\"$(LLVMTOOLCURRENT)/fpcmp $(TOLERANCEOPT)\"" + $(PROGDIR)/DiffOutput.sh "\"$(FPCMP) $(TOLERANCEOPT)\"" # RUNTIMELIMIT - The number of seconds we should wait before certain events # timeout. This is overridable on the commandline or in tests makefiles. Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=124923&r1=124922&r2=124923&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Fri Feb 4 19:13:57 2011 @@ -317,6 +317,7 @@ LPROF = $(LLVMTOOLCURRENT)/llvm-prof$(EXEEXT) LBUGPOINT = $(LLVMTOOLCURRENT)/bugpoint$(EXEEXT) LFINDMISOPT= $(LLVM_SRC_ROOT)/utils/findmisopt +FPCMP = $(LLVMTOOLCURRENT)/fpcmp LCC := $(LLVMCC) LCXX := $(LLVMCXX) From dpatel at apple.com Fri Feb 4 19:27:09 2011 From: dpatel at apple.com (Devang Patel) Date: Fri, 4 Feb 2011 17:27:09 -0800 Subject: [llvm-commits] [llvm] r124904 - in /llvm/trunk: include/llvm/CodeGen/MachineLocation.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/CodeGen/X86/dbg-merge-loc-entry.ll In-Reply-To: <96BB600C-3DCE-42EF-BCEB-7FA471E3C720@apple.com> References: <20110204225719.099202A6C12C@llvm.org> <96BB600C-3DCE-42EF-BCEB-7FA471E3C720@apple.com> Message-ID: <6930C6B1-1913-4E1B-B6E9-5FAB0FC96774@apple.com> On Feb 4, 2011, at 4:59 PM, Jim Grosbach wrote: > Nice. I'm curious. How much size reduction does this tend to produce? I'd expect a fair bit. Yes, in some cases I have seen 3x size reduction in .debug_loc. Recently we enabled LiveDebugVariable analysis phase in code gen which allows register allocator and friends to accurately track range of debug values. This improvement contributed to size increase in debug_loc. - Devang > > > On Feb 4, 2011, at 2:57 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Fri Feb 4 16:57:18 2011 >> New Revision: 124904 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=124904&view=rev >> Log: >> Merge .debug_loc entries whenever possible to reduce debug_loc size. >> >> Added: >> llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll >> Modified: >> llvm/trunk/include/llvm/CodeGen/MachineLocation.h >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineLocation.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLocation.h?rev=124904&r1=124903&r2=124904&view=diff >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineLocation.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineLocation.h Fri Feb 4 16:57:18 2011 >> @@ -41,6 +41,11 @@ >> : IsRegister(true), Register(R), Offset(0) {} >> MachineLocation(unsigned R, int O) >> : IsRegister(false), Register(R), Offset(O) {} >> + >> + bool operator==(const MachineLocation &Other) const { >> + return IsRegister == Other.IsRegister && Register == Other.Register && >> + Offset == Other.Offset; >> + } >> >> // Accessors >> bool isReg() const { return IsRegister; } >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=124904&r1=124903&r2=124904&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Feb 4 16:57:18 2011 >> @@ -3580,6 +3580,14 @@ >> if (DotDebugLocEntries.empty()) >> return; >> >> + for (SmallVector::iterator >> + I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); >> + I != E; ++I) { >> + DotDebugLocEntry &Entry = *I; >> + if (I + 1 != DotDebugLocEntries.end()) >> + Entry.Merge(I+1); >> + } >> + >> // Start the dwarf loc section. >> Asm->OutStreamer.SwitchSection( >> Asm->getObjFileLowering().getDwarfLocSection()); >> @@ -3589,7 +3597,8 @@ >> for (SmallVector::iterator >> I = DotDebugLocEntries.begin(), E = DotDebugLocEntries.end(); >> I != E; ++I, ++index) { >> - DotDebugLocEntry Entry = *I; >> + DotDebugLocEntry &Entry = *I; >> + if (Entry.isMerged()) continue; >> if (Entry.isEmpty()) { >> Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); >> Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0); >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=124904&r1=124903&r2=124904&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Feb 4 16:57:18 2011 >> @@ -74,6 +74,28 @@ >> MCSymbol *getLabel() const { return Label; } >> }; >> >> +/// DotDebugLocEntry - This struct describes location entries emitted in >> +/// .debug_loc section. >> +typedef struct DotDebugLocEntry { >> + const MCSymbol *Begin; >> + const MCSymbol *End; >> + MachineLocation Loc; >> + bool Merged; >> + DotDebugLocEntry() : Begin(0), End(0), Merged(false) {} >> + DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L) >> + : Begin(B), End(E), Loc(L), Merged(false) {} >> + /// Empty entries are also used as a trigger to emit temp label. Such >> + /// labels are referenced is used to find debug_loc offset for a given DIE. >> + bool isEmpty() { return Begin == 0 && End == 0; } >> + bool isMerged() { return Merged; } >> + void Merge(DotDebugLocEntry *Next) { >> + if (!(Begin && Loc == Next->Loc && End == Next->Begin)) >> + return; >> + Next->Begin = Begin; >> + Merged = true; >> + } >> +} DotDebugLocEntry; >> + >> class DwarfDebug { >> /// Asm - Target of Dwarf emission. >> AsmPrinter *Asm; >> @@ -153,20 +175,6 @@ >> /// machine instruction. >> DenseMap DbgVariableToDbgInstMap; >> >> - /// DotDebugLocEntry - This struct describes location entries emitted in >> - /// .debug_loc section. >> - typedef struct DotDebugLocEntry { >> - const MCSymbol *Begin; >> - const MCSymbol *End; >> - MachineLocation Loc; >> - DotDebugLocEntry() : Begin(0), End(0) {} >> - DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, >> - MachineLocation &L) : Begin(B), End(E), Loc(L) {} >> - /// Empty entries are also used as a trigger to emit temp label. Such >> - /// labels are referenced is used to find debug_loc offset for a given DIE. >> - bool isEmpty() { return Begin == 0 && End == 0; } >> - } DotDebugLocEntry; >> - >> /// DotDebugLocEntries - Collection of DotDebugLocEntry. >> SmallVector DotDebugLocEntries; >> >> >> Added: llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll?rev=124904&view=auto >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll (added) >> +++ llvm/trunk/test/CodeGen/X86/dbg-merge-loc-entry.ll Fri Feb 4 16:57:18 2011 >> @@ -0,0 +1,827 @@ >> +; RUN: llc < %s | FileCheck %s >> +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" >> +target triple = "x86_64-apple-darwin8" >> + >> +;CHECK: Ldebug_loc2: >> +;CHECK-NEXT: .quad Ltmp11 >> +;CHECK-NEXT: .quad Lfunc_end0 >> +;CHECK-NEXT: .short 1 ## Loc expr size >> +;CHECK-NEXT: .byte 85 ## DW_OP_reg5 >> +;CHECK-NEXT: .quad 0 >> +;CHECK-NEXT: .quad 0 >> + >> + >> +%0 = type { i64, i1 } >> + >> + at __clz_tab = external unnamed_addr constant [256 x i8] >> + >> +define hidden i128 @__divti3(i128 %u, i128 %v) nounwind readnone { >> +entry: >> + tail call void @llvm.dbg.value(metadata !{i128 %u}, i64 0, metadata !103), !dbg !111 >> + tail call void @llvm.dbg.value(metadata !{i128 %v}, i64 0, metadata !104), !dbg !111 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !108), !dbg !112 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !109), !dbg !113 >> + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !105), !dbg !115 >> + %0 = trunc i128 %u to i64 >> + %sroa.store.elt15 = lshr i128 %u, 64 >> + %1 = trunc i128 %sroa.store.elt15 to i64 >> + %2 = trunc i128 %v to i64 >> + %sroa.store.elt = lshr i128 %v, 64 >> + %3 = trunc i128 %sroa.store.elt to i64 >> + %4 = icmp slt i64 %1, 0, !dbg !116 >> + br i1 %4, label %bb, label %bb1, !dbg !116 >> + >> +bb: ; preds = %entry >> + tail call void @llvm.dbg.value(metadata !117, i64 0, metadata !105), !dbg !118 >> + %5 = sub nsw i128 0, %u, !dbg !118 >> + %6 = trunc i128 %5 to i64 >> + %sroa.store.elt18 = lshr i128 %5, 64 >> + %7 = trunc i128 %sroa.store.elt18 to i64 >> + br label %bb1, !dbg !118 >> + >> +bb1: ; preds = %bb, %entry >> + %uu.0.1.0 = phi i64 [ %7, %bb ], [ %1, %entry ] >> + %uu.0.0.0 = phi i64 [ %6, %bb ], [ %0, %entry ] >> + %c.0 = phi i64 [ -1, %bb ], [ 0, %entry ] >> + %8 = icmp slt i64 %3, 0, !dbg !119 >> + br i1 %8, label %bb2, label %bb4, !dbg !119 >> + >> +bb2: ; preds = %bb1 >> + %not3 = xor i64 %c.0, -1, !dbg !120 >> + tail call void @llvm.dbg.value(metadata !{i64 %not3}, i64 0, metadata !105), !dbg !120 >> + %9 = sub nsw i128 0, %v, !dbg !120 >> + %10 = trunc i128 %9 to i64 >> + %sroa.store.elt11 = lshr i128 %9, 64 >> + %11 = trunc i128 %sroa.store.elt11 to i64 >> + br label %bb4, !dbg !120 >> + >> +bb4: ; preds = %bb2, %bb1 >> + %vv.0.1.0 = phi i64 [ %11, %bb2 ], [ %3, %bb1 ] >> + %vv.0.0.0 = phi i64 [ %10, %bb2 ], [ %2, %bb1 ] >> + %c.1 = phi i64 [ %not3, %bb2 ], [ %c.0, %bb1 ] >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !14) nounwind, !dbg !121 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !15) nounwind, !dbg !121 >> + tail call void @llvm.dbg.value(metadata !123, i64 0, metadata !16) nounwind, !dbg !121 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !17) nounwind, !dbg !124 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !30) nounwind, !dbg !125 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !31) nounwind, !dbg !126 >> + tail call void @llvm.dbg.declare(metadata !{null}, metadata !43) nounwind, !dbg !127 >> + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.0.0}, i64 0, metadata !32) nounwind, !dbg !128 >> + tail call void @llvm.dbg.value(metadata !{i64 %vv.0.1.0}, i64 0, metadata !35) nounwind, !dbg !129 >> + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.0.0}, i64 0, metadata !36) nounwind, !dbg !130 >> + tail call void @llvm.dbg.value(metadata !{i64 %uu.0.1.0}, i64 0, metadata !37) nounwind, !dbg !131 >> + %12 = icmp eq i64 %vv.0.1.0, 0, !dbg !132 >> + br i1 %12, label %bb.i, label %bb73.i, !dbg !132 >> + >> +bb.i: ; preds = %bb4 >> + %13 = icmp ugt i64 %vv.0.0.0, %uu.0.1.0, !dbg !133 >> + br i1 %13, label %bb4.i, label %bb21.i, !dbg !133 >> + >> +bb2.i: ; preds = %bb4.i >> + %tmp154.i = shl i64 255, %.cast.i >> + %14 = and i64 %tmp154.i, %vv.0.0.0 >> + %15 = icmp eq i64 %14, 0, !dbg !134 >> + br i1 %15, label %bb3.i, label %bb5.i, !dbg !134 >> + >> +bb3.i: ; preds = %bb2.i >> + %indvar.next20.i = add i64 %indvar19.i, 1 >> + br label %bb4.i, !dbg !134 >> + >> +bb4.i: ; preds = %bb.i, %bb3.i >> + %indvar19.i = phi i64 [ %indvar.next20.i, %bb3.i ], [ 0, %bb.i ] >> + %tmp24 = mul i64 %indvar19.i, -8 >> + %.cast.i = add i64 %tmp24, 56 >> + %16 = icmp eq i64 %.cast.i, 0, !dbg !134 >> + br i1 %16, label %bb5.i, label %bb2.i, !dbg !134 >> + >> +bb5.i: ; preds = %bb4.i, %bb2.i >> + %.cast6.i = and i64 %.cast.i, 4294967288 >> + %17 = lshr i64 %vv.0.0.0, %.cast6.i, !dbg !134 >> + %18 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %17, !dbg !134 >> + %19 = load i8* %18, align 1, !dbg !134 >> + %20 = zext i8 %19 to i64, !dbg !134 >> + %21 = add i64 %20, %.cast.i, !dbg !134 >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !134 >> + %22 = icmp eq i64 %21, 64 >> + br i1 %22, label %bb12.i, label %bb7.i, !dbg !136 >> + >> +bb7.i: ; preds = %bb5.i >> + %23 = sub i64 64, %21, !dbg !134 >> + %.cast8.i = and i64 %23, 4294967295 >> + %24 = shl i64 %vv.0.0.0, %.cast8.i, !dbg !137 >> + tail call void @llvm.dbg.value(metadata !{i64 %24}, i64 0, metadata !32) nounwind, !dbg !137 >> + %25 = shl i64 %uu.0.1.0, %.cast8.i, !dbg !138 >> + %.cast10.i = and i64 %21, 4294967295 >> + %26 = lshr i64 %uu.0.0.0, %.cast10.i, !dbg !138 >> + %27 = or i64 %25, %26, !dbg !138 >> + tail call void @llvm.dbg.value(metadata !{i64 %27}, i64 0, metadata !37) nounwind, !dbg !138 >> + %28 = shl i64 %uu.0.0.0, %.cast8.i, !dbg !139 >> + tail call void @llvm.dbg.value(metadata !{i64 %28}, i64 0, metadata !36) nounwind, !dbg !139 >> + br label %bb12.i, !dbg !139 >> + >> +bb12.i: ; preds = %bb7.i, %bb5.i >> + %n1.0.i = phi i64 [ %27, %bb7.i ], [ %uu.0.1.0, %bb5.i ] >> + %n0.0.i = phi i64 [ %28, %bb7.i ], [ %uu.0.0.0, %bb5.i ] >> + %d0.0.i = phi i64 [ %24, %bb7.i ], [ %vv.0.0.0, %bb5.i ] >> + %29 = lshr i64 %d0.0.i, 32, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %29}, i64 0, metadata !47) nounwind, !dbg !140 >> + %30 = and i64 %d0.0.i, 4294967295, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %30}, i64 0, metadata !49) nounwind, !dbg !140 >> + %31 = urem i64 %n1.0.i, %29, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %31}, i64 0, metadata !52) nounwind, !dbg !140 >> + %32 = udiv i64 %n1.0.i, %29, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %32}, i64 0, metadata !50) nounwind, !dbg !140 >> + %33 = mul i64 %32, %30, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %33}, i64 0, metadata !54) nounwind, !dbg !140 >> + %34 = shl i64 %31, 32 >> + %35 = lshr i64 %n0.0.i, 32, !dbg !140 >> + %36 = or i64 %34, %35, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %36}, i64 0, metadata !52) nounwind, !dbg !140 >> + %37 = icmp ult i64 %36, %33, !dbg !140 >> + br i1 %37, label %bb13.i, label %bb16.i, !dbg !140 >> + >> +bb13.i: ; preds = %bb12.i >> + %38 = add i64 %32, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %38}, i64 0, metadata !50) nounwind, !dbg !140 >> + %uadd153.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %36, i64 %d0.0.i) nounwind >> + %39 = extractvalue %0 %uadd153.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %39}, i64 0, metadata !52) nounwind, !dbg !140 >> + %40 = extractvalue %0 %uadd153.i, 1 >> + %.not.i = xor i1 %40, true >> + %41 = icmp ult i64 %39, %33, !dbg !140 >> + %or.cond.i = and i1 %41, %.not.i >> + br i1 %or.cond.i, label %bb15.i, label %bb16.i, !dbg !140 >> + >> +bb15.i: ; preds = %bb13.i >> + %42 = add i64 %32, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %42}, i64 0, metadata !50) nounwind, !dbg !140 >> + %43 = add i64 %39, %d0.0.i, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %43}, i64 0, metadata !52) nounwind, !dbg !140 >> + br label %bb16.i, !dbg !140 >> + >> +bb16.i: ; preds = %bb15.i, %bb13.i, %bb12.i >> + %__r1.0.i = phi i64 [ %43, %bb15.i ], [ %39, %bb13.i ], [ %36, %bb12.i ] >> + %__q1.0.i = phi i64 [ %42, %bb15.i ], [ %38, %bb13.i ], [ %32, %bb12.i ] >> + %44 = sub i64 %__r1.0.i, %33, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %44}, i64 0, metadata !52) nounwind, !dbg !140 >> + %45 = urem i64 %44, %29, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %45}, i64 0, metadata !53) nounwind, !dbg !140 >> + %46 = udiv i64 %44, %29, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %46}, i64 0, metadata !51) nounwind, !dbg !140 >> + %47 = mul i64 %46, %30, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %47}, i64 0, metadata !54) nounwind, !dbg !140 >> + %48 = shl i64 %45, 32 >> + %49 = and i64 %n0.0.i, 4294967295, !dbg !140 >> + %50 = or i64 %48, %49, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %50}, i64 0, metadata !53) nounwind, !dbg !140 >> + %51 = icmp ult i64 %50, %47, !dbg !140 >> + br i1 %51, label %bb17.i, label %bb20.i, !dbg !140 >> + >> +bb17.i: ; preds = %bb16.i >> + %52 = add i64 %46, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %52}, i64 0, metadata !51) nounwind, !dbg !140 >> + %uadd152.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %50, i64 %d0.0.i) nounwind >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !53) nounwind, !dbg !140 >> + %53 = extractvalue %0 %uadd152.i, 1 >> + br i1 %53, label %bb20.i, label %bb18.i, !dbg !140 >> + >> +bb18.i: ; preds = %bb17.i >> + %54 = extractvalue %0 %uadd152.i, 0 >> + %55 = add i64 %46, -2 >> + %56 = icmp ult i64 %54, %47, !dbg !140 >> + %..i = select i1 %56, i64 %55, i64 %52 >> + br label %bb20.i >> + >> +bb20.i: ; preds = %bb18.i, %bb17.i, %bb16.i >> + %__q0.0.i = phi i64 [ %52, %bb17.i ], [ %46, %bb16.i ], [ %..i, %bb18.i ] >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !53) nounwind, !dbg !140 >> + %57 = shl i64 %__q1.0.i, 32 >> + %58 = or i64 %__q0.0.i, %57, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{i64 %58}, i64 0, metadata !39) nounwind, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !140 >> + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !141 >> + br label %__udivmodti4.exit, !dbg !141 >> + >> +bb21.i: ; preds = %bb.i >> + %59 = icmp eq i64 %vv.0.0.0, 0, !dbg !142 >> + br i1 %59, label %bb22.i, label %bb23.i, !dbg !142 >> + >> +bb22.i: ; preds = %bb21.i >> + %60 = udiv i64 1, %vv.0.0.0, !dbg !143 >> + tail call void @llvm.dbg.value(metadata !{i64 %60}, i64 0, metadata !32) nounwind, !dbg !143 >> + br label %bb23.i, !dbg !143 >> + >> +bb23.i: ; preds = %bb22.i, %bb21.i >> + %d0.1.i = phi i64 [ %60, %bb22.i ], [ %vv.0.0.0, %bb21.i ] >> + tail call void @llvm.dbg.value(metadata !{i64 %d0.1.i}, i64 0, metadata !55) nounwind, !dbg !144 >> + tail call void @llvm.dbg.value(metadata !145, i64 0, metadata !57) nounwind, !dbg !144 >> + br label %bb29.i, !dbg !144 >> + >> +bb26.i: ; preds = %bb29.i >> + %tmp151.i = shl i64 255, %.cast27.i >> + %61 = and i64 %tmp151.i, %d0.1.i >> + %62 = icmp eq i64 %61, 0, !dbg !144 >> + br i1 %62, label %bb28.i, label %bb30.i, !dbg !144 >> + >> +bb28.i: ; preds = %bb26.i >> + %indvar.next16.i = add i64 %indvar15.i, 1 >> + br label %bb29.i, !dbg !144 >> + >> +bb29.i: ; preds = %bb28.i, %bb23.i >> + %indvar15.i = phi i64 [ %indvar.next16.i, %bb28.i ], [ 0, %bb23.i ] >> + %tmp22 = mul i64 %indvar15.i, -8 >> + %.cast27.i = add i64 %tmp22, 56 >> + %63 = icmp eq i64 %.cast27.i, 0, !dbg !144 >> + br i1 %63, label %bb30.i, label %bb26.i, !dbg !144 >> + >> +bb30.i: ; preds = %bb29.i, %bb26.i >> + %.cast31.i = and i64 %.cast27.i, 4294967288 >> + %64 = lshr i64 %d0.1.i, %.cast31.i, !dbg !144 >> + %65 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %64, !dbg !144 >> + %66 = load i8* %65, align 1, !dbg !144 >> + %67 = zext i8 %66 to i64, !dbg !144 >> + %68 = add i64 %67, %.cast27.i, !dbg !144 >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !144 >> + %69 = icmp eq i64 %68, 64 >> + br i1 %69, label %bb32.i, label %bb33.i, !dbg !146 >> + >> +bb32.i: ; preds = %bb30.i >> + %70 = sub i64 %uu.0.1.0, %d0.1.i, !dbg !147 >> + tail call void @llvm.dbg.value(metadata !{i64 %70}, i64 0, metadata !37) nounwind, !dbg !147 >> + tail call void @llvm.dbg.value(metadata !148, i64 0, metadata !40) nounwind, !dbg !149 >> + br label %bb54.i, !dbg !149 >> + >> +bb33.i: ; preds = %bb30.i >> + %71 = sub i64 64, %68, !dbg !144 >> + tail call void @llvm.dbg.value(metadata !{i64 %68}, i64 0, metadata !41) nounwind, !dbg !150 >> + %.cast34.i = and i64 %71, 4294967295 >> + %72 = shl i64 %d0.1.i, %.cast34.i, !dbg !151 >> + tail call void @llvm.dbg.value(metadata !{i64 %72}, i64 0, metadata !32) nounwind, !dbg !151 >> + %.cast35.i = and i64 %68, 4294967295 >> + %73 = lshr i64 %uu.0.1.0, %.cast35.i, !dbg !152 >> + tail call void @llvm.dbg.value(metadata !{i64 %73}, i64 0, metadata !38) nounwind, !dbg !152 >> + %74 = shl i64 %uu.0.1.0, %.cast34.i, !dbg !153 >> + %75 = lshr i64 %uu.0.0.0, %.cast35.i, !dbg !153 >> + %76 = or i64 %74, %75, !dbg !153 >> + tail call void @llvm.dbg.value(metadata !{i64 %76}, i64 0, metadata !37) nounwind, !dbg !153 >> + %77 = shl i64 %uu.0.0.0, %.cast34.i, !dbg !154 >> + tail call void @llvm.dbg.value(metadata !{i64 %77}, i64 0, metadata !36) nounwind, !dbg !154 >> + %78 = lshr i64 %72, 32, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %78}, i64 0, metadata !58) nounwind, !dbg !155 >> + %79 = and i64 %72, 4294967295, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %79}, i64 0, metadata !60) nounwind, !dbg !155 >> + %80 = urem i64 %73, %78, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %80}, i64 0, metadata !63) nounwind, !dbg !155 >> + %81 = udiv i64 %73, %78, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %81}, i64 0, metadata !61) nounwind, !dbg !155 >> + %82 = mul i64 %81, %79, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %82}, i64 0, metadata !65) nounwind, !dbg !155 >> + %83 = shl i64 %80, 32 >> + %84 = lshr i64 %76, 32, !dbg !155 >> + %85 = or i64 %83, %84, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %85}, i64 0, metadata !63) nounwind, !dbg !155 >> + %86 = icmp ult i64 %85, %82, !dbg !155 >> + br i1 %86, label %bb46.i, label %bb49.i, !dbg !155 >> + >> +bb46.i: ; preds = %bb33.i >> + %87 = add i64 %81, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %87}, i64 0, metadata !61) nounwind, !dbg !155 >> + %uadd150.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %85, i64 %72) nounwind >> + %88 = extractvalue %0 %uadd150.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %88}, i64 0, metadata !63) nounwind, !dbg !155 >> + %89 = extractvalue %0 %uadd150.i, 1 >> + %.not1.i = xor i1 %89, true >> + %90 = icmp ult i64 %88, %82, !dbg !155 >> + %or.cond2.i = and i1 %90, %.not1.i >> + br i1 %or.cond2.i, label %bb48.i, label %bb49.i, !dbg !155 >> + >> +bb48.i: ; preds = %bb46.i >> + %91 = add i64 %81, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %91}, i64 0, metadata !61) nounwind, !dbg !155 >> + %92 = add i64 %88, %72, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %92}, i64 0, metadata !63) nounwind, !dbg !155 >> + br label %bb49.i, !dbg !155 >> + >> +bb49.i: ; preds = %bb48.i, %bb46.i, %bb33.i >> + %__q141.0.i = phi i64 [ %91, %bb48.i ], [ %87, %bb46.i ], [ %81, %bb33.i ] >> + %__r143.0.i = phi i64 [ %92, %bb48.i ], [ %88, %bb46.i ], [ %85, %bb33.i ] >> + %93 = sub i64 %__r143.0.i, %82, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %93}, i64 0, metadata !63) nounwind, !dbg !155 >> + %94 = urem i64 %93, %78, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %94}, i64 0, metadata !64) nounwind, !dbg !155 >> + %95 = udiv i64 %93, %78, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %95}, i64 0, metadata !62) nounwind, !dbg !155 >> + %96 = mul i64 %95, %79, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %96}, i64 0, metadata !65) nounwind, !dbg !155 >> + %97 = shl i64 %94, 32 >> + %98 = and i64 %76, 4294967295, !dbg !155 >> + %99 = or i64 %97, %98, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %99}, i64 0, metadata !64) nounwind, !dbg !155 >> + %100 = icmp ult i64 %99, %96, !dbg !155 >> + br i1 %100, label %bb50.i, label %bb53.i, !dbg !155 >> + >> +bb50.i: ; preds = %bb49.i >> + %101 = add i64 %95, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %101}, i64 0, metadata !62) nounwind, !dbg !155 >> + %uadd149.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %99, i64 %72) nounwind >> + %102 = extractvalue %0 %uadd149.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %102}, i64 0, metadata !64) nounwind, !dbg !155 >> + %103 = extractvalue %0 %uadd149.i, 1 >> + %.not3.i = xor i1 %103, true >> + %104 = icmp ult i64 %102, %96, !dbg !155 >> + %or.cond4.i = and i1 %104, %.not3.i >> + br i1 %or.cond4.i, label %bb52.i, label %bb53.i, !dbg !155 >> + >> +bb52.i: ; preds = %bb50.i >> + %105 = add i64 %95, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %105}, i64 0, metadata !62) nounwind, !dbg !155 >> + %106 = add i64 %102, %72, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %106}, i64 0, metadata !64) nounwind, !dbg !155 >> + br label %bb53.i, !dbg !155 >> + >> +bb53.i: ; preds = %bb52.i, %bb50.i, %bb49.i >> + %__q042.0.i = phi i64 [ %105, %bb52.i ], [ %101, %bb50.i ], [ %95, %bb49.i ] >> + %__r044.0.i = phi i64 [ %106, %bb52.i ], [ %102, %bb50.i ], [ %99, %bb49.i ] >> + %107 = sub i64 %__r044.0.i, %96, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !64) nounwind, !dbg !155 >> + %108 = shl i64 %__q141.0.i, 32 >> + %109 = or i64 %__q042.0.i, %108, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %109}, i64 0, metadata !40) nounwind, !dbg !155 >> + tail call void @llvm.dbg.value(metadata !{i64 %107}, i64 0, metadata !37) nounwind, !dbg !155 >> + br label %bb54.i, !dbg !155 >> + >> +bb54.i: ; preds = %bb53.i, %bb32.i >> + %q1.0.i = phi i64 [ 1, %bb32.i ], [ %109, %bb53.i ] >> + %n1.1.i = phi i64 [ %70, %bb32.i ], [ %107, %bb53.i ] >> + %n0.1.i = phi i64 [ %uu.0.0.0, %bb32.i ], [ %77, %bb53.i ] >> + %d0.2.i = phi i64 [ %d0.1.i, %bb32.i ], [ %72, %bb53.i ] >> + %110 = lshr i64 %d0.2.i, 32, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %110}, i64 0, metadata !66) nounwind, !dbg !156 >> + %111 = and i64 %d0.2.i, 4294967295, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %111}, i64 0, metadata !68) nounwind, !dbg !156 >> + %112 = urem i64 %n1.1.i, %110, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %112}, i64 0, metadata !71) nounwind, !dbg !156 >> + %113 = udiv i64 %n1.1.i, %110, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %113}, i64 0, metadata !69) nounwind, !dbg !156 >> + %114 = mul i64 %113, %111, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %114}, i64 0, metadata !73) nounwind, !dbg !156 >> + %115 = shl i64 %112, 32 >> + %116 = lshr i64 %n0.1.i, 32, !dbg !156 >> + %117 = or i64 %115, %116, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %117}, i64 0, metadata !71) nounwind, !dbg !156 >> + %118 = icmp ult i64 %117, %114, !dbg !156 >> + br i1 %118, label %bb62.i, label %bb65.i, !dbg !156 >> + >> +bb62.i: ; preds = %bb54.i >> + %119 = add i64 %113, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %119}, i64 0, metadata !69) nounwind, !dbg !156 >> + %uadd148.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %117, i64 %d0.2.i) nounwind >> + %120 = extractvalue %0 %uadd148.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %120}, i64 0, metadata !71) nounwind, !dbg !156 >> + %121 = extractvalue %0 %uadd148.i, 1 >> + %.not5.i = xor i1 %121, true >> + %122 = icmp ult i64 %120, %114, !dbg !156 >> + %or.cond6.i = and i1 %122, %.not5.i >> + br i1 %or.cond6.i, label %bb64.i, label %bb65.i, !dbg !156 >> + >> +bb64.i: ; preds = %bb62.i >> + %123 = add i64 %113, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %123}, i64 0, metadata !69) nounwind, !dbg !156 >> + %124 = add i64 %120, %d0.2.i, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %124}, i64 0, metadata !71) nounwind, !dbg !156 >> + br label %bb65.i, !dbg !156 >> + >> +bb65.i: ; preds = %bb64.i, %bb62.i, %bb54.i >> + %__q157.0.i = phi i64 [ %123, %bb64.i ], [ %119, %bb62.i ], [ %113, %bb54.i ] >> + %__r159.0.i = phi i64 [ %124, %bb64.i ], [ %120, %bb62.i ], [ %117, %bb54.i ] >> + %125 = sub i64 %__r159.0.i, %114, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %125}, i64 0, metadata !71) nounwind, !dbg !156 >> + %126 = urem i64 %125, %110, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %126}, i64 0, metadata !72) nounwind, !dbg !156 >> + %127 = udiv i64 %125, %110, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %127}, i64 0, metadata !70) nounwind, !dbg !156 >> + %128 = mul i64 %127, %111, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %128}, i64 0, metadata !73) nounwind, !dbg !156 >> + %129 = shl i64 %126, 32 >> + %130 = and i64 %n0.1.i, 4294967295, !dbg !156 >> + %131 = or i64 %129, %130, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %131}, i64 0, metadata !72) nounwind, !dbg !156 >> + %132 = icmp ult i64 %131, %128, !dbg !156 >> + br i1 %132, label %bb66.i, label %bb69.i, !dbg !156 >> + >> +bb66.i: ; preds = %bb65.i >> + %133 = add i64 %127, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %133}, i64 0, metadata !70) nounwind, !dbg !156 >> + %uadd147.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %131, i64 %d0.2.i) nounwind >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !72) nounwind, !dbg !156 >> + %134 = extractvalue %0 %uadd147.i, 1 >> + br i1 %134, label %bb69.i, label %bb67.i, !dbg !156 >> + >> +bb67.i: ; preds = %bb66.i >> + %135 = extractvalue %0 %uadd147.i, 0 >> + %136 = add i64 %127, -2 >> + %137 = icmp ult i64 %135, %128, !dbg !156 >> + %.7.i = select i1 %137, i64 %136, i64 %133 >> + br label %bb69.i >> + >> +bb69.i: ; preds = %bb67.i, %bb66.i, %bb65.i >> + %__q058.0.i = phi i64 [ %133, %bb66.i ], [ %127, %bb65.i ], [ %.7.i, %bb67.i ] >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !72) nounwind, !dbg !156 >> + %138 = shl i64 %__q157.0.i, 32 >> + %139 = or i64 %__q058.0.i, %138, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{i64 %139}, i64 0, metadata !39) nounwind, !dbg !156 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !36) nounwind, !dbg !156 >> + br label %__udivmodti4.exit, !dbg !156 >> + >> +bb73.i: ; preds = %bb4 >> + %140 = icmp ugt i64 %vv.0.1.0, %uu.0.1.0, !dbg !157 >> + br i1 %140, label %__udivmodti4.exit, label %bb82.i, !dbg !157 >> + >> +bb79.i: ; preds = %bb82.i >> + %tmp.i = shl i64 255, %.cast80.i >> + %141 = and i64 %tmp.i, %vv.0.1.0 >> + %142 = icmp eq i64 %141, 0, !dbg !158 >> + br i1 %142, label %bb81.i, label %bb83.i, !dbg !158 >> + >> +bb81.i: ; preds = %bb79.i >> + %indvar.next.i = add i64 %indvar.i, 1 >> + br label %bb82.i, !dbg !158 >> + >> +bb82.i: ; preds = %bb73.i, %bb81.i >> + %indvar.i = phi i64 [ %indvar.next.i, %bb81.i ], [ 0, %bb73.i ] >> + %tmp = mul i64 %indvar.i, -8 >> + %.cast80.i = add i64 %tmp, 56 >> + %143 = icmp eq i64 %.cast80.i, 0, !dbg !158 >> + br i1 %143, label %bb83.i, label %bb79.i, !dbg !158 >> + >> +bb83.i: ; preds = %bb82.i, %bb79.i >> + %.cast84.i = and i64 %.cast80.i, 4294967288 >> + %144 = lshr i64 %vv.0.1.0, %.cast84.i, !dbg !158 >> + %145 = getelementptr inbounds [256 x i8]* @__clz_tab, i64 0, i64 %144, !dbg !158 >> + %146 = load i8* %145, align 1, !dbg !158 >> + %147 = zext i8 %146 to i64, !dbg !158 >> + %148 = add i64 %147, %.cast80.i, !dbg !158 >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !42) nounwind, !dbg !158 >> + %149 = icmp eq i64 %148, 64 >> + br i1 %149, label %bb85.i, label %bb92.i, !dbg !159 >> + >> +bb85.i: ; preds = %bb83.i >> + %150 = icmp ugt i64 %uu.0.1.0, %vv.0.1.0, !dbg !160 >> + %151 = icmp uge i64 %uu.0.0.0, %vv.0.0.0, !dbg !160 >> + %152 = or i1 %150, %151, !dbg !160 >> + %.8.i = zext i1 %152 to i64 >> + tail call void @llvm.dbg.value(metadata !114, i64 0, metadata !40) nounwind, !dbg !161 >> + br label %__udivmodti4.exit >> + >> +bb92.i: ; preds = %bb83.i >> + %153 = sub i64 64, %148, !dbg !158 >> + tail call void @llvm.dbg.value(metadata !{i64 %148}, i64 0, metadata !41) nounwind, !dbg !162 >> + %.cast93.i = and i64 %153, 4294967295 >> + %154 = shl i64 %vv.0.1.0, %.cast93.i, !dbg !163 >> + %.cast94.i = and i64 %148, 4294967295 >> + %155 = lshr i64 %vv.0.0.0, %.cast94.i, !dbg !163 >> + %156 = or i64 %154, %155, !dbg !163 >> + tail call void @llvm.dbg.value(metadata !{i64 %156}, i64 0, metadata !35) nounwind, !dbg !163 >> + %157 = shl i64 %vv.0.0.0, %.cast93.i, !dbg !164 >> + tail call void @llvm.dbg.value(metadata !{i64 %157}, i64 0, metadata !32) nounwind, !dbg !164 >> + %158 = lshr i64 %uu.0.1.0, %.cast94.i, !dbg !165 >> + tail call void @llvm.dbg.value(metadata !{i64 %158}, i64 0, metadata !38) nounwind, !dbg !165 >> + %159 = shl i64 %uu.0.1.0, %.cast93.i, !dbg !166 >> + %160 = lshr i64 %uu.0.0.0, %.cast94.i, !dbg !166 >> + %161 = or i64 %159, %160, !dbg !166 >> + tail call void @llvm.dbg.value(metadata !{i64 %161}, i64 0, metadata !37) nounwind, !dbg !166 >> + %162 = shl i64 %uu.0.0.0, %.cast93.i, !dbg !167 >> + tail call void @llvm.dbg.value(metadata !{i64 %162}, i64 0, metadata !36) nounwind, !dbg !167 >> + %163 = lshr i64 %156, 32, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %163}, i64 0, metadata !82) nounwind, !dbg !168 >> + %164 = and i64 %156, 4294967295, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %164}, i64 0, metadata !84) nounwind, !dbg !168 >> + %165 = urem i64 %158, %163, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %165}, i64 0, metadata !87) nounwind, !dbg !168 >> + %166 = udiv i64 %158, %163, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %166}, i64 0, metadata !85) nounwind, !dbg !168 >> + %167 = mul i64 %166, %164, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %167}, i64 0, metadata !89) nounwind, !dbg !168 >> + %168 = shl i64 %165, 32 >> + %169 = lshr i64 %161, 32, !dbg !168 >> + %170 = or i64 %168, %169, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %170}, i64 0, metadata !87) nounwind, !dbg !168 >> + %171 = icmp ult i64 %170, %167, !dbg !168 >> + br i1 %171, label %bb107.i, label %bb110.i, !dbg !168 >> + >> +bb107.i: ; preds = %bb92.i >> + %172 = add i64 %166, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %172}, i64 0, metadata !85) nounwind, !dbg !168 >> + %uadd146.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %170, i64 %156) nounwind >> + %173 = extractvalue %0 %uadd146.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %173}, i64 0, metadata !87) nounwind, !dbg !168 >> + %174 = extractvalue %0 %uadd146.i, 1 >> + %.not9.i = xor i1 %174, true >> + %175 = icmp ult i64 %173, %167, !dbg !168 >> + %or.cond10.i = and i1 %175, %.not9.i >> + br i1 %or.cond10.i, label %bb109.i, label %bb110.i, !dbg !168 >> + >> +bb109.i: ; preds = %bb107.i >> + %176 = add i64 %166, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %176}, i64 0, metadata !85) nounwind, !dbg !168 >> + %177 = add i64 %173, %156, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %177}, i64 0, metadata !87) nounwind, !dbg !168 >> + br label %bb110.i, !dbg !168 >> + >> +bb110.i: ; preds = %bb109.i, %bb107.i, %bb92.i >> + %__q1102.0.i = phi i64 [ %176, %bb109.i ], [ %172, %bb107.i ], [ %166, %bb92.i ] >> + %__r1104.0.i = phi i64 [ %177, %bb109.i ], [ %173, %bb107.i ], [ %170, %bb92.i ] >> + %178 = sub i64 %__r1104.0.i, %167, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %178}, i64 0, metadata !87) nounwind, !dbg !168 >> + %179 = urem i64 %178, %163, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %179}, i64 0, metadata !88) nounwind, !dbg !168 >> + %180 = udiv i64 %178, %163, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %180}, i64 0, metadata !86) nounwind, !dbg !168 >> + %181 = mul i64 %180, %164, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %181}, i64 0, metadata !89) nounwind, !dbg !168 >> + %182 = shl i64 %179, 32 >> + %183 = and i64 %161, 4294967295, !dbg !168 >> + %184 = or i64 %182, %183, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %184}, i64 0, metadata !88) nounwind, !dbg !168 >> + %185 = icmp ult i64 %184, %181, !dbg !168 >> + br i1 %185, label %bb111.i, label %bb114.i, !dbg !168 >> + >> +bb111.i: ; preds = %bb110.i >> + %186 = add i64 %180, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %186}, i64 0, metadata !86) nounwind, !dbg !168 >> + %uadd145.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %184, i64 %156) nounwind >> + %187 = extractvalue %0 %uadd145.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %187}, i64 0, metadata !88) nounwind, !dbg !168 >> + %188 = extractvalue %0 %uadd145.i, 1 >> + %.not11.i = xor i1 %188, true >> + %189 = icmp ult i64 %187, %181, !dbg !168 >> + %or.cond12.i = and i1 %189, %.not11.i >> + br i1 %or.cond12.i, label %bb113.i, label %bb114.i, !dbg !168 >> + >> +bb113.i: ; preds = %bb111.i >> + %190 = add i64 %180, -2 >> + tail call void @llvm.dbg.value(metadata !{i64 %190}, i64 0, metadata !86) nounwind, !dbg !168 >> + %191 = add i64 %187, %156, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %191}, i64 0, metadata !88) nounwind, !dbg !168 >> + br label %bb114.i, !dbg !168 >> + >> +bb114.i: ; preds = %bb113.i, %bb111.i, %bb110.i >> + %__q0103.0.i = phi i64 [ %190, %bb113.i ], [ %186, %bb111.i ], [ %180, %bb110.i ] >> + %__r0105.0.i = phi i64 [ %191, %bb113.i ], [ %187, %bb111.i ], [ %184, %bb110.i ] >> + %192 = sub i64 %__r0105.0.i, %181, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !88) nounwind, !dbg !168 >> + %193 = shl i64 %__q1102.0.i, 32 >> + %194 = or i64 %__q0103.0.i, %193, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %194}, i64 0, metadata !39) nounwind, !dbg !168 >> + tail call void @llvm.dbg.value(metadata !{i64 %192}, i64 0, metadata !37) nounwind, !dbg !168 >> + %195 = and i64 %__q0103.0.i, 4294967295, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %195}, i64 0, metadata !95) nounwind, !dbg !169 >> + %196 = lshr i64 %194, 32, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %196}, i64 0, metadata !97) nounwind, !dbg !169 >> + %197 = and i64 %157, 4294967295, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %197}, i64 0, metadata !96) nounwind, !dbg !169 >> + %198 = lshr i64 %157, 32, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %198}, i64 0, metadata !98) nounwind, !dbg !169 >> + %199 = mul i64 %195, %197, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %199}, i64 0, metadata !90) nounwind, !dbg !169 >> + %200 = mul i64 %195, %198, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %200}, i64 0, metadata !92) nounwind, !dbg !169 >> + %201 = mul i64 %196, %197, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %201}, i64 0, metadata !93) nounwind, !dbg !169 >> + %202 = mul i64 %196, %198, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %202}, i64 0, metadata !94) nounwind, !dbg !169 >> + %203 = lshr i64 %199, 32, !dbg !169 >> + %204 = add i64 %203, %200, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %204}, i64 0, metadata !92) nounwind, !dbg !169 >> + %uadd.i = tail call %0 @llvm.uadd.with.overflow.i64(i64 %204, i64 %201) nounwind >> + %205 = extractvalue %0 %uadd.i, 0 >> + tail call void @llvm.dbg.value(metadata !{i64 %205}, i64 0, metadata !92) nounwind, !dbg !169 >> + %206 = extractvalue %0 %uadd.i, 1 >> + %207 = add i64 %202, 4294967296, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %207}, i64 0, metadata !94) nounwind, !dbg !169 >> + %__x3.0.i = select i1 %206, i64 %207, i64 %202 >> + %208 = lshr i64 %205, 32, !dbg !169 >> + %209 = add i64 %__x3.0.i, %208, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !{i64 %209}, i64 0, metadata !79) nounwind, !dbg !169 >> + tail call void @llvm.dbg.value(metadata !135, i64 0, metadata !81) nounwind, !dbg !169 >> + %210 = icmp ugt i64 %209, %192, !dbg !170 >> + br i1 %210, label %bb121.i, label %bb117.i, !dbg !170 >> + >> +bb117.i: ; preds = %bb114.i >> + %211 = and i64 %199, 4294967295, !dbg !169 >> + %212 = shl i64 %205, 32 >> + %213 = or i64 %212, %211 >> + %214 = icmp eq i64 %209, %192, !dbg !170 >> + %215 = icmp ugt i64 %213, %162, !dbg !170 >> + %216 = and i1 %214, %215, !dbg !170 >> + br i1 %216, label %bb121.i, label %__udivmodti4.exit, !dbg !170 >> + >> +bb121.i: ; preds = %bb117.i, %bb114.i >> + %217 = add i64 %194, -1 >> + tail call void @llvm.dbg.value(metadata !{i64 %217}, i64 0, metadata !39) nounwind, !dbg !171 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !99) nounwind, !dbg !172 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !79) nounwind, !dbg !172 >> + tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !81) nounwind, !dbg !172 >> + br label %__udivmodti4.exit, !dbg !172 >> + >> +__udivmodti4.exit: ; preds = %bb20.i, %bb69.i, %bb73.i, %bb85.i, %bb117.i, %bb121.i >> + %q1.2.i = phi i64 [ 0, %bb85.i ], [ 0, %bb20.i ], [ %q1.0.i, %bb69.i ], [ 0, %bb73.i ], [ 0, %bb121.i ], [ 0, %bb117.i ] >> + %q0.3.i = phi i64 [ %.8.i, %bb85.i ], [ %58, %bb20.i ], [ %139, %bb69.i ], [ 0, %bb73.i ], [ %217, %bb121.i ], [ %194, %bb117.i ] >> + %218 = zext i64 %q0.3.i to i128 >> + %219 = zext i64 %q1.2.i to i128 >> + %220 = shl i128 %219, 64 >> + %221 = or i128 %220, %218 >> + tail call void @llvm.dbg.value(metadata !{i128 %221}, i64 0, metadata !110), !dbg !122 >> + %222 = icmp eq i64 %c.1, 0, !dbg !173 >> + %223 = sub nsw i128 0, %221, !dbg !174 >> + tail call void @llvm.dbg.value(metadata !{i128 %223}, i64 0, metadata !110), !dbg !174 >> + %w.0 = select i1 %222, i128 %221, i128 %223 >> + ret i128 %w.0, !dbg !175 >> +} >> + >> +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone >> + >> +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone >> + >> +declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone >> + >> +!llvm.dbg.sp = !{!0, !9} >> +!llvm.dbg.lv.__udivmodti4 = !{!14, !15, !16, !17, !30, !31, !32, !35, !36, !37, !38, !39, !40, !41, !42, !43, !44, !46, !47, !49, !50, !51, !52, !53, !54, !55, !57, !58, !60, !61, !62, !63, !64, !65, !66, !68, !69, !70, !71, !72, !73, !74, !76, !77, !79, !81, !82, !84, !85, !86, !87, !88, !89, !90, !92, !93, !94, !95, !96, !97, !98, !99, !101} >> +!llvm.dbg.lv.__divti3 = !{!103, !104, !105, !108, !109, !110} >> + >> +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__udivmodti4", metadata !"__udivmodti4", metadata !"", metadata !1, i32 879, metadata !3, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 true, null} ; [ DW_TAG_subprogram ] >> +!1 = metadata !{i32 589865, metadata !"foobar.c", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] >> +!2 = metadata !{i32 589841, i32 0, i32 1, metadata !"foobar.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] >> +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ] >> +!4 = metadata !{metadata !5, metadata !5, metadata !5, metadata !8} >> +!5 = metadata !{i32 589846, metadata !6, metadata !"UTItype", metadata !6, i32 166, i64 0, i64 0, i64 0, i32 0, metadata !7} ; [ DW_TAG_typedef ] >> +!6 = metadata !{i32 589865, metadata !"foobar.h", metadata !"/tmp", metadata !2} ; [ DW_TAG_file_type ] >> +!7 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] >> +!8 = metadata !{i32 589839, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ] >> +!9 = metadata !{i32 589870, i32 0, metadata !1, metadata !"__divti3", metadata !"__divti3", metadata !"__divti3", metadata !1, i32 1094, metadata !10, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i128 (i128, i128)* @__divti3} ; [ DW_TAG_subprogram ] >> +!10 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null} ; [ DW_TAG_subroutine_type ] >> +!11 = metadata !{metadata !12, metadata !12, metadata !12} >> +!12 = metadata !{i32 589846, metadata !6, metadata !"TItype", metadata !6, i32 160, i64 0, i64 0, i64 0, i32 0, metadata !13} ; [ DW_TAG_typedef ] >> +!13 = metadata !{i32 589860, metadata !1, metadata !"", metadata !1, i32 0, i64 128, i64 128, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] >> +!14 = metadata !{i32 590081, metadata !0, metadata !"n", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] >> +!15 = metadata !{i32 590081, metadata !0, metadata !"d", metadata !1, i32 878, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] >> +!16 = metadata !{i32 590081, metadata !0, metadata !"rp", metadata !1, i32 878, metadata !8, i32 0} ; [ DW_TAG_arg_variable ] >> +!17 = metadata !{i32 590080, metadata !18, metadata !"nn", metadata !1, i32 880, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!18 = metadata !{i32 589835, metadata !0, i32 879, i32 0, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] >> +!19 = metadata !{i32 589846, metadata !1, metadata !"DWunion", metadata !1, i32 879, i64 0, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_typedef ] >> +!20 = metadata !{i32 589847, metadata !1, metadata !"", metadata !6, i32 432, i64 128, i64 128, i64 0, i32 0, null, metadata !21, i32 0, null} ; [ DW_TAG_union_type ] >> +!21 = metadata !{metadata !22, metadata !29} >> +!22 = metadata !{i32 589837, metadata !20, metadata !"s", metadata !6, i32 433, i64 128, i64 64, i64 0, i32 0, metadata !23} ; [ DW_TAG_member ] >> +!23 = metadata !{i32 589843, metadata !1, metadata !"DWstruct", metadata !6, i32 424, i64 128, i64 64, i64 0, i32 0, null, metadata !24, i32 0, null} ; [ DW_TAG_structure_type ] >> +!24 = metadata !{metadata !25, metadata !28} >> +!25 = metadata !{i32 589837, metadata !23, metadata !"low", metadata !6, i32 424, i64 64, i64 64, i64 0, i32 0, metadata !26} ; [ DW_TAG_member ] >> +!26 = metadata !{i32 589846, metadata !6, metadata !"DItype", metadata !6, i32 156, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] >> +!27 = metadata !{i32 589860, metadata !1, metadata !"long int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] >> +!28 = metadata !{i32 589837, metadata !23, metadata !"high", metadata !6, i32 424, i64 64, i64 64, i64 64, i32 0, metadata !26} ; [ DW_TAG_member ] >> +!29 = metadata !{i32 589837, metadata !20, metadata !"ll", metadata !6, i32 434, i64 128, i64 128, i64 0, i32 0, metadata !12} ; [ DW_TAG_member ] >> +!30 = metadata !{i32 590080, metadata !18, metadata !"dd", metadata !1, i32 881, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!31 = metadata !{i32 590080, metadata !18, metadata !"rr", metadata !1, i32 882, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!32 = metadata !{i32 590080, metadata !18, metadata !"d0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!33 = metadata !{i32 589846, metadata !6, metadata !"UDItype", metadata !6, i32 159, i64 0, i64 0, i64 0, i32 0, metadata !34} ; [ DW_TAG_typedef ] >> +!34 = metadata !{i32 589860, metadata !1, metadata !"long unsigned int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] >> +!35 = metadata !{i32 590080, metadata !18, metadata !"d1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!36 = metadata !{i32 590080, metadata !18, metadata !"n0", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!37 = metadata !{i32 590080, metadata !18, metadata !"n1", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!38 = metadata !{i32 590080, metadata !18, metadata !"n2", metadata !1, i32 883, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!39 = metadata !{i32 590080, metadata !18, metadata !"q0", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!40 = metadata !{i32 590080, metadata !18, metadata !"q1", metadata !1, i32 884, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!41 = metadata !{i32 590080, metadata !18, metadata !"b", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!42 = metadata !{i32 590080, metadata !18, metadata !"bm", metadata !1, i32 885, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!43 = metadata !{i32 590080, metadata !18, metadata !"ww", metadata !1, i32 1086, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!44 = metadata !{i32 590080, metadata !45, metadata !"__xr", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!45 = metadata !{i32 589835, metadata !18, i32 933, i32 0, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] >> +!46 = metadata !{i32 590080, metadata !45, metadata !"__a", metadata !1, i32 933, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!47 = metadata !{i32 590080, metadata !48, metadata !"__d1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!48 = metadata !{i32 589835, metadata !18, i32 945, i32 0, metadata !1, i32 2} ; [ DW_TAG_lexical_block ] >> +!49 = metadata !{i32 590080, metadata !48, metadata !"__d0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!50 = metadata !{i32 590080, metadata !48, metadata !"__q1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!51 = metadata !{i32 590080, metadata !48, metadata !"__q0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!52 = metadata !{i32 590080, metadata !48, metadata !"__r1", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!53 = metadata !{i32 590080, metadata !48, metadata !"__r0", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!54 = metadata !{i32 590080, metadata !48, metadata !"__m", metadata !1, i32 945, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!55 = metadata !{i32 590080, metadata !56, metadata !"__xr", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!56 = metadata !{i32 589835, metadata !18, i32 957, i32 0, metadata !1, i32 3} ; [ DW_TAG_lexical_block ] >> +!57 = metadata !{i32 590080, metadata !56, metadata !"__a", metadata !1, i32 957, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!58 = metadata !{i32 590080, metadata !59, metadata !"__d1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!59 = metadata !{i32 589835, metadata !18, i32 982, i32 0, metadata !1, i32 4} ; [ DW_TAG_lexical_block ] >> +!60 = metadata !{i32 590080, metadata !59, metadata !"__d0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!61 = metadata !{i32 590080, metadata !59, metadata !"__q1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!62 = metadata !{i32 590080, metadata !59, metadata !"__q0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!63 = metadata !{i32 590080, metadata !59, metadata !"__r1", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!64 = metadata !{i32 590080, metadata !59, metadata !"__r0", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!65 = metadata !{i32 590080, metadata !59, metadata !"__m", metadata !1, i32 982, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!66 = metadata !{i32 590080, metadata !67, metadata !"__d1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!67 = metadata !{i32 589835, metadata !18, i32 987, i32 0, metadata !1, i32 5} ; [ DW_TAG_lexical_block ] >> +!68 = metadata !{i32 590080, metadata !67, metadata !"__d0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!69 = metadata !{i32 590080, metadata !67, metadata !"__q1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!70 = metadata !{i32 590080, metadata !67, metadata !"__q0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!71 = metadata !{i32 590080, metadata !67, metadata !"__r1", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!72 = metadata !{i32 590080, metadata !67, metadata !"__r0", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!73 = metadata !{i32 590080, metadata !67, metadata !"__m", metadata !1, i32 987, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!74 = metadata !{i32 590080, metadata !75, metadata !"__xr", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!75 = metadata !{i32 589835, metadata !18, i32 1022, i32 0, metadata !1, i32 6} ; [ DW_TAG_lexical_block ] >> +!76 = metadata !{i32 590080, metadata !75, metadata !"__a", metadata !1, i32 1022, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!77 = metadata !{i32 590080, metadata !78, metadata !"__x", metadata !1, i32 1036, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!78 = metadata !{i32 589835, metadata !18, i32 1036, i32 0, metadata !1, i32 7} ; [ DW_TAG_lexical_block ] >> +!79 = metadata !{i32 590080, metadata !80, metadata !"m1", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!80 = metadata !{i32 589835, metadata !18, i32 1055, i32 0, metadata !1, i32 8} ; [ DW_TAG_lexical_block ] >> +!81 = metadata !{i32 590080, metadata !80, metadata !"m0", metadata !1, i32 1052, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!82 = metadata !{i32 590080, metadata !83, metadata !"__d1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!83 = metadata !{i32 589835, metadata !80, i32 1063, i32 0, metadata !1, i32 9} ; [ DW_TAG_lexical_block ] >> +!84 = metadata !{i32 590080, metadata !83, metadata !"__d0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!85 = metadata !{i32 590080, metadata !83, metadata !"__q1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!86 = metadata !{i32 590080, metadata !83, metadata !"__q0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!87 = metadata !{i32 590080, metadata !83, metadata !"__r1", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!88 = metadata !{i32 590080, metadata !83, metadata !"__r0", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!89 = metadata !{i32 590080, metadata !83, metadata !"__m", metadata !1, i32 1063, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!90 = metadata !{i32 590080, metadata !91, metadata !"__x0", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!91 = metadata !{i32 589835, metadata !80, i32 1064, i32 0, metadata !1, i32 10} ; [ DW_TAG_lexical_block ] >> +!92 = metadata !{i32 590080, metadata !91, metadata !"__x1", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!93 = metadata !{i32 590080, metadata !91, metadata !"__x2", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!94 = metadata !{i32 590080, metadata !91, metadata !"__x3", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!95 = metadata !{i32 590080, metadata !91, metadata !"__ul", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!96 = metadata !{i32 590080, metadata !91, metadata !"__vl", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!97 = metadata !{i32 590080, metadata !91, metadata !"__uh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!98 = metadata !{i32 590080, metadata !91, metadata !"__vh", metadata !1, i32 1064, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!99 = metadata !{i32 590080, metadata !100, metadata !"__x", metadata !1, i32 1069, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!100 = metadata !{i32 589835, metadata !80, i32 1069, i32 0, metadata !1, i32 11} ; [ DW_TAG_lexical_block ] >> +!101 = metadata !{i32 590080, metadata !102, metadata !"__x", metadata !1, i32 1077, metadata !33, i32 0} ; [ DW_TAG_auto_variable ] >> +!102 = metadata !{i32 589835, metadata !80, i32 1077, i32 0, metadata !1, i32 12} ; [ DW_TAG_lexical_block ] >> +!103 = metadata !{i32 590081, metadata !9, metadata !"u", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] >> +!104 = metadata !{i32 590081, metadata !9, metadata !"v", metadata !1, i32 1093, metadata !12, i32 0} ; [ DW_TAG_arg_variable ] >> +!105 = metadata !{i32 590080, metadata !106, metadata !"c", metadata !1, i32 1095, metadata !107, i32 0} ; [ DW_TAG_auto_variable ] >> +!106 = metadata !{i32 589835, metadata !9, i32 1094, i32 0, metadata !1, i32 13} ; [ DW_TAG_lexical_block ] >> +!107 = metadata !{i32 589846, metadata !6, metadata !"word_type", metadata !6, i32 424, i64 0, i64 0, i64 0, i32 0, metadata !27} ; [ DW_TAG_typedef ] >> +!108 = metadata !{i32 590080, metadata !106, metadata !"uu", metadata !1, i32 1096, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!109 = metadata !{i32 590080, metadata !106, metadata !"vv", metadata !1, i32 1097, metadata !19, i32 0} ; [ DW_TAG_auto_variable ] >> +!110 = metadata !{i32 590080, metadata !106, metadata !"w", metadata !1, i32 1098, metadata !12, i32 0} ; [ DW_TAG_auto_variable ] >> +!111 = metadata !{i32 1093, i32 0, metadata !9, null} >> +!112 = metadata !{i32 1096, i32 0, metadata !106, null} >> +!113 = metadata !{i32 1097, i32 0, metadata !106, null} >> +!114 = metadata !{i64 0} >> +!115 = metadata !{i32 1095, i32 0, metadata !106, null} >> +!116 = metadata !{i32 1100, i32 0, metadata !106, null} >> +!117 = metadata !{i64 -1} >> +!118 = metadata !{i32 1101, i32 0, metadata !106, null} >> +!119 = metadata !{i32 1103, i32 0, metadata !106, null} >> +!120 = metadata !{i32 1104, i32 0, metadata !106, null} >> +!121 = metadata !{i32 878, i32 0, metadata !0, metadata !122} >> +!122 = metadata !{i32 1107, i32 0, metadata !106, null} >> +!123 = metadata !{i128* null} >> +!124 = metadata !{i32 880, i32 0, metadata !18, metadata !122} >> +!125 = metadata !{i32 881, i32 0, metadata !18, metadata !122} >> +!126 = metadata !{i32 882, i32 0, metadata !18, metadata !122} >> +!127 = metadata !{i32 1086, i32 0, metadata !18, metadata !122} >> +!128 = metadata !{i32 887, i32 0, metadata !18, metadata !122} >> +!129 = metadata !{i32 888, i32 0, metadata !18, metadata !122} >> +!130 = metadata !{i32 889, i32 0, metadata !18, metadata !122} >> +!131 = metadata !{i32 890, i32 0, metadata !18, metadata !122} >> +!132 = metadata !{i32 927, i32 0, metadata !18, metadata !122} >> +!133 = metadata !{i32 929, i32 0, metadata !18, metadata !122} >> +!134 = metadata !{i32 933, i32 0, metadata !45, metadata !122} >> +!135 = metadata !{null} >> +!136 = metadata !{i32 935, i32 0, metadata !18, metadata !122} >> +!137 = metadata !{i32 940, i32 0, metadata !18, metadata !122} >> +!138 = metadata !{i32 941, i32 0, metadata !18, metadata !122} >> +!139 = metadata !{i32 942, i32 0, metadata !18, metadata !122} >> +!140 = metadata !{i32 945, i32 0, metadata !48, metadata !122} >> +!141 = metadata !{i32 946, i32 0, metadata !18, metadata !122} >> +!142 = metadata !{i32 954, i32 0, metadata !18, metadata !122} >> +!143 = metadata !{i32 955, i32 0, metadata !18, metadata !122} >> +!144 = metadata !{i32 957, i32 0, metadata !56, metadata !122} >> +!145 = metadata !{i64 56} >> +!146 = metadata !{i32 959, i32 0, metadata !18, metadata !122} >> +!147 = metadata !{i32 968, i32 0, metadata !18, metadata !122} >> +!148 = metadata !{i64 1} >> +!149 = metadata !{i32 969, i32 0, metadata !18, metadata !122} >> +!150 = metadata !{i32 975, i32 0, metadata !18, metadata !122} >> +!151 = metadata !{i32 977, i32 0, metadata !18, metadata !122} >> +!152 = metadata !{i32 978, i32 0, metadata !18, metadata !122} >> +!153 = metadata !{i32 979, i32 0, metadata !18, metadata !122} >> +!154 = metadata !{i32 980, i32 0, metadata !18, metadata !122} >> +!155 = metadata !{i32 982, i32 0, metadata !59, metadata !122} >> +!156 = metadata !{i32 987, i32 0, metadata !67, metadata !122} >> +!157 = metadata !{i32 1003, i32 0, metadata !18, metadata !122} >> +!158 = metadata !{i32 1022, i32 0, metadata !75, metadata !122} >> +!159 = metadata !{i32 1023, i32 0, metadata !18, metadata !122} >> +!160 = metadata !{i32 1033, i32 0, metadata !18, metadata !122} >> +!161 = metadata !{i32 1041, i32 0, metadata !18, metadata !122} >> +!162 = metadata !{i32 1055, i32 0, metadata !80, metadata !122} >> +!163 = metadata !{i32 1057, i32 0, metadata !80, metadata !122} >> +!164 = metadata !{i32 1058, i32 0, metadata !80, metadata !122} >> +!165 = metadata !{i32 1059, i32 0, metadata !80, metadata !122} >> +!166 = metadata !{i32 1060, i32 0, metadata !80, metadata !122} >> +!167 = metadata !{i32 1061, i32 0, metadata !80, metadata !122} >> +!168 = metadata !{i32 1063, i32 0, metadata !83, metadata !122} >> +!169 = metadata !{i32 1064, i32 0, metadata !91, metadata !122} >> +!170 = metadata !{i32 1066, i32 0, metadata !80, metadata !122} >> +!171 = metadata !{i32 1068, i32 0, metadata !80, metadata !122} >> +!172 = metadata !{i32 1069, i32 0, metadata !100, metadata !122} >> +!173 = metadata !{i32 1108, i32 0, metadata !106, null} >> +!174 = metadata !{i32 1109, i32 0, metadata !106, null} >> +!175 = metadata !{i32 1111, i32 0, metadata !106, null} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From echristo at apple.com Fri Feb 4 20:48:48 2011 From: echristo at apple.com (Eric Christopher) Date: Sat, 05 Feb 2011 02:48:48 -0000 Subject: [llvm-commits] [llvm] r124930 - /llvm/trunk/lib/Analysis/InlineCost.cpp Message-ID: <20110205024848.1C2252A6C12C@llvm.org> Author: echristo Date: Fri Feb 4 20:48:47 2011 New Revision: 124930 URL: http://llvm.org/viewvc/llvm-project?rev=124930&view=rev Log: Fix cut and paste error spotted by Jakob. Modified: llvm/trunk/lib/Analysis/InlineCost.cpp Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=124930&r1=124929&r2=124930&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Fri Feb 4 20:48:47 2011 @@ -330,7 +330,7 @@ } else if (InvokeInst *II = dyn_cast(U)) { // Turning an indirect call into a direct call is a BIG win if (II->getCalledValue() == V) - Bonus += ConstantFunctionBonus(CallSite(CI), C); + Bonus += ConstantFunctionBonus(CallSite(II), C); } // FIXME: Eliminating conditional branches and switches should // also yield a per-call performance boost. From atrick at apple.com Fri Feb 4 20:58:46 2011 From: atrick at apple.com (Andrew Trick) Date: Sat, 05 Feb 2011 02:58:46 -0000 Subject: [llvm-commits] [llvm] r124932 - /llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp Message-ID: <20110205025846.7DD0C2A6C12C@llvm.org> Author: atrick Date: Fri Feb 4 20:58:46 2011 New Revision: 124932 URL: http://llvm.org/viewvc/llvm-project?rev=124932&view=rev Log: Fix an anti-dep breaker corner case. illegal register operands for UMULL instruction in cfrac nightly test I'm stil working on a unit test, but the case is: rx = movcc rx, r3 r2 = ldr r2, r3 = umull r2, r2 The anti-dep breaker should not convert this into an illegal instruction: r2, r2 = umull Modified: llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp Modified: llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp?rev=124932&r1=124931&r2=124932&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp (original) +++ llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp Fri Feb 4 20:58:46 2011 @@ -334,7 +334,6 @@ { for (RegRefIter I = RegRefBegin; I != RegRefEnd; ++I ) { MachineOperand *MO = I->second; - if (MO->isDef()) continue; if (MO->getParent()->modifiesRegister(NewReg, TRI)) return true; } From bob.wilson at apple.com Fri Feb 4 22:15:50 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Sat, 05 Feb 2011 04:15:50 -0000 Subject: [llvm-commits] [llvm] r124933 - in /llvm/trunk/test/CodeGen: Thumb2/thumb2-mul.ll thumb2-mul.ll Message-ID: <20110205041550.D5D182A6C12C@llvm.org> Author: bwilson Date: Fri Feb 4 22:15:50 2011 New Revision: 124933 URL: http://llvm.org/viewvc/llvm-project?rev=124933&view=rev Log: Move a test that ended up in the wrong place. Removed: llvm/trunk/test/CodeGen/thumb2-mul.ll Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-mul.ll Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-mul.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-mul.ll?rev=124933&r1=124932&r2=124933&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-mul.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-mul.ll Fri Feb 4 22:15:50 2011 @@ -6,3 +6,21 @@ %tmp = mul i32 %a, %b ret i32 %tmp } + +%struct.CMPoint = type { %struct.Point, float, float, [5 x float] } +%struct.Point = type { float, float } + +define %struct.CMPoint* @t1(i32 %i, i32 %j, i32 %n, %struct.CMPoint* %thePoints) nounwind readnone ssp { +entry: +; CHECK: t1: +; CHECK: mla r0, r2, r0, r1 +; CHECK: add.w r0, r0, r0, lsl #3 +; CHECL: add.w r0, r3, r0, lsl #2 + %mul = mul i32 %n, %i + %add = add i32 %mul, %j + %0 = ptrtoint %struct.CMPoint* %thePoints to i32 + %mul5 = mul i32 %add, 36 + %add6 = add i32 %mul5, %0 + %1 = inttoptr i32 %add6 to %struct.CMPoint* + ret %struct.CMPoint* %1 +} Removed: llvm/trunk/test/CodeGen/thumb2-mul.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/thumb2-mul.ll?rev=124932&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/thumb2-mul.ll (original) +++ llvm/trunk/test/CodeGen/thumb2-mul.ll (removed) @@ -1,18 +0,0 @@ -; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 | FileCheck %s - -%struct.CMPoint = type { %struct.Point, float, float, [5 x float] } -%struct.Point = type { float, float } - -define %struct.CMPoint* @t1(i32 %i, i32 %j, i32 %n, %struct.CMPoint* %thePoints) nounwind readnone ssp { -entry: -; CHECK: mla r0, r2, r0, r1 -; CHECK: add.w r0, r0, r0, lsl #3 -; CHECL: add.w r0, r3, r0, lsl #2 - %mul = mul i32 %n, %i - %add = add i32 %mul, %j - %0 = ptrtoint %struct.CMPoint* %thePoints to i32 - %mul5 = mul i32 %add, 36 - %add6 = add i32 %mul5, %0 - %1 = inttoptr i32 %add6 to %struct.CMPoint* - ret %struct.CMPoint* %1 -} From anton at korobeynikov.info Sat Feb 5 00:44:32 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sat, 5 Feb 2011 09:44:32 +0300 Subject: [llvm-commits] [llvm] r124932 - /llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp In-Reply-To: <20110205025846.7DD0C2A6C12C@llvm.org> References: <20110205025846.7DD0C2A6C12C@llvm.org> Message-ID: Hi Andrew, > Fix an anti-dep breaker corner case. > illegal register operands for UMULL instruction in cfrac nightly test > I'm stil working on a unit test, but the case is: > rx = movcc rx, r3 > r2 = ldr > r2, r3 = umull r2, r2 Is this somehow related to PR8986 ? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From geek4civic at gmail.com Sat Feb 5 02:53:12 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 08:53:12 -0000 Subject: [llvm-commits] [llvm] r124945 - /llvm/trunk/lib/Support/Windows/Program.inc Message-ID: <20110205085312.B3BB82A6C12D@llvm.org> Author: chapuni Date: Sat Feb 5 02:53:12 2011 New Revision: 124945 URL: http://llvm.org/viewvc/llvm-project?rev=124945&view=rev Log: Windows/Program.inc: Quote arguments when dubious characters (used by cmd.exe or MSYS shell) are included to invoke CreateProcess(). Thanks to Danil Malyshev. Modified: llvm/trunk/lib/Support/Windows/Program.inc Modified: llvm/trunk/lib/Support/Windows/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=124945&r1=124944&r2=124945&view=diff ============================================================================== --- llvm/trunk/lib/Support/Windows/Program.inc (original) +++ llvm/trunk/lib/Support/Windows/Program.inc Sat Feb 5 02:53:12 2011 @@ -137,7 +137,7 @@ /// ArgNeedsQuotes - Check whether argument needs to be quoted when calling /// CreateProcess. static bool ArgNeedsQuotes(const char *Str) { - return Str[0] == '\0' || strchr(Str, ' ') != 0; + return Str[0] == '\0' || strpbrk(Str, "\t \"&\'()*<>\\`^|") != 0; } From geek4civic at gmail.com Sat Feb 5 02:58:58 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 5 Feb 2011 17:58:58 +0900 Subject: [llvm-commits] Quotation marks around command line arguments In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA1B@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA1B@mail.accesssoftek.com> Message-ID: Danil, thanks, committed in r124945 with minor modifications. For MSYS bash shell, '-foo' (includes single quotes) would be needed to quote. Checked with lit for Python-w32, on gnuwin32 and msys. From geek4civic at gmail.com Sat Feb 5 09:10:54 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 15:10:54 -0000 Subject: [llvm-commits] [llvm] r124946 - in /llvm/trunk/lib/Target/X86: X86FrameLowering.cpp X86ISelLowering.cpp X86JITInfo.cpp Message-ID: <20110205151054.E48602A6C12C@llvm.org> Author: chapuni Date: Sat Feb 5 09:10:54 2011 New Revision: 124946 URL: http://llvm.org/viewvc/llvm-project?rev=124946&view=rev Log: Target/X86: Fix whitespace. Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=124946&r1=124945&r2=124946&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Sat Feb 5 09:10:54 2011 @@ -318,7 +318,7 @@ // move" for this extra "PUSH", the linker will lose track of the fact that // the frame pointer should have the value of the first "PUSH" when it's // trying to unwind. - // + // // FIXME: This looks inelegant. It's possibly correct, but it's covering up // another bug. I.e., one where we generate a prolog like this: // @@ -594,8 +594,8 @@ StackPtr, false, NumBytes - 4); MBB.insert(MBBI, MI); } - } else if (NumBytes >= 4096 && - STI.isTargetWin64() && + } else if (NumBytes >= 4096 && + STI.isTargetWin64() && !STI.isTargetEnvMacho()) { // Sanity check that EAX is not livein for this function. It should // not be, so throw an assert. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124946&r1=124945&r2=124946&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Feb 5 09:10:54 2011 @@ -63,7 +63,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { const X86Subtarget *Subtarget = &TM.getSubtarget(); bool is64Bit = Subtarget->is64Bit(); - + if (Subtarget->isTargetEnvMacho()) { if (is64Bit) return new X8664_MachoTargetObjectFile(); @@ -3394,7 +3394,7 @@ llvm_unreachable("Illegal insert subvector for VINSERTF128"); uint64_t Index = - cast(N->getOperand(2).getNode())->getZExtValue(); + cast(N->getOperand(2).getNode())->getZExtValue(); EVT VecVT = N->getValueType(0); EVT ElVT = VecVT.getVectorElementType(); Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=124946&r1=124945&r2=124946&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Sat Feb 5 09:10:54 2011 @@ -333,7 +333,7 @@ extern "C" { #if !(defined (X86_64_JIT) && defined(_MSC_VER)) // the following function is called only from this translation unit, - // unless we are under 64bit Windows with MSC, where there is + // unless we are under 64bit Windows with MSC, where there is // no support for inline assembly static #endif @@ -462,7 +462,7 @@ void *X86JITInfo::emitFunctionStub(const Function* F, void *Target, JITCodeEmitter &JCE) { - // Note, we cast to intptr_t here to silence a -pedantic warning that + // Note, we cast to intptr_t here to silence a -pedantic warning that // complains about casting a function pointer to a normal pointer. #if defined (X86_32_JIT) && !defined (_MSC_VER) bool NotCC = (Target != (void*)(intptr_t)X86CompilationCallback && From geek4civic at gmail.com Sat Feb 5 09:11:04 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 15:11:04 -0000 Subject: [llvm-commits] [llvm] r124947 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <20110205151104.0C88D2A6C12C@llvm.org> Author: chapuni Date: Sat Feb 5 09:11:03 2011 New Revision: 124947 URL: http://llvm.org/viewvc/llvm-project?rev=124947&view=rev Log: lib/Target/X86/X86JITInfo.cpp: Add Win64 stuff. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=124947&r1=124946&r2=124947&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Sat Feb 5 09:11:03 2011 @@ -127,9 +127,17 @@ "movaps %xmm6, 96(%rsp)\n" "movaps %xmm7, 112(%rsp)\n" // JIT callee +#ifdef _WIN64 + "subq $32, %rsp\n" + "movq %rbp, %rcx\n" // Pass prev frame and return address + "movq 8(%rbp), %rdx\n" + "call " ASMPREFIX "X86CompilationCallback2\n" + "addq $32, %rsp\n" +#else "movq %rbp, %rdi\n" // Pass prev frame and return address "movq 8(%rbp), %rsi\n" "call " ASMPREFIX "X86CompilationCallback2\n" +#endif // Restore all XMM arg registers "movaps 112(%rsp), %xmm7\n" "movaps 96(%rsp), %xmm6\n" From geek4civic at gmail.com Sat Feb 5 09:11:13 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 15:11:13 -0000 Subject: [llvm-commits] [llvm] r124948 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20110205151113.961A32A6C12C@llvm.org> Author: chapuni Date: Sat Feb 5 09:11:13 2011 New Revision: 124948 URL: http://llvm.org/viewvc/llvm-project?rev=124948&view=rev Log: lib/Target/X86/X86ISelLowering.cpp: Introduce a new variable "IsWin64". No functional changes. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124948&r1=124947&r2=124948&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Feb 5 09:11:13 2011 @@ -1838,6 +1838,7 @@ SmallVectorImpl &InVals) const { MachineFunction &MF = DAG.getMachineFunction(); bool Is64Bit = Subtarget->is64Bit(); + bool IsWin64 = Subtarget->isTargetWin64(); bool IsStructRet = CallIsStructReturn(Outs); bool IsSibcall = false; @@ -1945,7 +1946,7 @@ if (VA.isRegLoc()) { RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg)); - if (isVarArg && Subtarget->isTargetWin64()) { + if (isVarArg && IsWin64) { // Win64 ABI requires argument XMM reg to be copied to the corresponding // shadow reg if callee is a varargs function. unsigned ShadowReg = 0; @@ -2011,7 +2012,7 @@ } } - if (Is64Bit && isVarArg && !Subtarget->isTargetWin64()) { + if (Is64Bit && isVarArg && !IsWin64) { // From AMD64 ABI document: // For calls that may call functions that use varargs or stdargs // (prototype-less calls or calls to functions containing ellipsis (...) in @@ -2186,7 +2187,7 @@ Ops.push_back(DAG.getRegister(X86::EBX, getPointerTy())); // Add an implicit use of AL for non-Windows x86 64-bit vararg functions. - if (Is64Bit && isVarArg && !Subtarget->isTargetWin64()) + if (Is64Bit && isVarArg && !IsWin64) Ops.push_back(DAG.getRegister(X86::AL, MVT::i8)); if (InFlag.getNode()) From geek4civic at gmail.com Sat Feb 5 09:11:32 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 15:11:32 -0000 Subject: [llvm-commits] [llvm] r124949 - in /llvm/trunk: lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86FrameLowering.h lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll test/CodeGen/X86/win64_params.ll test/CodeGen/X86/win64_vararg.ll Message-ID: <20110205151132.95A152A6C12C@llvm.org> Author: chapuni Date: Sat Feb 5 09:11:32 2011 New Revision: 124949 URL: http://llvm.org/viewvc/llvm-project?rev=124949&view=rev Log: Target/X86: Tweak allocating shadow area (aka home) on Win64. It must be enough for caller to allocate one. Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp llvm/trunk/lib/Target/X86/X86FrameLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll llvm/trunk/test/CodeGen/X86/win64_params.ll llvm/trunk/test/CodeGen/X86/win64_vararg.ll Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Sat Feb 5 09:11:32 2011 @@ -397,11 +397,6 @@ if (HasFP) MinSize += SlotSize; StackSize = std::max(MinSize, StackSize > 128 ? StackSize - 128 : 0); MFI->setStackSize(StackSize); - } else if (IsWin64) { - // We need to always allocate 32 bytes as register spill area. - // FIXME: We might reuse these 32 bytes for leaf functions. - StackSize += 32; - MFI->setStackSize(StackSize); } // Insert stack pointer adjustment for later moving of return addr. Only Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.h?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FrameLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86FrameLowering.h Sat Feb 5 09:11:32 2011 @@ -28,8 +28,7 @@ explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti) : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), - (sti.isTargetWin64() ? -40 : - (sti.is64Bit() ? -8 : -4))), + (sti.is64Bit() ? -8 : -4)), TM(tm), STI(sti) { } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Feb 5 09:11:32 2011 @@ -1544,6 +1544,12 @@ SmallVector ArgLocs; CCState CCInfo(CallConv, isVarArg, getTargetMachine(), ArgLocs, *DAG.getContext()); + + // Allocate shadow area for Win64 + if (IsWin64) { + CCInfo.AllocateStack(32, 8); + } + CCInfo.AnalyzeFormalArguments(Ins, CC_X86); unsigned LastVal = ~0U; @@ -1778,8 +1784,7 @@ DebugLoc dl, SelectionDAG &DAG, const CCValAssign &VA, ISD::ArgFlagsTy Flags) const { - const unsigned FirstStackArgOffset = (Subtarget->isTargetWin64() ? 32 : 0); - unsigned LocMemOffset = FirstStackArgOffset + VA.getLocMemOffset(); + unsigned LocMemOffset = VA.getLocMemOffset(); SDValue PtrOff = DAG.getIntPtrConstant(LocMemOffset); PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(), StackPtr, PtrOff); if (Flags.isByVal()) @@ -1864,6 +1869,12 @@ SmallVector ArgLocs; CCState CCInfo(CallConv, isVarArg, getTargetMachine(), ArgLocs, *DAG.getContext()); + + // Allocate shadow area for Win64 + if (IsWin64) { + CCInfo.AllocateStack(32, 8); + } + CCInfo.AnalyzeCallOperands(Outs, CC_X86); // Get a count of how many bytes are to be pushed on the stack. @@ -2447,6 +2458,12 @@ SmallVector ArgLocs; CCState CCInfo(CalleeCC, isVarArg, getTargetMachine(), ArgLocs, *DAG.getContext()); + + // Allocate shadow area for Win64 + if (Subtarget->isTargetWin64()) { + CCInfo.AllocateStack(32, 8); + } + CCInfo.AnalyzeCallOperands(Outs, CC_X86); if (CCInfo.getNextStackOffset()) { MachineFunction &MF = DAG.getMachineFunction(); Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll Sat Feb 5 09:11:32 2011 @@ -1,9 +1,8 @@ -; RUN: llc < %s | grep "subq.*\\\$40, \\\%rsp" -target triple = "x86_64-pc-mingw64" +; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; CHECK-NOT: -{{[1-9][0-9]*}}(%rsp) define x86_fp80 @a(i64 %x) nounwind readnone { entry: - %conv = sitofp i64 %x to x86_fp80 ; [#uses=1] - ret x86_fp80 %conv + %conv = sitofp i64 %x to x86_fp80 ; [#uses=1] + ret x86_fp80 %conv } - Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll Sat Feb 5 09:11:32 2011 @@ -1,12 +1,10 @@ -; RUN: llc < %s -o %t1 -; RUN: grep "subq.*\\\$72, \\\%rsp" %t1 -; RUN: grep "movaps \\\%xmm8, 32\\\(\\\%rsp\\\)" %t1 -; RUN: grep "movaps \\\%xmm7, 48\\\(\\\%rsp\\\)" %t1 -target triple = "x86_64-pc-mingw64" +; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; CHECK: subq $40, %rsp +; CHECK: movaps %xmm8, (%rsp) +; CHECK: movaps %xmm7, 16(%rsp) define i32 @a() nounwind { entry: - tail call void asm sideeffect "", "~{xmm7},~{xmm8},~{dirflag},~{fpsr},~{flags}"() nounwind - ret i32 undef + tail call void asm sideeffect "", "~{xmm7},~{xmm8},~{dirflag},~{fpsr},~{flags}"() nounwind + ret i32 undef } - Modified: llvm/trunk/test/CodeGen/X86/win64_params.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win64_params.ll?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/win64_params.ll (original) +++ llvm/trunk/test/CodeGen/X86/win64_params.ll Sat Feb 5 09:11:32 2011 @@ -4,8 +4,8 @@ ; on the stack. define i32 @f6(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6) nounwind readnone optsize { entry: -; CHECK: movl 80(%rsp), %eax -; CHECK: addl 72(%rsp), %eax +; CHECK: movl 48(%rsp), %eax +; CHECK: addl 40(%rsp), %eax %add = add nsw i32 %p6, %p5 ret i32 %add } Modified: llvm/trunk/test/CodeGen/X86/win64_vararg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win64_vararg.ll?rev=124949&r1=124948&r2=124949&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/win64_vararg.ll (original) +++ llvm/trunk/test/CodeGen/X86/win64_vararg.ll Sat Feb 5 09:11:32 2011 @@ -5,11 +5,11 @@ ; calculated. define void @average_va(i32 %count, ...) nounwind { entry: -; CHECK: subq $40, %rsp -; CHECK: movq %r9, 72(%rsp) -; CHECK: movq %r8, 64(%rsp) -; CHECK: movq %rdx, 56(%rsp) -; CHECK: leaq 56(%rsp), %rax +; CHECK: pushq +; CHECK: movq %r9, 40(%rsp) +; CHECK: movq %r8, 32(%rsp) +; CHECK: movq %rdx, 24(%rsp) +; CHECK: leaq 24(%rsp), %rax %ap = alloca i8*, align 8 ; [#uses=1] %ap1 = bitcast i8** %ap to i8* ; [#uses=1] From geek4civic at gmail.com Sat Feb 5 09:11:53 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Sat, 05 Feb 2011 15:11:53 -0000 Subject: [llvm-commits] [llvm] r124950 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake configure include/llvm/Config/config.h.cmake include/llvm/Config/config.h.in lib/Support/Windows/DynamicLibrary.inc lib/Support/Windows/explicit_symbols.inc Message-ID: <20110205151153.BF0392A6C12C@llvm.org> Author: chapuni Date: Sat Feb 5 09:11:53 2011 New Revision: 124950 URL: http://llvm.org/viewvc/llvm-project?rev=124950&view=rev Log: Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc. config.h.* have conditions whether each symbol is defined or not. Autoconf and CMake may check symbols in libgcc.a for JIT on Mingw. Added: llvm/trunk/lib/Support/Windows/explicit_symbols.inc Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/cmake/config-ix.cmake llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.cmake llvm/trunk/include/llvm/Config/config.h.in llvm/trunk/lib/Support/Windows/DynamicLibrary.inc Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Sat Feb 5 09:11:53 2011 @@ -1397,6 +1397,28 @@ AC_C_PRINTF_A AC_FUNC_RAND48 +dnl Check symbols in libgcc.a for JIT on Mingw. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) + AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) + AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) + AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) + + AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) + AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) + AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) + AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) + AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) + AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) + AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) + AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) + AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) + AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) + + AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) + AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) +fi + dnl Check for variations in the Standard C++ library and STL. These macros are dnl provided by LLVM in the autoconf/m4 directory. AC_FUNC_ISNAN Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Sat Feb 5 09:11:53 2011 @@ -155,6 +155,25 @@ check_symbol_exists(setenv stdlib.h HAVE_SETENV) if( PURE_WINDOWS ) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) + + check_function_exists(_alloca HAVE__ALLOCA) + check_function_exists(__alloca HAVE___ALLOCA) + check_function_exists(__chkstk HAVE___CHKSTK) + check_function_exists(___chkstk HAVE____CHKSTK) + + check_function_exists(__ashldi3 HAVE___ASHLDI3) + check_function_exists(__ashrdi3 HAVE___ASHRDI3) + check_function_exists(__divdi3 HAVE___DIVDI3) + check_function_exists(__fixdfdi HAVE___FIXDFDI) + check_function_exists(__fixsfdi HAVE___FIXSFDI) + check_function_exists(__floatdidf HAVE___FLOATDIDF) + check_function_exists(__lshrdi3 HAVE___LSHRDI3) + check_function_exists(__moddi3 HAVE___MODDI3) + check_function_exists(__udivdi3 HAVE___UDIVDI3) + check_function_exists(__umoddi3 HAVE___UMODDI3) + + check_function_exists(__main HAVE___MAIN) + check_function_exists(__cmpdi2 HAVE___CMPDI2) endif() if( HAVE_ARGZ_H ) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Sat Feb 5 09:11:53 2011 @@ -19199,6 +19199,1371 @@ fi +if test "$llvm_cv_os_type" = "MingW" ; then + { echo "$as_me:$LINENO: checking for _alloca in -lgcc" >&5 +echo $ECHO_N "checking for _alloca in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc__alloca+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char _alloca (); +int +main () +{ +return _alloca (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc__alloca=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc__alloca=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc__alloca" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc__alloca" >&6; } +if test $ac_cv_lib_gcc__alloca = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE__ALLOCA 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __alloca in -lgcc" >&5 +echo $ECHO_N "checking for __alloca in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___alloca+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __alloca (); +int +main () +{ +return __alloca (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___alloca=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___alloca=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___alloca" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___alloca" >&6; } +if test $ac_cv_lib_gcc___alloca = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___ALLOCA 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __chkstk in -lgcc" >&5 +echo $ECHO_N "checking for __chkstk in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___chkstk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __chkstk (); +int +main () +{ +return __chkstk (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___chkstk=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___chkstk=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___chkstk" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___chkstk" >&6; } +if test $ac_cv_lib_gcc___chkstk = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___CHKSTK 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for ___chkstk in -lgcc" >&5 +echo $ECHO_N "checking for ___chkstk in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc____chkstk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ___chkstk (); +int +main () +{ +return ___chkstk (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc____chkstk=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc____chkstk=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc____chkstk" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc____chkstk" >&6; } +if test $ac_cv_lib_gcc____chkstk = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE____CHKSTK 1 +_ACEOF + +fi + + + { echo "$as_me:$LINENO: checking for __ashldi3 in -lgcc" >&5 +echo $ECHO_N "checking for __ashldi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___ashldi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __ashldi3 (); +int +main () +{ +return __ashldi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___ashldi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___ashldi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___ashldi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___ashldi3" >&6; } +if test $ac_cv_lib_gcc___ashldi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___ASHLDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __ashrdi3 in -lgcc" >&5 +echo $ECHO_N "checking for __ashrdi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___ashrdi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __ashrdi3 (); +int +main () +{ +return __ashrdi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___ashrdi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___ashrdi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___ashrdi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___ashrdi3" >&6; } +if test $ac_cv_lib_gcc___ashrdi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___ASHRDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __divdi3 in -lgcc" >&5 +echo $ECHO_N "checking for __divdi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___divdi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __divdi3 (); +int +main () +{ +return __divdi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___divdi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___divdi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___divdi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___divdi3" >&6; } +if test $ac_cv_lib_gcc___divdi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___DIVDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __fixdfdi in -lgcc" >&5 +echo $ECHO_N "checking for __fixdfdi in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___fixdfdi+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __fixdfdi (); +int +main () +{ +return __fixdfdi (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___fixdfdi=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___fixdfdi=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___fixdfdi" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___fixdfdi" >&6; } +if test $ac_cv_lib_gcc___fixdfdi = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___FIXDFDI 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __fixsfdi in -lgcc" >&5 +echo $ECHO_N "checking for __fixsfdi in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___fixsfdi+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __fixsfdi (); +int +main () +{ +return __fixsfdi (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___fixsfdi=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___fixsfdi=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___fixsfdi" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___fixsfdi" >&6; } +if test $ac_cv_lib_gcc___fixsfdi = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___FIXSFDI 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __floatdidf in -lgcc" >&5 +echo $ECHO_N "checking for __floatdidf in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___floatdidf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __floatdidf (); +int +main () +{ +return __floatdidf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___floatdidf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___floatdidf=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___floatdidf" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___floatdidf" >&6; } +if test $ac_cv_lib_gcc___floatdidf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___FLOATDIDF 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __lshrdi3 in -lgcc" >&5 +echo $ECHO_N "checking for __lshrdi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___lshrdi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __lshrdi3 (); +int +main () +{ +return __lshrdi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___lshrdi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___lshrdi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___lshrdi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___lshrdi3" >&6; } +if test $ac_cv_lib_gcc___lshrdi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___LSHRDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __moddi3 in -lgcc" >&5 +echo $ECHO_N "checking for __moddi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___moddi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __moddi3 (); +int +main () +{ +return __moddi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___moddi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___moddi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___moddi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___moddi3" >&6; } +if test $ac_cv_lib_gcc___moddi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___MODDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __udivdi3 in -lgcc" >&5 +echo $ECHO_N "checking for __udivdi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___udivdi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __udivdi3 (); +int +main () +{ +return __udivdi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___udivdi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___udivdi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___udivdi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___udivdi3" >&6; } +if test $ac_cv_lib_gcc___udivdi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___UDIVDI3 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __umoddi3 in -lgcc" >&5 +echo $ECHO_N "checking for __umoddi3 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___umoddi3+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __umoddi3 (); +int +main () +{ +return __umoddi3 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___umoddi3=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___umoddi3=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___umoddi3" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___umoddi3" >&6; } +if test $ac_cv_lib_gcc___umoddi3 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___UMODDI3 1 +_ACEOF + +fi + + + { echo "$as_me:$LINENO: checking for __main in -lgcc" >&5 +echo $ECHO_N "checking for __main in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __main (); +int +main () +{ +return __main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___main=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___main" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___main" >&6; } +if test $ac_cv_lib_gcc___main = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___MAIN 1 +_ACEOF + +fi + + { echo "$as_me:$LINENO: checking for __cmpdi2 in -lgcc" >&5 +echo $ECHO_N "checking for __cmpdi2 in -lgcc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gcc___cmpdi2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __cmpdi2 (); +int +main () +{ +return __cmpdi2 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gcc___cmpdi2=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gcc___cmpdi2=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc___cmpdi2" >&5 +echo "${ECHO_T}$ac_cv_lib_gcc___cmpdi2" >&6; } +if test $ac_cv_lib_gcc___cmpdi2 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___CMPDI2 1 +_ACEOF + +fi + +fi + { echo "$as_me:$LINENO: checking for isnan in " >&5 echo $ECHO_N "checking for isnan in ... $ECHO_C" >&6; } Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Sat Feb 5 09:11:53 2011 @@ -454,9 +454,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} + +/* Have host's __alloca */ +#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} + +/* Have host's __ashldi3 */ +#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} + +/* Have host's __ashrdi3 */ +#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} + +/* Have host's __chkstk */ +#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} + +/* Have host's __cmpdi2 */ +#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} + +/* Have host's __divdi3 */ +#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} + +/* Have host's __fixsfdi */ +#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} + +/* Have host's __floatdidf */ +#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} + +/* Have host's __lshrdi3 */ +#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} + +/* Have host's __main */ +#cmakedefine HAVE___MAIN ${HAVE___MAIN} + +/* Have host's __moddi3 */ +#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} + +/* Have host's __udivdi3 */ +#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} + +/* Have host's __umoddi3 */ +#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} + +/* Have host's ___chkstk */ +#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Sat Feb 5 09:11:53 2011 @@ -476,9 +476,57 @@ /* Define if the xdot.py program is available */ #undef HAVE_XDOT_PY +/* Have host's _alloca */ +#undef HAVE__ALLOCA + +/* Have host's __alloca */ +#undef HAVE___ALLOCA + +/* Have host's __ashldi3 */ +#undef HAVE___ASHLDI3 + +/* Have host's __ashrdi3 */ +#undef HAVE___ASHRDI3 + +/* Have host's __chkstk */ +#undef HAVE___CHKSTK + +/* Have host's __cmpdi2 */ +#undef HAVE___CMPDI2 + +/* Have host's __divdi3 */ +#undef HAVE___DIVDI3 + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE +/* Have host's __fixdfdi */ +#undef HAVE___FIXDFDI + +/* Have host's __fixsfdi */ +#undef HAVE___FIXSFDI + +/* Have host's __floatdidf */ +#undef HAVE___FLOATDIDF + +/* Have host's __lshrdi3 */ +#undef HAVE___LSHRDI3 + +/* Have host's __main */ +#undef HAVE___MAIN + +/* Have host's __moddi3 */ +#undef HAVE___MODDI3 + +/* Have host's __udivdi3 */ +#undef HAVE___UDIVDI3 + +/* Have host's __umoddi3 */ +#undef HAVE___UMODDI3 + +/* Have host's ___chkstk */ +#undef HAVE____CHKSTK + /* Linker version detected at compile time. */ #undef HOST_LINK_VERSION Modified: llvm/trunk/lib/Support/Windows/DynamicLibrary.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/DynamicLibrary.inc?rev=124950&r1=124949&r2=124950&view=diff ============================================================================== --- llvm/trunk/lib/Support/Windows/DynamicLibrary.inc (original) +++ llvm/trunk/lib/Support/Windows/DynamicLibrary.inc Sat Feb 5 09:11:53 2011 @@ -110,35 +110,14 @@ // Stack probing routines are in the support library (e.g. libgcc), but we don't // have dynamic linking on windows. Provide a hook. -#if defined(__MINGW32__) || defined (_MSC_VER) - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return (void*)&SYM - #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ - if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO - #define EXPLICIT_SYMBOL_DEF(SYM) \ - extern "C" { extern void *SYM; } - - #if defined(__MINGW32__) - EXPLICIT_SYMBOL_DEF(_alloca) - EXPLICIT_SYMBOL_DEF(__main) - EXPLICIT_SYMBOL_DEF(__ashldi3) - EXPLICIT_SYMBOL_DEF(__ashrdi3) - EXPLICIT_SYMBOL_DEF(__cmpdi2) - EXPLICIT_SYMBOL_DEF(__divdi3) - EXPLICIT_SYMBOL_DEF(__fixdfdi) - EXPLICIT_SYMBOL_DEF(__fixsfdi) - EXPLICIT_SYMBOL_DEF(__fixunsdfdi) - EXPLICIT_SYMBOL_DEF(__fixunssfdi) - EXPLICIT_SYMBOL_DEF(__floatdidf) - EXPLICIT_SYMBOL_DEF(__floatdisf) - EXPLICIT_SYMBOL_DEF(__lshrdi3) - EXPLICIT_SYMBOL_DEF(__moddi3) - EXPLICIT_SYMBOL_DEF(__udivdi3) - EXPLICIT_SYMBOL_DEF(__umoddi3) - #elif defined(_MSC_VER) - EXPLICIT_SYMBOL_DEF(_alloca_probe) - #endif -#endif +#define EXPLICIT_SYMBOL(SYM) \ + extern "C" { extern void *SYM; } +#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) EXPLICIT_SYMBOL(SYMTO) + +#include "explicit_symbols.inc" + +#undef EXPLICIT_SYMBOL +#undef EXPLICIT_SYMBOL2 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { // First check symbols added via AddSymbol(). @@ -159,39 +138,17 @@ } } -#if defined(__MINGW32__) - { - EXPLICIT_SYMBOL(_alloca); - EXPLICIT_SYMBOL(__main); - EXPLICIT_SYMBOL(__ashldi3); - EXPLICIT_SYMBOL(__ashrdi3); - EXPLICIT_SYMBOL(__cmpdi2); - EXPLICIT_SYMBOL(__divdi3); - EXPLICIT_SYMBOL(__fixdfdi); - EXPLICIT_SYMBOL(__fixsfdi); - EXPLICIT_SYMBOL(__fixunsdfdi); - EXPLICIT_SYMBOL(__fixunssfdi); - EXPLICIT_SYMBOL(__floatdidf); - EXPLICIT_SYMBOL(__floatdisf); - EXPLICIT_SYMBOL(__lshrdi3); - EXPLICIT_SYMBOL(__moddi3); - EXPLICIT_SYMBOL(__udivdi3); - EXPLICIT_SYMBOL(__umoddi3); + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return (void*)&SYM; + #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ + if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO; - EXPLICIT_SYMBOL2(alloca, _alloca); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF - } -#elif defined(_MSC_VER) { - EXPLICIT_SYMBOL2(alloca, _alloca_probe); - EXPLICIT_SYMBOL2(_alloca, _alloca_probe); -#undef EXPLICIT_SYMBOL -#undef EXPLICIT_SYMBOL2 -#undef EXPLICIT_SYMBOL_DEF + #include "explicit_symbols.inc" } -#endif + + #undef EXPLICIT_SYMBOL + #undef EXPLICIT_SYMBOL2 return 0; } Added: llvm/trunk/lib/Support/Windows/explicit_symbols.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/explicit_symbols.inc?rev=124950&view=auto ============================================================================== --- llvm/trunk/lib/Support/Windows/explicit_symbols.inc (added) +++ llvm/trunk/lib/Support/Windows/explicit_symbols.inc Sat Feb 5 09:11:53 2011 @@ -0,0 +1,66 @@ +/* in libgcc.a */ + +#ifdef HAVE__ALLOCA + EXPLICIT_SYMBOL(_alloca) + EXPLICIT_SYMBOL2(alloca, _alloca); +#endif +#ifdef HAVE___ALLOCA + EXPLICIT_SYMBOL(__alloca) +#endif +#ifdef HAVE___CHKSTK + EXPLICIT_SYMBOL(__chkstk) +#endif +#ifdef HAVE____CHKSTK + EXPLICIT_SYMBOL(___chkstk) +#endif +#ifdef HAVE___MAIN + EXPLICIT_SYMBOL(__main) // FIXME: Don't call it. +#endif + +#ifdef HAVE___ASHLDI3 + EXPLICIT_SYMBOL(__ashldi3) +#endif +#ifdef HAVE___ASHRDI3 + EXPLICIT_SYMBOL(__ashrdi3) +#endif +#ifdef HAVE___CMPDI2 // FIXME: unused + EXPLICIT_SYMBOL(__cmpdi2) +#endif +#ifdef HAVE___DIVDI3 + EXPLICIT_SYMBOL(__divdi3) +#endif +#ifdef HAVE___FIXDFDI + EXPLICIT_SYMBOL(__fixdfdi) +#endif +#ifdef HAVE___FIXSFDI + EXPLICIT_SYMBOL(__fixsfdi) +#endif +#ifdef HAVE___FIXUNSDFDI + EXPLICIT_SYMBOL(__fixunsdfdi) +#endif +#ifdef HAVE___FIXUNSSFDI + EXPLICIT_SYMBOL(__fixunssfdi) +#endif +#ifdef HAVE___FLOATDIDF + EXPLICIT_SYMBOL(__floatdidf) +#endif +#ifdef HAVE___FLOATDISF + EXPLICIT_SYMBOL(__floatdisf) +#endif +#ifdef HAVE___LSHRDI3 + EXPLICIT_SYMBOL(__lshrdi3) +#endif +#ifdef HAVE___MODDI3 + EXPLICIT_SYMBOL(__moddi3) +#endif +#ifdef HAVE___UDIVDI3 + EXPLICIT_SYMBOL(__udivdi3) +#endif +#ifdef HAVE___UMODDI3 + EXPLICIT_SYMBOL(__umoddi3) +#endif + +/* msvcrt */ +#if defined(_MSC_VER) + EXPLICIT_SYMBOL2(alloca, _alloca_probe); +#endif From andersca at mac.com Sat Feb 5 12:19:35 2011 From: andersca at mac.com (Anders Carlsson) Date: Sat, 05 Feb 2011 18:19:35 -0000 Subject: [llvm-commits] [llvm] r124960 - /llvm/trunk/lib/Support/Triple.cpp Message-ID: <20110205181935.59C202A6C12C@llvm.org> Author: andersca Date: Sat Feb 5 12:19:35 2011 New Revision: 124960 URL: http://llvm.org/viewvc/llvm-project?rev=124960&view=rev Log: Fix a clang warning. Modified: llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=124960&r1=124959&r2=124960&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Sat Feb 5 12:19:35 2011 @@ -468,7 +468,8 @@ if (CurrentComponent.empty()) break; // Advance to the next component, skipping any fixed components. - while (++i < array_lengthof(Found) && Found[i]); + while (++i < array_lengthof(Found) && Found[i]) + ; } // The last component was pushed off the end - append it. if (!CurrentComponent.empty()) From andersca at mac.com Sat Feb 5 12:33:43 2011 From: andersca at mac.com (Anders Carlsson) Date: Sat, 05 Feb 2011 18:33:43 -0000 Subject: [llvm-commits] [llvm] r124961 - /llvm/trunk/lib/Analysis/InstructionSimplify.cpp Message-ID: <20110205183343.C7FB62A6C12C@llvm.org> Author: andersca Date: Sat Feb 5 12:33:43 2011 New Revision: 124961 URL: http://llvm.org/viewvc/llvm-project?rev=124961&view=rev Log: Fix another warning. Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124961&r1=124960&r2=124961&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Sat Feb 5 12:33:43 2011 @@ -780,7 +780,7 @@ /// SimplifyDiv - Given operands for an SDiv or UDiv, see if we can /// fold the result. If not, this returns null. -static Value *SimplifyDiv(unsigned Opcode, Value *Op0, Value *Op1, +static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1, const TargetData *TD, const DominatorTree *DT, unsigned MaxRecurse) { if (Constant *C0 = dyn_cast(Op0)) { From aggarwa4 at illinois.edu Sat Feb 5 12:37:37 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 18:37:37 -0000 Subject: [llvm-commits] [poolalloc] r124962 - /poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Message-ID: <20110205183738.061732A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 12:37:37 2011 New Revision: 124962 URL: http://llvm.org/viewvc/llvm-project?rev=124962&view=rev Log: If the function is used in a store, it is to be considered address taken. Fixes lit test failure. Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=124962&r1=124961&r2=124962&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original) +++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Sat Feb 5 12:37:37 2011 @@ -39,6 +39,8 @@ static bool isAddressTaken(Value* V) { for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { User *U = *I; + if(isa(U)) + return true; if(U->getNumUses() == 0) continue; if (!isa(U) && !isa(U)) { From aggarwa4 at illinois.edu Sat Feb 5 12:39:24 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 18:39:24 -0000 Subject: [llvm-commits] [poolalloc] r124963 - /poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll Message-ID: <20110205183925.019A92A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 12:39:24 2011 New Revision: 124963 URL: http://llvm.org/viewvc/llvm-project?rev=124963&view=rev Log: Remove the -analyze flag, so as to not generate output. Fixes lit test failure. Modified: poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll Modified: poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll?rev=124963&r1=124962&r2=124963&view=diff ============================================================================== --- poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll (original) +++ poolalloc/trunk/test/dsa/regression/2010-08-19-SimpleCallGraph.ll Sat Feb 5 12:39:24 2011 @@ -1,6 +1,6 @@ ; ModuleID = 'test.c' -; RUN: dsaopt %s -calltarget -analyze -; RUN: dsaopt %s -calltarget -dsa-no-filter-callcc=false -analyze +; RUN: dsaopt %s -calltarget +; RUN: dsaopt %s -calltarget -dsa-no-filter-callcc=false target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-darwin10.4" From aggarwa4 at illinois.edu Sat Feb 5 12:41:25 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 18:41:25 -0000 Subject: [llvm-commits] [poolalloc] r124964 - in /poolalloc/trunk: include/dsa/CallTargets.h lib/DSA/CallTargets.cpp Message-ID: <20110205184125.4D0A42A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 12:41:25 2011 New Revision: 124964 URL: http://llvm.org/viewvc/llvm-project?rev=124964&view=rev Log: Better handling of what is an indirect call. Ignore cases which have a casted function being called. Treat External nodes, as Incomplete nodes. Modified: poolalloc/trunk/include/dsa/CallTargets.h poolalloc/trunk/lib/DSA/CallTargets.cpp Modified: poolalloc/trunk/include/dsa/CallTargets.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/CallTargets.h?rev=124964&r1=124963&r2=124964&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/CallTargets.h (original) +++ poolalloc/trunk/include/dsa/CallTargets.h Sat Feb 5 12:41:25 2011 @@ -43,6 +43,7 @@ // Given a CallSite, get an iterator of callees std::vector::iterator begin(CallSite cs); std::vector::iterator end(CallSite cs); + unsigned size(CallSite cs); // Iterate over CallSites in program std::list::iterator cs_begin(); Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=124964&r1=124963&r2=124964&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CallTargets.cpp (original) +++ poolalloc/trunk/lib/DSA/CallTargets.cpp Sat Feb 5 12:41:25 2011 @@ -63,8 +63,8 @@ if (!CF) CF = dyn_cast(cs.getCalledValue()->stripPointerCasts()); - Value * calledValue = cs.getCalledValue()->stripPointerCasts(); if (!CF) { + Value * calledValue = cs.getCalledValue()->stripPointerCasts(); if (isa(calledValue)) { ++DirCall; CompleteSites.insert(cs); @@ -101,14 +101,14 @@ ->getNodeForValue(cs.getCalledValue()).getNode(); assert (N && "CallTarget: findIndTargets: No DSNode!\n"); - if (N->isCompleteNode() && IndMap[cs].size()) { + if (!N->isIncompleteNode() && !N->isExternalNode() && IndMap[cs].size()) { CompleteSites.insert(cs); ++CompleteInd; } - if (N->isCompleteNode() && !IndMap[cs].size()) { + if (!N->isIncompleteNode() && !N->isExternalNode() && !IndMap[cs].size()) { ++CompleteEmpty; DEBUG(errs() << "Call site empty: '" - << cs.getInstruction()->getName() + << cs.getInstruction()->getName() << "' In '" << cs.getInstruction()->getParent()->getParent()->getName() << "'\n"); @@ -116,7 +116,7 @@ } } else { ++DirCall; - IndMap[cs].push_back(cs.getCalledFunction()); + IndMap[cs].push_back(CF); CompleteSites.insert(cs); } } @@ -128,7 +128,11 @@ for (std::map >::const_iterator ii = IndMap.begin(), ee = IndMap.end(); ii != ee; ++ii) { - if (!ii->first.getCalledFunction()) { //only print indirect + + if (ii->first.getCalledFunction()) //only print indirect + continue; + if(isa(ii->first.getCalledValue()->stripPointerCasts())) + continue; if (!isComplete(ii->first)) { O << "* "; CallSite cs = ii->first; @@ -142,7 +146,6 @@ O << " " << (*i)->getNameStr(); } O << "\n"; - } } } @@ -163,6 +166,9 @@ std::vector::iterator CallTargetFinder::end(CallSite cs) { return IndMap[cs].end(); } +unsigned CallTargetFinder::size(CallSite cs) { + return IndMap[cs].size(); +} bool CallTargetFinder::isComplete(CallSite cs) const { return CompleteSites.find(cs) != CompleteSites.end(); From aggarwa4 at illinois.edu Sat Feb 5 12:41:59 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 18:41:59 -0000 Subject: [llvm-commits] [poolalloc] r124965 - /poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp Message-ID: <20110205184159.1490E2A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 12:41:58 2011 New Revision: 124965 URL: http://llvm.org/viewvc/llvm-project?rev=124965&view=rev Log: The callgraph construction seems redundant. Already happens and end of BU. Modified: poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp Modified: poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp?rev=124965&r1=124964&r2=124965&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp (original) +++ poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp Sat Feb 5 12:41:58 2011 @@ -52,8 +52,7 @@ for (Module::iterator F = M.begin(); F != M.end(); ++F) { if (!(F->isDeclaration())){ - DSGraph *Graph = getOrCreateGraph(F); - Graph->buildCompleteCallGraph(callgraph, GlobalFunctionList, filterCallees); + getOrCreateGraph(F); } } callgraph.buildSCCs(); From aggarwa4 at illinois.edu Sat Feb 5 12:43:51 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sat, 05 Feb 2011 18:43:51 -0000 Subject: [llvm-commits] [poolalloc] r124966 - /poolalloc/trunk/lib/AssistDS/Devirt.cpp Message-ID: <20110205184351.117FA2A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 12:43:50 2011 New Revision: 124966 URL: http://llvm.org/viewvc/llvm-project?rev=124966&view=rev Log: Changed some formatting. No functionality change. Modified: poolalloc/trunk/lib/AssistDS/Devirt.cpp Modified: poolalloc/trunk/lib/AssistDS/Devirt.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/Devirt.cpp?rev=124966&r1=124965&r2=124966&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/Devirt.cpp (original) +++ poolalloc/trunk/lib/AssistDS/Devirt.cpp Sat Feb 5 12:43:50 2011 @@ -140,7 +140,6 @@ // module. // ++FuncAdded; - // // Create a bounce function that has a function signature almost identical // to the function being called. The only difference is that it will have @@ -192,7 +191,6 @@ // Create the basic block for doing the direct call BasicBlock* BL = BasicBlock::Create (M->getContext(), FL->getName(), F); targets[FL] = BL; - // Create the direct function call Value* directCall = CallInst::Create ((Value *)FL, fargs.begin(), @@ -294,13 +292,13 @@ // // Find the targets of the indirect function call. // - std::vector Targets; - Targets.insert (Targets.begin(), CTF->begin(CS), CTF->end(CS)); // // Convert the call site if there were any function call targets found. // - if (Targets.size() > 0) { + if (CTF->size(CS)) { + std::vector Targets; + Targets.insert (Targets.begin(), CTF->begin(CS), CTF->end(CS)); // // Determine if an existing bounce function can be used for this call site. // From ofv at wanadoo.es Sat Feb 5 13:08:42 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Sat, 05 Feb 2011 19:08:42 -0000 Subject: [llvm-commits] [llvm] r124968 - in /llvm/trunk: CMakeLists.txt cmake/modules/HandleLLVMOptions.cmake Message-ID: <20110205190842.5F2EC2A6C12C@llvm.org> Author: ofv Date: Sat Feb 5 13:08:42 2011 New Revision: 124968 URL: http://llvm.org/viewvc/llvm-project?rev=124968&view=rev Log: Moved more stuff to HandleLLVMOptions.cmake Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=124968&r1=124967&r2=124968&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Sat Feb 5 13:08:42 2011 @@ -34,20 +34,6 @@ Please delete them.") endif() -# Run-time build mode; It is used for unittests. -if(MSVC_IDE) - # Expect "$(Configuration)", "$(OutDir)", etc. - # It is expanded by msbuild or similar. - set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}") -elseif(NOT CMAKE_BUILD_TYPE STREQUAL "") - # Expect "Release" "Debug", etc. - # Or unittests could not run. - set(RUNTIME_BUILD_MODE ${CMAKE_BUILD_TYPE}) -else() - # It might be "." - set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}") -endif() - string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -118,13 +104,6 @@ set(LLVM_TARGET_ARCH "host" CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.") -set(LIT_ARGS_DEFAULT "-sv") -if (MSVC OR XCODE) - set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") -endif() -set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" - CACHE STRING "Default options for lit") - option(LLVM_ENABLE_THREADS "Use threads if available." ON) if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=124968&r1=124967&r2=124968&view=diff ============================================================================== --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original) +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Sat Feb 5 13:08:42 2011 @@ -1,5 +1,26 @@ include(AddLLVMDefinitions) +# Run-time build mode; It is used for unittests. +if(MSVC_IDE) + # Expect "$(Configuration)", "$(OutDir)", etc. + # It is expanded by msbuild or similar. + set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}") +elseif(NOT CMAKE_BUILD_TYPE STREQUAL "") + # Expect "Release" "Debug", etc. + # Or unittests could not run. + set(RUNTIME_BUILD_MODE ${CMAKE_BUILD_TYPE}) +else() + # It might be "." + set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}") +endif() + +set(LIT_ARGS_DEFAULT "-sv") +if (MSVC OR XCODE) + set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") +endif() +set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" + CACHE STRING "Default options for lit") + if( LLVM_ENABLE_ASSERTIONS ) # MSVC doesn't like _DEBUG on release builds. See PR 4379. if( NOT MSVC ) From nicholas at mxc.ca Sat Feb 5 21:02:04 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 05 Feb 2011 19:02:04 -0800 Subject: [llvm-commits] [poolalloc] r124877 - /poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp In-Reply-To: <20110204175148.638F32A6C12C@llvm.org> References: <20110204175148.638F32A6C12C@llvm.org> Message-ID: <4D4E0F2C.4060008@mxc.ca> Arushi Aggarwal wrote: > Author: aggarwa4 > Date: Fri Feb 4 11:51:48 2011 > New Revision: 124877 > > URL: http://llvm.org/viewvc/llvm-project?rev=124877&view=rev > Log: > Do not care about users, that are never used. > > Modified: > poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp > > Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=124877&r1=124876&r2=124877&view=diff > ============================================================================== > --- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original) > +++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Fri Feb 4 11:51:48 2011 > @@ -39,6 +39,8 @@ > static bool isAddressTaken(Value* V) { > for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { > User *U = *I; > + if(U->getNumUses() == 0) > + continue; if (U->use_empty()) continue; Nick > if (!isa(U)&& !isa(U)) { > if(isa(U)) { > if(isAddressTaken(U)) > @@ -53,9 +55,8 @@ > // are never used > } else { > llvm::CallSite CS(cast(U)); > - if (!CS.isCallee(I)) { > + if (!CS.isCallee(I)) > return true; > - } > } > } > return false; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicholas at mxc.ca Sat Feb 5 22:33:50 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 06 Feb 2011 04:33:50 -0000 Subject: [llvm-commits] [llvm] r124976 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <20110206043350.A289D2A6C12C@llvm.org> Author: nicholas Date: Sat Feb 5 22:33:50 2011 New Revision: 124976 URL: http://llvm.org/viewvc/llvm-project?rev=124976&view=rev Log: Remove specialized comparison of InlineAsm objects. They're uniqued on creation now, and this wasn't comparing some of their relevant bits anyhow. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=124976&r1=124975&r2=124976&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sat Feb 5 22:33:50 2011 @@ -389,12 +389,8 @@ C1 == ConstantExpr::getBitCast(const_cast(C2), C1->getType()); } - if (isa(V1) && isa(V2)) { - const InlineAsm *IA1 = cast(V1); - const InlineAsm *IA2 = cast(V2); - return IA1->getAsmString() == IA2->getAsmString() && - IA1->getConstraintString() == IA2->getConstraintString(); - } + if (isa(V1) || isa(V2)) + return V1 == V2; unsigned long &ID1 = Map1[V1]; if (!ID1) From nicholas at mxc.ca Sat Feb 5 23:04:00 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 06 Feb 2011 05:04:00 -0000 Subject: [llvm-commits] [llvm] r124977 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <20110206050400.F0A132A6C12C@llvm.org> Author: nicholas Date: Sat Feb 5 23:04:00 2011 New Revision: 124977 URL: http://llvm.org/viewvc/llvm-project?rev=124977&view=rev Log: Simplify away redundant test, and document what's going on. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=124977&r1=124976&r2=124977&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sat Feb 5 23:04:00 2011 @@ -284,6 +284,10 @@ // Instruction::isSameOperationAs. bool FunctionComparator::isEquivalentOperation(const Instruction *I1, const Instruction *I2) const { + // Differences from Instruction::isSameOperationAs: + // * replace type comparison with calls to isEquivalentType. + // * we test for I->hasSameSubclassOptionalData (nuw/nsw/tail) at the top + // * because of the above, we don't test for the tail bit on calls later on if (I1->getOpcode() != I2->getOpcode() || I1->getNumOperands() != I2->getNumOperands() || !isEquivalentType(I1->getType(), I2->getType()) || @@ -307,8 +311,7 @@ if (const CmpInst *CI = dyn_cast(I1)) return CI->getPredicate() == cast(I2)->getPredicate(); if (const CallInst *CI = dyn_cast(I1)) - return CI->isTailCall() == cast(I2)->isTailCall() && - CI->getCallingConv() == cast(I2)->getCallingConv() && + return CI->getCallingConv() == cast(I2)->getCallingConv() && CI->getAttributes() == cast(I2)->getAttributes(); if (const InvokeInst *CI = dyn_cast(I1)) return CI->getCallingConv() == cast(I2)->getCallingConv() && From aggarwa4 at illinois.edu Sat Feb 5 23:07:23 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sun, 06 Feb 2011 05:07:23 -0000 Subject: [llvm-commits] [poolalloc] r124978 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <20110206050723.407612A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 23:07:23 2011 New Revision: 124978 URL: http://llvm.org/viewvc/llvm-project?rev=124978&view=rev Log: Minor refactoring. Check type of return value, before trying to add flags. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=124978&r1=124977&r2=124978&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Sat Feb 5 23:07:23 2011 @@ -360,32 +360,33 @@ // Set the read, write, and heap markers on the return value // as appropriate. // - if (recFuncs[x].action.read[0]) - Graph->getNodeForValue(CI).getNode()->setReadMarker(); - if (recFuncs[x].action.write[0]) - Graph->getNodeForValue(CI).getNode()->setModifiedMarker(); - if (recFuncs[x].action.heap[0]) - Graph->getNodeForValue(CI).getNode()->setHeapMarker(); + if(isa((CI)->getType())){ + if(Graph->hasNodeForValue(CI)){ + if (recFuncs[x].action.read[0]) + Graph->getNodeForValue(CI).getNode()->setReadMarker(); + if (recFuncs[x].action.write[0]) + Graph->getNodeForValue(CI).getNode()->setModifiedMarker(); + if (recFuncs[x].action.heap[0]) + Graph->getNodeForValue(CI).getNode()->setHeapMarker(); + } + } // // Set the read, write, and heap markers on the actual arguments // as appropriate. // for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.read[y]) - if (isa(CI->getOperand(y)->getType())) - if (Graph->hasNodeForValue(CI->getOperand(y))) - Graph->getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker(); - for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.write[y]) - if (isa(CI->getOperand(y)->getType())) - if (Graph->hasNodeForValue(CI->getOperand(y))) - Graph->getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker(); - for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.heap[y]) - if (isa(CI->getOperand(y)->getType())) - if (Graph->hasNodeForValue(CI->getOperand(y))) - Graph->getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker(); + if (isa(CI->getOperand(y)->getType())){ + if (Graph->hasNodeForValue(CI->getOperand(y))){ + if (recFuncs[x].action.read[y]) + Graph->getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker(); + if (recFuncs[x].action.write[y]) + Graph->getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker(); + if (recFuncs[x].action.heap[y]) + Graph->getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker(); + } + } + // // Merge the DSNoes for return values and parameters as @@ -433,32 +434,32 @@ // Set the read, write, and heap markers on the return value // as appropriate. // - if (recFuncs[x].action.read[0]) - Graph->getNodeForValue(CI).getNode()->setReadMarker(); - if (recFuncs[x].action.write[0]) - Graph->getNodeForValue(CI).getNode()->setModifiedMarker(); - if (recFuncs[x].action.heap[0]) - Graph->getNodeForValue(CI).getNode()->setHeapMarker(); + if(isa((CI)->getType())){ + if(Graph->hasNodeForValue(CI)){ + if (recFuncs[x].action.read[0]) + Graph->getNodeForValue(CI).getNode()->setReadMarker(); + if (recFuncs[x].action.write[0]) + Graph->getNodeForValue(CI).getNode()->setModifiedMarker(); + if (recFuncs[x].action.heap[0]) + Graph->getNodeForValue(CI).getNode()->setHeapMarker(); + } + } // // Set the read, write, and heap markers on the actual arguments // as appropriate. // for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.read[y]) - if (isa(CI->getOperand(y)->getType())) + if (recFuncs[x].action.read[y]){ + if (isa(CI->getOperand(y)->getType())){ if (Graph->hasNodeForValue(CI->getOperand(y))) Graph->getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker(); - for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.write[y]) - if (isa(CI->getOperand(y)->getType())) if (Graph->hasNodeForValue(CI->getOperand(y))) Graph->getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker(); - for (unsigned y = 1; y < CI->getNumOperands(); ++y) - if (recFuncs[x].action.heap[y]) - if (isa(CI->getOperand(y)->getType())) if (Graph->hasNodeForValue(CI->getOperand(y))) Graph->getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker(); + } + } // // Merge the DSNoes for return values and parameters as From aggarwa4 at illinois.edu Sat Feb 5 23:11:56 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Sun, 06 Feb 2011 05:11:56 -0000 Subject: [llvm-commits] [poolalloc] r124979 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <20110206051156.E6EAD2A6C12C@llvm.org> Author: aggarwa4 Date: Sat Feb 5 23:11:56 2011 New Revision: 124979 URL: http://llvm.org/viewvc/llvm-project?rev=124979&view=rev Log: Make sure that a node exists for the return value, before merging or folding. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=124979&r1=124978&r2=124979&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Sat Feb 5 23:11:56 2011 @@ -394,6 +394,8 @@ // std::vector toMerge; if (recFuncs[x].action.mergeWithRet) + if (isa(CI->getType())) + if (Graph->hasNodeForValue(CI)) toMerge.push_back(Graph->getNodeForValue(CI)); if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet) for (unsigned y = 1; y < CI->getNumOperands(); ++y) @@ -409,7 +411,8 @@ // if (!noStdLibFold && recFuncs[x].action.collapse) { if (isa(CI->getType())){ - Graph->getNodeForValue(CI).getNode()->foldNodeCompletely(); + if (Graph->hasNodeForValue(CI)) + Graph->getNodeForValue(CI).getNode()->foldNodeCompletely(); NumNodesFoldedInStdLib++; } for (unsigned y = 1; y < CI->getNumOperands(); ++y){ @@ -467,7 +470,9 @@ // std::vector toMerge; if (recFuncs[x].action.mergeWithRet) - toMerge.push_back(Graph->getNodeForValue(CI)); + if (isa(CI->getType())) + if (Graph->hasNodeForValue(CI)) + toMerge.push_back(Graph->getNodeForValue(CI)); if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet) for (unsigned y = 1; y < CI->getNumOperands(); ++y) if (isa(CI->getOperand(y)->getType())) @@ -482,7 +487,8 @@ // if (!noStdLibFold && recFuncs[x].action.collapse) { if (isa(CI->getType())){ - Graph->getNodeForValue(CI).getNode()->foldNodeCompletely(); + if (Graph->hasNodeForValue(CI)) + Graph->getNodeForValue(CI).getNode()->foldNodeCompletely(); NumNodesFoldedInStdLib++; } for (unsigned y = 1; y < CI->getNumOperands(); ++y) From wdietz2 at illinois.edu Sat Feb 5 23:49:08 2011 From: wdietz2 at illinois.edu (Will Dietz) Date: Sun, 06 Feb 2011 05:49:08 -0000 Subject: [llvm-commits] [poolalloc] r124980 - /poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Message-ID: <20110206054908.C74B72A6C12C@llvm.org> Author: wdietz2 Date: Sat Feb 5 23:49:08 2011 New Revision: 124980 URL: http://llvm.org/viewvc/llvm-project?rev=124980&view=rev Log: Use 'use_empty' as a more direct way to query if there are any uses. Thanks, Nick! Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=124980&r1=124979&r2=124980&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original) +++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Sat Feb 5 23:49:08 2011 @@ -41,7 +41,7 @@ User *U = *I; if(isa(U)) return true; - if(U->getNumUses() == 0) + if(U->use_empty()) continue; if (!isa(U) && !isa(U)) { if(isa(U)) { From joerg at britannica.bec.de Sat Feb 5 17:34:14 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Sun, 6 Feb 2011 00:34:14 +0100 Subject: [llvm-commits] [PATCH] [MC] Support for .ifdef / .ifndef Message-ID: <20110205233414.GA12822@britannica.bec.de> Hi all, attached patch implements .ifdef / .ifndef in the assembler parser. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: asm.diff Type: text/x-diff Size: 3073 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110206/2c635788/attachment.bin From clattner at apple.com Sun Feb 6 08:14:02 2011 From: clattner at apple.com (Chris Lattner) Date: Sun, 6 Feb 2011 06:14:02 -0800 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules In-Reply-To: <20110205011355.AE9032A6C12C@llvm.org> References: <20110205011355.AE9032A6C12C@llvm.org> Message-ID: <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> On Feb 4, 2011, at 5:13 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Fri Feb 4 19:13:55 2011 > New Revision: 124922 > > URL: http://llvm.org/viewvc/llvm-project?rev=124922&view=rev > Log: > test-suite: Start sketching support for using LLVM's test-suite w/o an LLVM > source or object tree. Very cool, death to llvm! In all seriousness, there is *no* reason the llvm and testsuite makefiles should share anything. Would it also make sense to get rid of llvm/test/Frontend* tests? I don't think the C family ones (at least) are doing anything useful anymore. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110206/13af9fcb/attachment.html From clattner at apple.com Sun Feb 6 08:15:55 2011 From: clattner at apple.com (Chris Lattner) Date: Sun, 6 Feb 2011 06:15:55 -0800 Subject: [llvm-commits] [llvm] r124904 - in /llvm/trunk: include/llvm/CodeGen/MachineLocation.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/CodeGen/X86/dbg-merge-loc-entry.ll In-Reply-To: <20110204225719.099202A6C12C@llvm.org> References: <20110204225719.099202A6C12C@llvm.org> Message-ID: On Feb 4, 2011, at 2:57 PM, Devang Patel wrote: > Author: dpatel > Date: Fri Feb 4 16:57:18 2011 > New Revision: 124904 > > URL: http://llvm.org/viewvc/llvm-project?rev=124904&view=rev > Log: > Merge .debug_loc entries whenever possible to reduce debug_loc size. Very cool, however, please please please remove this testcase and replace it with something that is much smaller. This is not a unit test. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110206/19bfabe3/attachment.html From baldrick at free.fr Sun Feb 6 08:29:51 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 06 Feb 2011 15:29:51 +0100 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules In-Reply-To: <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> References: <20110205011355.AE9032A6C12C@llvm.org> <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> Message-ID: <4D4EB05F.6010105@free.fr> Hi Chris, > In all seriousness, there is *no* reason the llvm and testsuite makefiles should > share anything. Would it also make sense to get rid of llvm/test/Frontend* > tests? I don't think the C family ones (at least) are doing anything useful anymore. they are useful for llvm-gcc and dragonegg, but I suppose that just means they should be moved to the dragonegg repository. Ciao, Duncan. From clattner at apple.com Sun Feb 6 08:56:56 2011 From: clattner at apple.com (Chris Lattner) Date: Sun, 6 Feb 2011 06:56:56 -0800 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules In-Reply-To: <4D4EB05F.6010105@free.fr> References: <20110205011355.AE9032A6C12C@llvm.org> <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> <4D4EB05F.6010105@free.fr> Message-ID: <9547C4B1-A959-48CA-91EA-5870C08C7A81@apple.com> On Feb 6, 2011, at 6:29 AM, Duncan Sands wrote: > Hi Chris, > >> In all seriousness, there is *no* reason the llvm and testsuite makefiles should >> share anything. Would it also make sense to get rid of llvm/test/Frontend* >> tests? I don't think the C family ones (at least) are doing anything useful anymore. > > they are useful for llvm-gcc and dragonegg, but I suppose that just means they > should be moved to the dragonegg repository. Most of them are really old. Are they actually *useful*? Have they actually caught any bugs? -Chris From baldrick at free.fr Sun Feb 6 09:13:03 2011 From: baldrick at free.fr (Duncan Sands) Date: Sun, 06 Feb 2011 16:13:03 +0100 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules In-Reply-To: <9547C4B1-A959-48CA-91EA-5870C08C7A81@apple.com> References: <20110205011355.AE9032A6C12C@llvm.org> <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> <4D4EB05F.6010105@free.fr> <9547C4B1-A959-48CA-91EA-5870C08C7A81@apple.com> Message-ID: <4D4EBA7F.8000009@free.fr> Hi Chris, >>> In all seriousness, there is *no* reason the llvm and testsuite makefiles should >>> share anything. Would it also make sense to get rid of llvm/test/Frontend* >>> tests? I don't think the C family ones (at least) are doing anything useful anymore. >> >> they are useful for llvm-gcc and dragonegg, but I suppose that just means they >> should be moved to the dragonegg repository. > > Most of them are really old. Are they actually *useful*? Have they actually caught any bugs? actually, yes. Mostly missing dragonegg functionality, for example the lack of support for -fno-builtins (hard to fix because gcc doesn't expose this C front-end flag). Ciao, Duncan. From ofv at wanadoo.es Sun Feb 6 13:07:06 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Sun, 06 Feb 2011 19:07:06 -0000 Subject: [llvm-commits] [llvm] r124985 - /llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Message-ID: <20110206190706.3DB172A6C12C@llvm.org> Author: ofv Date: Sun Feb 6 13:07:06 2011 New Revision: 124985 URL: http://llvm.org/viewvc/llvm-project?rev=124985&view=rev Log: Don't define NDEBUG on MSVC_IDE and XCode builds. Fixes PR9155. Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=124985&r1=124984&r2=124985&view=diff ============================================================================== --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original) +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Sun Feb 6 13:07:06 2011 @@ -33,7 +33,9 @@ endif() else() if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) - add_definitions( -DNDEBUG ) + if( NOT MSVC_IDE AND NOT XCODE ) + add_definitions( -DNDEBUG ) + endif() endif() endif() From andersca at mac.com Sun Feb 6 14:11:56 2011 From: andersca at mac.com (Anders Carlsson) Date: Sun, 06 Feb 2011 20:11:56 -0000 Subject: [llvm-commits] [llvm] r124987 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/Transforms/ConstProp/loads.ll Message-ID: <20110206201156.975402A6C12C@llvm.org> Author: andersca Date: Sun Feb 6 14:11:56 2011 New Revision: 124987 URL: http://llvm.org/viewvc/llvm-project?rev=124987&view=rev Log: When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size. Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/test/Transforms/ConstProp/loads.ll Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=124987&r1=124986&r2=124987&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sun Feb 6 14:11:56 2011 @@ -340,6 +340,17 @@ return true; } + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::IntToPtr) { + uint64_t PtrSize = TD.getTypeAllocSize(C->getType()); + uint64_t IntSize = TD.getTypeAllocSize(C->getOperand(0)->getType()); + + if (PtrSize == IntSize) + return ReadDataFromGlobal(CE->getOperand(0), ByteOffset, CurPtr, + BytesLeft, TD); + } + } + // Otherwise, unknown initializer type. return false; } Modified: llvm/trunk/test/Transforms/ConstProp/loads.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/loads.ll?rev=124987&r1=124986&r2=124987&view=diff ============================================================================== --- llvm/trunk/test/Transforms/ConstProp/loads.ll (original) +++ llvm/trunk/test/Transforms/ConstProp/loads.ll Sun Feb 6 14:11:56 2011 @@ -120,3 +120,20 @@ ; CHECK: @test13 ; CHECK: ret i1 false } + + at g6 = constant [2 x i8*] [i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*)] +define i64 @test14() nounwind { +entry: + %tmp = load i64* bitcast ([2 x i8*]* @g6 to i64*) + ret i64 %tmp +; CHECK: @test14 +; CHECK: ret i64 1 +} + +define i64 @test15() nounwind { +entry: + %tmp = load i64* bitcast (i8** getelementptr inbounds ([2 x i8*]* @g6, i32 0, i64 1) to i64*) + ret i64 %tmp +; CHECK: @test15 +; CHECK: ret i64 2 +} From andersca at mac.com Sun Feb 6 14:16:49 2011 From: andersca at mac.com (Anders Carlsson) Date: Sun, 06 Feb 2011 20:16:49 -0000 Subject: [llvm-commits] [llvm] r124989 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110206201649.339EB2A6C12C@llvm.org> Author: andersca Date: Sun Feb 6 14:16:49 2011 New Revision: 124989 URL: http://llvm.org/viewvc/llvm-project?rev=124989&view=rev Log: Remove a virtual inheritance case that clang can devirtualize fully now. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=124989&r1=124988&r2=124989&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Sun Feb 6 14:16:49 2011 @@ -1866,27 +1866,6 @@ } //===---------------------------------------------------------------------===// -clang -O3 fails to devirtualize this virtual inheritance case: (GCC PR45875) -Looks related to PR3100 - -struct c1 {}; -struct c10 : c1{ - virtual void foo (); -}; -struct c11 : c10, c1{ - virtual void f6 (); -}; -struct c28 : virtual c11{ - void f6 (); -}; -void check_c28 () { - c28 obj; - c11 *ptr = &obj; - ptr->f6 (); -} - -//===---------------------------------------------------------------------===// - We compile this: int foo(int a) { return (a & (~15)) / 16; } From clattner at apple.com Sun Feb 6 14:23:52 2011 From: clattner at apple.com (Chris Lattner) Date: Sun, 6 Feb 2011 12:23:52 -0800 Subject: [llvm-commits] [test-suite] r124922 - in /test-suite/trunk: Makefile.config.in Makefile.rules In-Reply-To: <4D4EBA7F.8000009@free.fr> References: <20110205011355.AE9032A6C12C@llvm.org> <84D77FD4-3A27-4DDC-8910-4C1DDE3DDA3C@apple.com> <4D4EB05F.6010105@free.fr> <9547C4B1-A959-48CA-91EA-5870C08C7A81@apple.com> <4D4EBA7F.8000009@free.fr> Message-ID: On Feb 6, 2011, at 7:13 AM, Duncan Sands wrote: >>> they are useful for llvm-gcc and dragonegg, but I suppose that just means they >>> should be moved to the dragonegg repository. >> >> Most of them are really old. Are they actually *useful*? Have they actually caught any bugs? > > actually, yes. Mostly missing dragonegg functionality, for example the lack of > support for -fno-builtins (hard to fix because gcc doesn't expose this C > front-end flag). Ah ok. It would be really nice to move these somewhere else. These tests are a large source of confusion for people who think that llvm and llvm-gcc (or whatever frontend) have a circular dependency. Moving them to dragon egg and losing them from llvm-gcc/clang would be fine for me. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110206/139972df/attachment.html From andersca at mac.com Sun Feb 6 14:22:49 2011 From: andersca at mac.com (Anders Carlsson) Date: Sun, 06 Feb 2011 20:22:49 -0000 Subject: [llvm-commits] [llvm] r124990 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp Message-ID: <20110206202249.9D1102A6C12C@llvm.org> Author: andersca Date: Sun Feb 6 14:22:49 2011 New Revision: 124990 URL: http://llvm.org/viewvc/llvm-project?rev=124990&view=rev Log: Simplify test, as suggested by Chris. Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=124990&r1=124989&r2=124990&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sun Feb 6 14:22:49 2011 @@ -341,14 +341,10 @@ } if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::IntToPtr) { - uint64_t PtrSize = TD.getTypeAllocSize(C->getType()); - uint64_t IntSize = TD.getTypeAllocSize(C->getOperand(0)->getType()); - - if (PtrSize == IntSize) + if (CE->getOpcode() == Instruction::IntToPtr && + CE->getOperand(0)->getType() == TD.getIntPtrType(CE->getContext())) return ReadDataFromGlobal(CE->getOperand(0), ByteOffset, CurPtr, BytesLeft, TD); - } } // Otherwise, unknown initializer type. From echristo at apple.com Sun Feb 6 15:27:46 2011 From: echristo at apple.com (Eric Christopher) Date: Sun, 06 Feb 2011 21:27:46 -0000 Subject: [llvm-commits] [llvm] r124991 - /llvm/trunk/lib/Analysis/InlineCost.cpp Message-ID: <20110206212746.CC4442A6C12C@llvm.org> Author: echristo Date: Sun Feb 6 15:27:46 2011 New Revision: 124991 URL: http://llvm.org/viewvc/llvm-project?rev=124991&view=rev Log: Remove premature optimization that avoided calculating argument weights if we weren't going to inline the function. The rest of the code using this was removed. Fixes PR9154. Modified: llvm/trunk/lib/Analysis/InlineCost.cpp Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=124991&r1=124990&r2=124991&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Sun Feb 6 15:27:46 2011 @@ -242,11 +242,6 @@ if (Metrics.NumRets==1) --Metrics.NumInsts; - // Don't bother calculating argument weights if we are never going to inline - // the function anyway. - if (NeverInline()) - return; - // Check out all of the arguments to the function, figuring out how much // code can be eliminated if one of the arguments is a constant. ArgumentWeights.reserve(F->arg_size()); From sabre at nondot.org Sun Feb 6 15:44:57 2011 From: sabre at nondot.org (Chris Lattner) Date: Sun, 06 Feb 2011 21:44:57 -0000 Subject: [llvm-commits] [llvm] r124992 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Constants.h include/llvm/InstrTypes.h include/llvm/Operator.h lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/Transforms/InstCombine/InstCombineMulDivRem.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp test/Assembler/flags.ll test/Transforms/InstCombine/exact-sdiv.ll test/Transforms/InstCombine/exact.ll Message-ID: <20110206214457.DEE1A2A6C12C@llvm.org> Author: lattner Date: Sun Feb 6 15:44:57 2011 New Revision: 124992 URL: http://llvm.org/viewvc/llvm-project?rev=124992&view=rev Log: enhance vmcore to know that udiv's can be exact, and add a trivial instcombine xform to exercise this. Nothing forms exact udivs yet though. This is progress on PR8862 Added: llvm/trunk/test/Transforms/InstCombine/exact.ll - copied, changed from r124987, llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll Removed: llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/InstrTypes.h llvm/trunk/include/llvm/Operator.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/test/Assembler/flags.ll Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=124992&r1=124991&r2=124992&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sun Feb 6 15:44:57 2011 @@ -3441,7 +3441,8 @@
    Syntax:
    -  <result> = udiv <ty> <op1>, <op2>   ; yields {ty}:result
    +  <result> = udiv <ty> <op1>, <op2>         ; yields {ty}:result
    +  <result> = udiv exact <ty> <op1>, <op2>   ; yields {ty}:result
     
    Overview:
    @@ -3460,6 +3461,11 @@

    Division by zero leads to undefined behavior.

    +

    If the exact keyword is present, the result value of the + udiv is a trap value if %op1 is not a + multiple of %op2 (as such, "((a udiv exact b) mul b) == a").

    + +
    Example:
       <result> = udiv i32 4, %var          ; yields {i32}:result = 4 / %var
    
    Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
    +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Sun Feb  6 15:44:57 2011
    @@ -199,10 +199,10 @@
         OBO_NO_SIGNED_WRAP = 1
       };
     
    -  /// SDivOperatorOptionalFlags - Flags for serializing SDivOperator's
    -  /// SubclassOptionalData contents.
    -  enum SDivOperatorOptionalFlags {
    -    SDIV_EXACT = 0
    +  /// PossiblyExactOperatorOptionalFlags - Flags for serializing 
    +  /// PossiblyExactOperator's SubclassOptionalData contents.
    +  enum PossiblyExactOperatorOptionalFlags {
    +    PEO_EXACT = 0
       };
     
       // The function body block (FUNCTION_BLOCK_ID) describes function bodies.  It
    
    Modified: llvm/trunk/include/llvm/Constants.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/include/llvm/Constants.h (original)
    +++ llvm/trunk/include/llvm/Constants.h Sun Feb  6 15:44:57 2011
    @@ -725,6 +725,7 @@
       static Constant *getNSWMul(Constant *C1, Constant *C2);
       static Constant *getNUWMul(Constant *C1, Constant *C2);
       static Constant *getExactSDiv(Constant *C1, Constant *C2);
    +  static Constant *getExactUDiv(Constant *C1, Constant *C2);
     
       /// Transparently provide more efficient getOperand methods.
       DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
    
    Modified: llvm/trunk/include/llvm/InstrTypes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/include/llvm/InstrTypes.h (original)
    +++ llvm/trunk/include/llvm/InstrTypes.h Sun Feb  6 15:44:57 2011
    @@ -341,7 +341,7 @@
         BO->setIsExact(true);
         return BO;
       }
    -
    +  
       /// Helper functions to construct and inspect unary operations (NEG and NOT)
       /// via binary operators SUB and XOR:
       ///
    
    Modified: llvm/trunk/include/llvm/Operator.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/include/llvm/Operator.h (original)
    +++ llvm/trunk/include/llvm/Operator.h Sun Feb  6 15:44:57 2011
    @@ -173,30 +173,47 @@
       }
     };
     
    -/// SDivOperator - An Operator with opcode Instruction::SDiv.
    -///
    -class SDivOperator : public Operator {
    +/// PossiblyExactOperator - A udiv or sdiv instruction, which can be marked as
    +/// "exact", indicating that no bits are destroyed.
    +class PossiblyExactOperator : public Operator {
     public:
       enum {
         IsExact = (1 << 0)
       };
    -
    -private:
    -  ~SDivOperator(); // do not implement
    -
    +  
       friend class BinaryOperator;
       friend class ConstantExpr;
       void setIsExact(bool B) {
         SubclassOptionalData = (SubclassOptionalData & ~IsExact) | (B * IsExact);
       }
    -
    +  
    +private:
    +  ~PossiblyExactOperator(); // do not implement
     public:
       /// isExact - Test whether this division is known to be exact, with
       /// zero remainder.
       bool isExact() const {
         return SubclassOptionalData & IsExact;
       }
    -
    +  
    +  static inline bool classof(const ConstantExpr *CE) {
    +    return CE->getOpcode() == Instruction::SDiv ||
    +           CE->getOpcode() == Instruction::UDiv;
    +  }
    +  static inline bool classof(const Instruction *I) {
    +    return I->getOpcode() == Instruction::SDiv ||
    +           I->getOpcode() == Instruction::UDiv;
    +  }
    +  static inline bool classof(const Value *V) {
    +    return (isa(V) && classof(cast(V))) ||
    +    (isa(V) && classof(cast(V)));
    +  }
    +};
    +  
    +/// SDivOperator - An Operator with opcode Instruction::SDiv.
    +///
    +class SDivOperator : public PossiblyExactOperator {
    +public:
       // Methods for support type inquiry through isa, cast, and dyn_cast:
       static inline bool classof(const SDivOperator *) { return true; }
       static inline bool classof(const ConstantExpr *CE) {
    @@ -211,6 +228,24 @@
       }
     };
     
    +/// UDivOperator - An Operator with opcode Instruction::SDiv.
    +///
    +class UDivOperator : public PossiblyExactOperator {
    +public:
    +  // Methods for support type inquiry through isa, cast, and dyn_cast:
    +  static inline bool classof(const UDivOperator *) { return true; }
    +  static inline bool classof(const ConstantExpr *CE) {
    +    return CE->getOpcode() == Instruction::UDiv;
    +  }
    +  static inline bool classof(const Instruction *I) {
    +    return I->getOpcode() == Instruction::UDiv;
    +  }
    +  static inline bool classof(const Value *V) {
    +    return (isa(V) && classof(cast(V))) ||
    +    (isa(V) && classof(cast(V)));
    +  }
    +};
    +  
     class GEPOperator : public Operator {
       enum {
         IsInBounds = (1 << 0)
    
    Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
    +++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun Feb  6 15:44:57 2011
    @@ -2304,7 +2304,7 @@
             if (EatIfPresent(lltok::kw_nuw))
               NUW = true;
           }
    -    } else if (Opc == Instruction::SDiv) {
    +    } else if (Opc == Instruction::SDiv || Opc == Instruction::UDiv) {
           if (EatIfPresent(lltok::kw_exact))
             Exact = true;
         }
    @@ -2347,7 +2347,7 @@
         unsigned Flags = 0;
         if (NUW)   Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
         if (NSW)   Flags |= OverflowingBinaryOperator::NoSignedWrap;
    -    if (Exact) Flags |= SDivOperator::IsExact;
    +    if (Exact) Flags |= PossiblyExactOperator::IsExact;
         Constant *C = ConstantExpr::get(Opc, Val0, Val1, Flags);
         ID.ConstantVal = C;
         ID.Kind = ValID::t_Constant;
    @@ -3032,7 +3032,8 @@
       case lltok::kw_fsub:
       case lltok::kw_fmul:    return ParseArithmetic(Inst, PFS, KeywordVal, 2);
     
    -  case lltok::kw_sdiv: {
    +  case lltok::kw_sdiv:
    +  case lltok::kw_udiv: {
         bool Exact = false;
         if (EatIfPresent(lltok::kw_exact))
           Exact = true;
    @@ -3043,7 +3044,6 @@
         return Result;
       }
     
    -  case lltok::kw_udiv:
       case lltok::kw_urem:
       case lltok::kw_srem:   return ParseArithmetic(Inst, PFS, KeywordVal, 1);
       case lltok::kw_fdiv:
    
    Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
    +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Feb  6 15:44:57 2011
    @@ -1090,8 +1090,9 @@
                   Flags |= OverflowingBinaryOperator::NoSignedWrap;
                 if (Record[3] & (1 << bitc::OBO_NO_UNSIGNED_WRAP))
                   Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
    -          } else if (Opc == Instruction::SDiv) {
    -            if (Record[3] & (1 << bitc::SDIV_EXACT))
    +          } else if (Opc == Instruction::SDiv ||
    +                     Opc == Instruction::UDiv) {
    +            if (Record[3] & (1 << bitc::PEO_EXACT))
                   Flags |= SDivOperator::IsExact;
               }
             }
    @@ -1905,8 +1906,9 @@
                 cast(I)->setHasNoSignedWrap(true);
               if (Record[OpNum] & (1 << bitc::OBO_NO_UNSIGNED_WRAP))
                 cast(I)->setHasNoUnsignedWrap(true);
    -        } else if (Opc == Instruction::SDiv) {
    -          if (Record[OpNum] & (1 << bitc::SDIV_EXACT))
    +        } else if (Opc == Instruction::SDiv ||
    +                   Opc == Instruction::UDiv) {
    +          if (Record[OpNum] & (1 << bitc::PEO_EXACT))
                 cast(I)->setIsExact(true);
             }
           }
    
    Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
    +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Sun Feb  6 15:44:57 2011
    @@ -470,9 +470,10 @@
           Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP;
         if (OBO->hasNoUnsignedWrap())
           Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP;
    -  } else if (const SDivOperator *Div = dyn_cast(V)) {
    -    if (Div->isExact())
    -      Flags |= 1 << bitc::SDIV_EXACT;
    +  } else if (const PossiblyExactOperator *PEO =
    +               dyn_cast(V)) {
    +    if (PEO->isExact())
    +      Flags |= 1 << bitc::PEO_EXACT;
       }
     
       return Flags;
    
    Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
    +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Sun Feb  6 15:44:57 2011
    @@ -135,8 +135,8 @@
              BO->getOpcode() == Instruction::SDiv)) {
           Value *Op0BO = BO->getOperand(0), *Op1BO = BO->getOperand(1);
     
    -      // If the division is exact, X % Y is zero.
    -      if (SDivOperator *SDiv = dyn_cast(BO))
    +      // If the division is exact, X % Y is zero, so we end up with X or -X.
    +      if (PossiblyExactOperator *SDiv = dyn_cast(BO))
             if (SDiv->isExact()) {
               if (Op1BO == Op1C)
                 return ReplaceInstUsesWith(I, Op0BO);
    
    Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
    +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sun Feb  6 15:44:57 2011
    @@ -831,7 +831,8 @@
           Out << " nuw";
         if (OBO->hasNoSignedWrap())
           Out << " nsw";
    -  } else if (const SDivOperator *Div = dyn_cast(U)) {
    +  } else if (const PossiblyExactOperator *Div =
    +               dyn_cast(U)) {
         if (Div->isExact())
           Out << " exact";
       } else if (const GEPOperator *GEP = dyn_cast(U)) {
    
    Modified: llvm/trunk/lib/VMCore/Constants.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/VMCore/Constants.cpp (original)
    +++ llvm/trunk/lib/VMCore/Constants.cpp Sun Feb  6 15:44:57 2011
    @@ -683,7 +683,12 @@
     
     Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) {
       return getTy(C1->getType(), Instruction::SDiv, C1, C2,
    -               SDivOperator::IsExact);
    +               PossiblyExactOperator::IsExact);
    +}
    +
    +Constant* ConstantExpr::getExactUDiv(Constant* C1, Constant* C2) {
    +  return getTy(C1->getType(), Instruction::UDiv, C1, C2,
    +               PossiblyExactOperator::IsExact);
     }
     
     // Utility function for determining if a ConstantExpr is a CastOp or not. This
    
    Modified: llvm/trunk/lib/VMCore/Instructions.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
    +++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Feb  6 15:44:57 2011
    @@ -1822,7 +1822,7 @@
     }
     
     void BinaryOperator::setIsExact(bool b) {
    -  cast(this)->setIsExact(b);
    +  cast(this)->setIsExact(b);
     }
     
     bool BinaryOperator::hasNoUnsignedWrap() const {
    @@ -1834,7 +1834,7 @@
     }
     
     bool BinaryOperator::isExact() const {
    -  return cast(this)->isExact();
    +  return cast(this)->isExact();
     }
     
     //===----------------------------------------------------------------------===//
    
    Modified: llvm/trunk/test/Assembler/flags.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags.ll?rev=124992&r1=124991&r2=124992&view=diff
    ==============================================================================
    --- llvm/trunk/test/Assembler/flags.ll (original)
    +++ llvm/trunk/test/Assembler/flags.ll Sun Feb  6 15:44:57 2011
    @@ -104,6 +104,19 @@
     	ret i64 %z
     }
     
    +define i64 @udiv_exact(i64 %x, i64 %y) {
    +; CHECK: %z = udiv exact i64 %x, %y
    +	%z = udiv exact i64 %x, %y
    +	ret i64 %z
    +}
    +
    +define i64 @udiv_plain(i64 %x, i64 %y) {
    +; CHECK: %z = udiv i64 %x, %y
    +	%z = udiv i64 %x, %y
    +	ret i64 %z
    +}
    +
    +
     define i64* @gep_nw(i64* %p, i64 %x) {
     ; CHECK: %z = getelementptr inbounds i64* %p, i64 %x
     	%z = getelementptr inbounds i64* %p, i64 %x
    @@ -136,6 +149,11 @@
     	ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
     }
     
    +define i64 @udiv_exact_ce() {
    +; CHECK: ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
    +	ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
    +}
    +
     define i64* @gep_nw_ce() {
     ; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171)
             ret i64* getelementptr inbounds (i64* @addr, i64 171)
    @@ -210,3 +228,4 @@
     ; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
     	ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
     }
    +
    
    Removed: llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll?rev=124991&view=auto
    ==============================================================================
    --- llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll (original)
    +++ llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll (removed)
    @@ -1,52 +0,0 @@
    -; RUN: opt < %s -instcombine -S | FileCheck %s
    -
    -; CHECK: define i32 @foo
    -; CHECK: sdiv i32 %x, 8
    -define i32 @foo(i32 %x) {
    -  %y = sdiv i32 %x, 8
    -  ret i32 %y
    -}
    -
    -; CHECK: define i32 @bar
    -; CHECK: ashr i32 %x, 3
    -define i32 @bar(i32 %x) {
    -  %y = sdiv exact i32 %x, 8
    -  ret i32 %y
    -}
    -
    -; CHECK: i32 @a0
    -; CHECK: %y = srem i32 %x, 3
    -; CHECK: %z = sub i32 %x, %y
    -; CHECK: ret i32 %z
    -define i32 @a0(i32 %x) {
    -  %y = sdiv i32 %x, 3
    -  %z = mul i32 %y, 3
    -  ret i32 %z
    -}
    -
    -; CHECK: i32 @b0
    -; CHECK: ret i32 %x
    -define i32 @b0(i32 %x) {
    -  %y = sdiv exact i32 %x, 3
    -  %z = mul i32 %y, 3
    -  ret i32 %z
    -}
    -
    -; CHECK: i32 @a1
    -; CHECK: %y = srem i32 %x, 3
    -; CHECK: %z = sub i32 %y, %x
    -; CHECK: ret i32 %z
    -define i32 @a1(i32 %x) {
    -  %y = sdiv i32 %x, 3
    -  %z = mul i32 %y, -3
    -  ret i32 %z
    -}
    -
    -; CHECK: i32 @b1
    -; CHECK: %z = sub i32 0, %x
    -; CHECK: ret i32 %z
    -define i32 @b1(i32 %x) {
    -  %y = sdiv exact i32 %x, 3
    -  %z = mul i32 %y, -3
    -  ret i32 %z
    -}
    
    Copied: llvm/trunk/test/Transforms/InstCombine/exact.ll (from r124987, llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll)
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/exact.ll?p2=llvm/trunk/test/Transforms/InstCombine/exact.ll&p1=llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll&r1=124987&r2=124992&rev=124992&view=diff
    ==============================================================================
    --- llvm/trunk/test/Transforms/InstCombine/exact-sdiv.ll (original)
    +++ llvm/trunk/test/Transforms/InstCombine/exact.ll Sun Feb  6 15:44:57 2011
    @@ -50,3 +50,11 @@
       %z = mul i32 %y, -3
       ret i32 %z
     }
    +
    +; CHECK: i32 @b2
    +; CHECK: ret i32 %x
    +define i32 @b2(i32 %x, i32 %w) {
    +  %y = udiv exact i32 %x, %w
    +  %z = mul i32 %y, %w
    +  ret i32 %z
    +}
    
    
    
    From sabre at nondot.org  Sun Feb  6 15:59:10 2011
    From: sabre at nondot.org (Chris Lattner)
    Date: Sun, 06 Feb 2011 21:59:10 -0000
    Subject: [llvm-commits] [llvm] r124993 - in
     /llvm/trunk/test/Transforms/InstSimplify: 2010-12-20-Reassociate.ll
     reassociate.ll
    Message-ID: <20110206215910.5BEA02A6C12C@llvm.org>
    
    Author: lattner
    Date: Sun Feb  6 15:59:10 2011
    New Revision: 124993
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124993&view=rev
    Log:
    rename test.
    
    Added:
        llvm/trunk/test/Transforms/InstSimplify/reassociate.ll
          - copied unchanged from r124987, llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
    Removed:
        llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
    
    Removed: llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll?rev=124992&view=auto
    ==============================================================================
    --- llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll (original)
    +++ llvm/trunk/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll (removed)
    @@ -1,166 +0,0 @@
    -; RUN: opt < %s -instsimplify -S | FileCheck %s
    -
    -define i32 @add1(i32 %x) {
    -; CHECK: @add1
    -; (X + -1) + 1 -> X
    -  %l = add i32 %x, -1
    -  %r = add i32 %l, 1
    -  ret i32 %r
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @and1(i32 %x, i32 %y) {
    -; CHECK: @and1
    -; (X & Y) & X -> X & Y
    -  %l = and i32 %x, %y
    -  %r = and i32 %l, %x
    -  ret i32 %r
    -; CHECK: ret i32 %l
    -}
    -
    -define i32 @and2(i32 %x, i32 %y) {
    -; CHECK: @and2
    -; X & (X & Y) -> X & Y
    -  %r = and i32 %x, %y
    -  %l = and i32 %x, %r
    -  ret i32 %l
    -; CHECK: ret i32 %r
    -}
    -
    -define i32 @or1(i32 %x, i32 %y) {
    -; CHECK: @or1
    -; (X | Y) | X -> X | Y
    -  %l = or i32 %x, %y
    -  %r = or i32 %l, %x
    -  ret i32 %r
    -; CHECK: ret i32 %l
    -}
    -
    -define i32 @or2(i32 %x, i32 %y) {
    -; CHECK: @or2
    -; X | (X | Y) -> X | Y
    -  %r = or i32 %x, %y
    -  %l = or i32 %x, %r
    -  ret i32 %l
    -; CHECK: ret i32 %r
    -}
    -
    -define i32 @xor1(i32 %x, i32 %y) {
    -; CHECK: @xor1
    -; (X ^ Y) ^ X = Y
    -  %l = xor i32 %x, %y
    -  %r = xor i32 %l, %x
    -  ret i32 %r
    -; CHECK: ret i32 %y
    -}
    -
    -define i32 @xor2(i32 %x, i32 %y) {
    -; CHECK: @xor2
    -; X ^ (X ^ Y) = Y
    -  %r = xor i32 %x, %y
    -  %l = xor i32 %x, %r
    -  ret i32 %l
    -; CHECK: ret i32 %y
    -}
    -
    -define i32 @sub1(i32 %x, i32 %y) {
    -; CHECK: @sub1
    -  %d = sub i32 %x, %y
    -  %r = sub i32 %x, %d
    -  ret i32 %r
    -; CHECK: ret i32 %y
    -}
    -
    -define i32 @sub2(i32 %x) {
    -; CHECK: @sub2
    -; X - (X + 1) -> -1
    -  %xp1 = add i32 %x, 1
    -  %r = sub i32 %x, %xp1
    -  ret i32 %r
    -; CHECK: ret i32 -1
    -}
    -
    -define i32 @sub3(i32 %x, i32 %y) {
    -; CHECK: @sub3
    -; ((X + 1) + Y) - (Y + 1) -> X
    -  %xp1 = add i32 %x, 1
    -  %lhs = add i32 %xp1, %y
    -  %rhs = add i32 %y, 1
    -  %r = sub i32 %lhs, %rhs
    -  ret i32 %r
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @sdiv1(i32 %x, i32 %y) {
    -; CHECK: @sdiv1
    -; (no overflow X * Y) / Y -> X
    -  %mul = mul nsw i32 %x, %y
    -  %r = sdiv i32 %mul, %y
    -  ret i32 %r
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @sdiv2(i32 %x, i32 %y) {
    -; CHECK: @sdiv2
    -; (((X / Y) * Y) / Y) -> X / Y
    -  %div = sdiv i32 %x, %y
    -  %mul = mul i32 %div, %y
    -  %r = sdiv i32 %mul, %y
    -  ret i32 %r
    -; CHECK: ret i32 %div
    -}
    -
    -define i32 @sdiv3(i32 %x, i32 %y) {
    -; CHECK: @sdiv3
    -; (X rem Y) / Y -> 0
    -  %rem = srem i32 %x, %y
    -  %div = sdiv i32 %rem, %y
    -  ret i32 %div
    -; CHECK: ret i32 0
    -}
    -
    -define i32 @sdiv4(i32 %x, i32 %y) {
    -; CHECK: @sdiv4
    -; (X / Y) * Y -> X if the division is exact
    -  %div = sdiv exact i32 %x, %y
    -  %mul = mul i32 %div, %y
    -  ret i32 %mul
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @sdiv5(i32 %x, i32 %y) {
    -; CHECK: @sdiv5
    -; Y * (X / Y) -> X if the division is exact
    -  %div = sdiv exact i32 %x, %y
    -  %mul = mul i32 %y, %div
    -  ret i32 %mul
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @udiv1(i32 %x, i32 %y) {
    -; CHECK: @udiv1
    -; (no overflow X * Y) / Y -> X
    -  %mul = mul nuw i32 %x, %y
    -  %r = udiv i32 %mul, %y
    -  ret i32 %r
    -; CHECK: ret i32 %x
    -}
    -
    -define i32 @udiv2(i32 %x, i32 %y) {
    -; CHECK: @udiv2
    -; (((X / Y) * Y) / Y) -> X / Y
    -  %div = udiv i32 %x, %y
    -  %mul = mul i32 %div, %y
    -  %r = udiv i32 %mul, %y
    -  ret i32 %r
    -; CHECK: ret i32 %div
    -}
    -
    -define i32 @udiv3(i32 %x, i32 %y) {
    -; CHECK: @udiv3
    -; (X rem Y) / Y -> 0
    -  %rem = urem i32 %x, %y
    -  %div = udiv i32 %rem, %y
    -  ret i32 %div
    -; CHECK: ret i32 0
    -}
    
    
    
    From sabre at nondot.org  Sun Feb  6 16:05:31 2011
    From: sabre at nondot.org (Chris Lattner)
    Date: Sun, 06 Feb 2011 22:05:31 -0000
    Subject: [llvm-commits] [llvm] r124994 - in /llvm/trunk:
     lib/Analysis/InstructionSimplify.cpp
     test/Transforms/InstSimplify/reassociate.ll
    Message-ID: <20110206220531.737F92A6C12C@llvm.org>
    
    Author: lattner
    Date: Sun Feb  6 16:05:31 2011
    New Revision: 124994
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124994&view=rev
    Log:
    teach instsimplify to transform (X / Y) * Y to X
    when the div is an exact udiv.
    
    Modified:
        llvm/trunk/lib/Analysis/InstructionSimplify.cpp
        llvm/trunk/test/Transforms/InstSimplify/reassociate.ll
    
    Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=124994&r1=124993&r2=124994&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
    +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Sun Feb  6 16:05:31 2011
    @@ -735,9 +735,11 @@
       // (X / Y) * Y -> X if the division is exact.
       Value *X = 0, *Y = 0;
       if ((match(Op0, m_SDiv(m_Value(X), m_Value(Y))) && Y == Op1) || // (X / Y) * Y
    -      (match(Op1, m_SDiv(m_Value(X), m_Value(Y))) && Y == Op0)) { // Y * (X / Y)
    -    BinaryOperator *SDiv = cast(Y == Op1 ? Op0 : Op1);
    -    if (SDiv->isExact())
    +      (match(Op0, m_UDiv(m_Value(X), m_Value(Y))) && Y == Op1) ||
    +      (match(Op1, m_SDiv(m_Value(X), m_Value(Y))) && Y == Op0) || // Y * (X / Y)
    +      (match(Op1, m_UDiv(m_Value(X), m_Value(Y))) && Y == Op0)) {
    +    BinaryOperator *Div = cast(Y == Op1 ? Op0 : Op1);
    +    if (Div->isExact())
           return X;
       }
     
    
    Modified: llvm/trunk/test/Transforms/InstSimplify/reassociate.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/reassociate.ll?rev=124994&r1=124993&r2=124994&view=diff
    ==============================================================================
    --- llvm/trunk/test/Transforms/InstSimplify/reassociate.ll (original)
    +++ llvm/trunk/test/Transforms/InstSimplify/reassociate.ll Sun Feb  6 16:05:31 2011
    @@ -137,6 +137,7 @@
     ; CHECK: ret i32 %x
     }
     
    +
     define i32 @udiv1(i32 %x, i32 %y) {
     ; CHECK: @udiv1
     ; (no overflow X * Y) / Y -> X
    @@ -164,3 +165,22 @@
       ret i32 %div
     ; CHECK: ret i32 0
     }
    +
    +define i32 @udiv4(i32 %x, i32 %y) {
    +; CHECK: @udiv4
    +; (X / Y) * Y -> X if the division is exact
    +  %div = udiv exact i32 %x, %y
    +  %mul = mul i32 %div, %y
    +  ret i32 %mul
    +; CHECK: ret i32 %x
    +}
    +
    +define i32 @udiv5(i32 %x, i32 %y) {
    +; CHECK: @udiv5
    +; Y * (X / Y) -> X if the division is exact
    +  %div = udiv exact i32 %x, %y
    +  %mul = mul i32 %y, %div
    +  ret i32 %mul
    +; CHECK: ret i32 %x
    +}
    +
    
    
    
    From geek4civic at gmail.com  Sun Feb  6 18:16:34 2011
    From: geek4civic at gmail.com (NAKAMURA Takumi)
    Date: Mon, 7 Feb 2011 09:16:34 +0900
    Subject: [llvm-commits] Patch to build 64bit LLVM with MinGW64 compiler
    In-Reply-To: 
    References: 
    	
    	
    	
    	
    	
    	
    	
    	
    Message-ID: 
    
    Good morning, Syoyo!
    
    Fixed in r124950. I expect it should work on known mingws, thank you!
    
    ...Takumi
    
    From jason.w.kim.2009 at gmail.com  Sun Feb  6 18:49:54 2011
    From: jason.w.kim.2009 at gmail.com (Jason W Kim)
    Date: Mon, 07 Feb 2011 00:49:54 -0000
    Subject: [llvm-commits] [llvm] r124995 - in /llvm/trunk:
     lib/Target/ARM/ARMAsmPrinter.cpp lib/Target/ARM/ARMBuildAttrs.h
     test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll
     test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll
    Message-ID: <20110207004954.20D7F2A6C12C@llvm.org>
    
    Author: jasonwkim
    Date: Sun Feb  6 18:49:53 2011
    New Revision: 124995
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124995&view=rev
    Log:
    Rework some .ARM.attribute work for improved gcc compatibility.
    Unified EmitTextAttribute for both Asm and Obj emission (.cpu only)
    Added necessary cortex-A8 related attrs for codegen compat tests.
    
    
    Modified:
        llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
        llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h
        llvm/trunk/test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll
        llvm/trunk/test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll
    
    Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=124995&r1=124994&r2=124995&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
    +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Sun Feb  6 18:49:53 2011
    @@ -66,6 +66,7 @@
       public:
         virtual void MaybeSwitchVendor(StringRef Vendor) = 0;
         virtual void EmitAttribute(unsigned Attribute, unsigned Value) = 0;
    +    virtual void EmitTextAttribute(unsigned Attribute, StringRef String) = 0;
         virtual void Finish() = 0;
         virtual ~AttributeEmitter() {}
       };
    @@ -82,6 +83,14 @@
                                Twine(Attribute) + ", " + Twine(Value));
         }
     
    +    void EmitTextAttribute(unsigned Attribute, StringRef String) {
    +      switch (Attribute) {
    +      case ARMBuildAttrs::CPU_name:
    +        Streamer.EmitRawText(StringRef("\t.cpu ") + String);
    +        break;
    +      default: assert(0 && "Unsupported Text attribute in ASM Mode"); break;
    +      }
    +    }
         void Finish() { }
       };
     
    @@ -115,6 +124,12 @@
           Contents += Value;
         }
     
    +    void EmitTextAttribute(unsigned Attribute, StringRef String) {
    +      Contents += Attribute;
    +      Contents += String;
    +      Contents += 0;
    +    }
    +
         void Finish() {
           const size_t ContentsSize = Contents.size();
     
    @@ -449,32 +464,53 @@
       AttrEmitter->MaybeSwitchVendor("aeabi");
     
       std::string CPUString = Subtarget->getCPUString();
    -  if (OutStreamer.hasRawTextSupport()) {
    -    if (CPUString != "generic")
    -      OutStreamer.EmitRawText(StringRef("\t.cpu ") + CPUString);
    -  } else {
    -    assert(CPUString == "generic" && "Unsupported .cpu attribute for ELF/.o");
    +
    +  if (CPUString == "cortex-a8" ||
    +      Subtarget->isCortexA8()) {
    +    AttrEmitter->EmitTextAttribute(ARMBuildAttrs::CPU_name, "CORTEX-A8");
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch, ARMBuildAttrs::v7);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch_profile,
    +                               ARMBuildAttrs::ApplicationProfile);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ARM_ISA_use,
    +                               ARMBuildAttrs::Allowed);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::THUMB_ISA_use,
    +                               ARMBuildAttrs::AllowThumb32);
    +    // Fixme: figure out when this is emitted.
    +    //AttrEmitter->EmitAttribute(ARMBuildAttrs::WMMX_arch,
    +    //                           ARMBuildAttrs::AllowWMMXv1);
    +    //
    +
    +    /// ADD additional Else-cases here!
    +  } else if (CPUString == "generic") {
         // FIXME: Why these defaults?
         AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch, ARMBuildAttrs::v4T);
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::ARM_ISA_use, 1);
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::THUMB_ISA_use, 1);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ARM_ISA_use,
    +                               ARMBuildAttrs::Allowed);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::THUMB_ISA_use,
    +                               ARMBuildAttrs::Allowed);
       }
     
       // FIXME: Emit FPU type
       if (Subtarget->hasVFP2())
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::VFP_arch, 2);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::VFP_arch,
    +                               ARMBuildAttrs::AllowFPv2);
     
       // Signal various FP modes.
       if (!UnsafeFPMath) {
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_denormal, 1);
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_exceptions, 1);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_denormal,
    +                               ARMBuildAttrs::Allowed);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_exceptions,
    +                               ARMBuildAttrs::Allowed);
       }
     
       if (NoInfsFPMath && NoNaNsFPMath)
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_number_model, 1);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_number_model,
    +                               ARMBuildAttrs::Allowed);
       else
    -    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_number_model, 3);
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_FP_number_model,
    +                               ARMBuildAttrs::AllowIEE754);
     
    +  // FIXME: add more flags to ARMBuildAttrs.h
       // 8-bytes alignment stuff.
       AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_align8_needed, 1);
       AttrEmitter->EmitAttribute(ARMBuildAttrs::ABI_align8_preserved, 1);
    @@ -486,7 +522,8 @@
       }
       // FIXME: Should we signal R9 usage?
     
    -  AttrEmitter->EmitAttribute(ARMBuildAttrs::DIV_use, 1);
    +  if (Subtarget->hasDivide())
    +    AttrEmitter->EmitAttribute(ARMBuildAttrs::DIV_use, 1);
     
       AttrEmitter->Finish();
       delete AttrEmitter;
    
    Modified: llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h?rev=124995&r1=124994&r2=124995&view=diff
    ==============================================================================
    --- llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h (original)
    +++ llvm/trunk/lib/Target/ARM/ARMBuildAttrs.h Sun Feb  6 18:49:53 2011
    @@ -92,6 +92,40 @@
         v7E_M    = 13   // v7_M with DSP extensions
       };
     
    +  enum CPUArchProfile { // (=7), uleb128 
    +    Not_Applicable = 0, // pre v7, or cross-profile code
    +    ApplicationProfile = (0x41), // 'A' (e.g. for Cortex A8)
    +    RealTimeProfile = (0x52), // 'R' (e.g. for Cortex R4)
    +    MicroControllerProfile = (0x4D), // 'M' (e.g. for Cortex M3)
    +    SystemProfile = (0x53) // 'S' Application or real-time profile
    +  };
    +
    +  // The following have a lot of common use cases
    +  enum { 
    +    //ARMISAUse (=8), uleb128  and THUMBISAUse (=9), uleb128
    +    Not_Allowed = 0,
    +    Allowed = 1,
    +
    +    // FP_arch (=10), uleb128 (formerly Tag_VFP_arch = 10)
    +    AllowFPv2  = 2, // v2 FP ISA permitted (implies use of the v1 FP ISA)
    +    AllowFPv3A = 3, // v3 FP ISA permitted (implies use of the v2 FP ISA)
    +    AllowFPv3B = 4, // v3 FP ISA permitted, but only D0-D15, S0-S31 
    +    AllowFPv4A = 5, // v4 FP ISA permitted (implies use of v3 FP ISA) 
    +    AllowFPv4B = 6, // v4 FP ISA was permitted, but only D0-D15, S0-S31
    +
    +    // Tag_WMMX_arch, (=11), uleb128
    +    AllowThumb32 = 2, // 32-bit Thumb (implies 16-bit instructions)
    +    
    +    // Tag_WMMX_arch, (=11), uleb128
    +    AllowWMMXv1 = 2,  // The user permitted this entity to use WMMX v2
    +
    +    // Tag_ABI_FP_denormal, (=20), uleb128 
    +    PreserveFPSign = 2, // sign when flushed-to-zero is preserved
    +
    +    // Tag_ABI_FP_number_model, (=23), uleb128
    +    AllowRTABI = 2,  // numbers, infinities, and one quiet NaN (see [RTABI])
    +    AllowIEE754 = 3 // this code to use all the IEEE 754-defined FP encodings
    +  };
     }
     
     #endif // __TARGET_ARMBUILDATTRS_H__
    
    Modified: llvm/trunk/test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll?rev=124995&r1=124994&r2=124995&view=diff
    ==============================================================================
    --- llvm/trunk/test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll (original)
    +++ llvm/trunk/test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll Sun Feb  6 18:49:53 2011
    @@ -2,11 +2,11 @@
     ; This tests that MC/asm header conversion is smooth
     ;
     ; CHECK:      .syntax unified
    -; CHECK-NEXT: .eabi_attribute 20, 1
    -; CHECK-NEXT: .eabi_attribute 21, 1
    -; CHECK-NEXT: .eabi_attribute 23, 3
    -; CHECK-NEXT: .eabi_attribute 24, 1
    -; CHECK-NEXT: .eabi_attribute 25, 1
    +; CHECK: .eabi_attribute 20, 1
    +; CHECK: .eabi_attribute 21, 1
    +; CHECK: .eabi_attribute 23, 3
    +; CHECK: .eabi_attribute 24, 1
    +; CHECK: .eabi_attribute 25, 1
     
     define i32 @f(i64 %z) {
     	ret i32 0
    
    Modified: llvm/trunk/test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll?rev=124995&r1=124994&r2=124995&view=diff
    ==============================================================================
    --- llvm/trunk/test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll (original)
    +++ llvm/trunk/test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll Sun Feb  6 18:49:53 2011
    @@ -1,18 +1,36 @@
     ; RUN: llc  %s -mtriple=arm-linux-gnueabi -filetype=obj -o - | \
    -; RUN:    elf-dump --dump-section-data | FileCheck %s
    +; RUN:    elf-dump --dump-section-data | FileCheck  -check-prefix=BASIC %s 
    +; RUN: llc  %s -mtriple=armv7-linux-gnueabi -march=arm -mcpu=cortex-a8 \
    +; RUN:    -mattr=-neon -mattr=+vfp2 \
    +; RUN:    -arm-reserve-r9 -filetype=obj -o - | \
    +; RUN:    elf-dump --dump-section-data | FileCheck  -check-prefix=CORTEXA8 %s
    +
    +
     ; This tests that the extpected ARM attributes are emitted.
     ;
    -; CHECK:        .ARM.attributes
    -; CHECK-NEXT:         0x70000003
    -; CHECK-NEXT:         0x00000000
    -; CHECK-NEXT:         0x00000000
    -; CHECK-NEXT:         0x0000003c
    -; CHECK-NEXT:         0x00000022
    -; CHECK-NEXT:         0x00000000
    -; CHECK-NEXT:         0x00000000
    -; CHECK-NEXT:         0x00000001
    -; CHECK-NEXT:         0x00000000
    -; CHECK-NEXT:         '41210000 00616561 62690001 17000000 06020801 09011401 15011703 18011901 2c01'
    +; BASIC:        .ARM.attributes
    +; BASIC-NEXT:         0x70000003
    +; BASIC-NEXT:         0x00000000
    +; BASIC-NEXT:         0x00000000
    +; BASIC-NEXT:         0x0000003c
    +; BASIC-NEXT:         0x00000020
    +; BASIC-NEXT:         0x00000000
    +; BASIC-NEXT:         0x00000000
    +; BASIC-NEXT:         0x00000001
    +; BASIC-NEXT:         0x00000000
    +; BASIC-NEXT:         '411f0000 00616561 62690001 15000000 06020801 09011401 15011703 18011901'
    +
    +; CORTEXA8:        .ARM.attributes
    +; CORTEXA8-NEXT:         0x70000003
    +; CORTEXA8-NEXT:         0x00000000
    +; CORTEXA8-NEXT:         0x00000000
    +; CORTEXA8-NEXT:         0x0000003c
    +; CORTEXA8-NEXT:         0x0000002f
    +; CORTEXA8-NEXT:         0x00000000
    +; CORTEXA8-NEXT:         0x00000000
    +; CORTEXA8-NEXT:         0x00000001
    +; CORTEXA8-NEXT:         0x00000000
    +; CORTEXA8-NEXT:         '412e0000 00616561 62690001 24000000 05434f52 5445582d 41380006 0a074108 0109020a 02140115 01170318 011901'
     
     define i32 @f(i64 %z) {
            ret i32 0
    
    
    
    From jason.w.kim.2009 at gmail.com  Sun Feb  6 19:11:15 2011
    From: jason.w.kim.2009 at gmail.com (Jason W Kim)
    Date: Mon, 07 Feb 2011 01:11:15 -0000
    Subject: [llvm-commits] [llvm] r124996 - in /llvm/trunk:
     lib/MC/ELFObjectWriter.cpp test/MC/ARM/elf-reloc-01.ll
     test/MC/ARM/elf-reloc-02.ll test/MC/ARM/elf-reloc-03.ll
    Message-ID: <20110207011115.6791A2A6C12C@llvm.org>
    
    Author: jasonwkim
    Date: Sun Feb  6 19:11:15 2011
    New Revision: 124996
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124996&view=rev
    Log:
    Teach ARM/MC/ELF about gcc compatible reloc output to get past odd linkage
    failures with relocations.
    
    The code committed is a first cut at compatibility for emitted relocations in
    ELF .o.
    
    Why do this? because existing ARM tools like emitting relocs symbols as
    explicit relocations, not as section-offset relocs.
    
    Result is that with these changes,
    1) relocs are now substantially identical what to gcc outputs.
    2) larger apps (including many spec2k tests) compile, cross-link, and pass
    
    Added reminder fixme to tests for future conversion to .s form.
    
    
    Added:
        llvm/trunk/test/MC/ARM/elf-reloc-01.ll
        llvm/trunk/test/MC/ARM/elf-reloc-02.ll
        llvm/trunk/test/MC/ARM/elf-reloc-03.ll
    Modified:
        llvm/trunk/lib/MC/ELFObjectWriter.cpp
    
    Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=124996&r1=124995&r2=124996&view=diff
    ==============================================================================
    --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
    +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Sun Feb  6 19:11:15 2011
    @@ -30,6 +30,7 @@
     #include "llvm/Support/ErrorHandling.h"
     #include "llvm/Support/ELF.h"
     #include "llvm/Target/TargetAsmBackend.h"
    +#include "llvm/ADT/StringSwitch.h"
     
     #include "../Target/X86/X86FixupKinds.h"
     #include "../Target/ARM/ARMFixupKinds.h"
    @@ -189,6 +190,14 @@
                                       const MCValue &Target,
                                       const MCFragment &F) const;
     
    +    // For arch-specific emission of explicit reloc symbol
    +    virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
    +                                           const MCValue &Target,
    +                                           const MCFragment &F,
    +                                           bool IsBSS) const {
    +      return NULL;
    +    }
    +
         bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
         bool hasRelocationAddend() const {
           return TargetObjectWriter->hasRelocationAddend();
    @@ -401,6 +410,11 @@
     
         virtual void WriteEFlags();
       protected:
    +    virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
    +                                           const MCValue &Target,
    +                                           const MCFragment &F,
    +                                           bool IsBSS) const;
    +
         virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                       bool IsPCRel, bool IsRelocWithSymbol,
                                       int64_t Addend);
    @@ -704,7 +718,7 @@
       const SectionKind secKind = Section.getKind();
     
       if (secKind.isBSS())
    -    return NULL;
    +    return ExplicitRelSym(Asm, Target, F, true);
     
       if (secKind.isThreadLocal()) {
         if (Renamed)
    @@ -733,7 +747,7 @@
         return &Symbol;
       }
     
    -  return NULL;
    +  return ExplicitRelSym(Asm, Target, F, false);
     }
     
     
    @@ -1490,6 +1504,34 @@
       Write32(ELF::EF_ARM_EABIMASK & DefaultEABIVersion);
     }
     
    +// In ARM, _MergedGlobals and other most symbols get emitted directly.
    +// I.e. not as an offset to a section symbol.
    +// This code is a first-cut approximation of what ARM/gcc does.
    +
    +const MCSymbol *ARMELFObjectWriter::ExplicitRelSym(const MCAssembler &Asm,
    +                                                   const MCValue &Target,
    +                                                   const MCFragment &F,
    +                                                   bool IsBSS) const {
    +  const MCSymbol &Symbol = Target.getSymA()->getSymbol();
    +  bool EmitThisSym = false;
    +
    +  if (IsBSS) {
    +    EmitThisSym = StringSwitch(Symbol.getName())
    +      .Case("_MergedGlobals", true)
    +      .Default(false);
    +  } else {
    +    EmitThisSym = StringSwitch(Symbol.getName())
    +      .Case("_MergedGlobals", true)
    +      .StartsWith(".L.str", true)
    +      .Default(false);
    +  }
    +  if (EmitThisSym)
    +    return &Symbol;
    +  if (! Symbol.isTemporary())
    +    return &Symbol;
    +  return NULL;
    +}
    +
     unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target,
                                               const MCFixup &Fixup,
                                               bool IsPCRel,
    @@ -1604,7 +1646,7 @@
     
       if (RelocNeedsGOT(Modifier))
         NeedsGOT = true;
    -  
    +
       return Type;
     }
     
    
    Added: llvm/trunk/test/MC/ARM/elf-reloc-01.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-01.ll?rev=124996&view=auto
    ==============================================================================
    --- llvm/trunk/test/MC/ARM/elf-reloc-01.ll (added)
    +++ llvm/trunk/test/MC/ARM/elf-reloc-01.ll Sun Feb  6 19:11:15 2011
    @@ -0,0 +1,71 @@
    +;; RUN: llc -mtriple=armv7-linux-gnueabi -O3  \
    +;; RUN:    -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2  -arm-reserve-r9  \
    +;; RUN:    -filetype=obj %s -o - | \
    +;; RUN:   elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s
    +
    +;; FIXME: This file needs to be in .s form!
    +;; The args to llc are there to constrain the codegen only.
    +;; 
    +;; Ensure no regression on ARM/gcc compatibility for 
    +;; emitting explicit symbol relocs for nonexternal symbols 
    +;; versus section symbol relocs (with offset) - 
    +;;
    +;; Default llvm behavior is to emit as section symbol relocs nearly
    +;; everything that is not an undefined external. Unfortunately, this 
    +;; diverges from what codesourcery ARM/gcc does!
    +;;
    +;; Tests that reloc to _MergedGlobals show up as explicit symbol reloc
    +
    +
    +target triple = "armv7-none-linux-gnueabi"
    +
    + at var_tls = thread_local global i32 1
    + at var_tls_double = thread_local global double 1.000000e+00
    + at var_static = internal global i32 1
    + at var_static_double = internal global double 1.000000e+00
    + at var_global = global i32 1
    + at var_global_double = global double 1.000000e+00
    +
    +declare i32 @mystrlen(i8* nocapture %s) nounwind  
    +
    +declare void @myhextochar(i32 %n, i8* nocapture %buffer)
    +
    +declare void @__aeabi_read_tp() nounwind 
    +
    +declare void @__nacl_read_tp() nounwind  
    +
    +define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
    +entry:
    +  switch i32 %argc, label %bb3 [
    +    i32 555, label %bb
    +    i32 6666, label %bb2
    +  ]
    +
    +bb:                                               ; preds = %entry
    +  volatile store i32 11, i32* @var_tls, align 4
    +  volatile store double 2.200000e+01, double* @var_tls_double, align 8
    +  volatile store i32 33, i32* @var_static, align 4
    +  volatile store double 4.400000e+01, double* @var_static_double, align 8
    +  volatile store i32 55, i32* @var_global, align 4
    +  volatile store double 6.600000e+01, double* @var_global_double, align 8
    +  br label %bb3
    +
    +bb2:                                              ; preds = %entry
    +  ret i32 add (i32 add (i32 add (i32 ptrtoint (i32* @var_tls to i32), i32 add (i32 ptrtoint (i32* @var_static to i32), i32 ptrtoint (i32* @var_global to i32))), i32 ptrtoint (double* @var_tls_double to i32)), i32 add (i32 ptrtoint (double* @var_static_double to i32), i32 ptrtoint (double* @var_global_double to i32)))
    +
    +bb3:                                              ; preds = %bb, %entry
    +  tail call void @exit(i32 55) noreturn nounwind
    +  unreachable
    +}
    +
    +declare void @exit(i32) noreturn nounwind
    +
    +
    +;; OBJ:         Symbol 0x00000002
    +;; OBJ-NEXT:    '_MergedGlobals'
    +;; OBJ-NEXT:    'st_value', 0x00000010
    +
    +;; OBJ:          Relocation 0x00000001
    +;; OBJ-NEXT:     'r_offset', 
    +;; OBJ-NEXT:     'r_sym', 0x00000002
    +;; OBJ-NEXT:     'r_type', 0x0000002b
    
    Added: llvm/trunk/test/MC/ARM/elf-reloc-02.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-02.ll?rev=124996&view=auto
    ==============================================================================
    --- llvm/trunk/test/MC/ARM/elf-reloc-02.ll (added)
    +++ llvm/trunk/test/MC/ARM/elf-reloc-02.ll Sun Feb  6 19:11:15 2011
    @@ -0,0 +1,51 @@
    +;; RUN: llc -mtriple=armv7-linux-gnueabi -O3  \
    +;; RUN:    -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2  -arm-reserve-r9  \
    +;; RUN:    -filetype=obj %s -o - | \
    +;; RUN:   elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s
    +
    +;; FIXME: This file needs to be in .s form!
    +;; The args to llc are there to constrain the codegen only.
    +;; 
    +;; Ensure no regression on ARM/gcc compatibility for 
    +;; emitting explicit symbol relocs for nonexternal symbols 
    +;; versus section symbol relocs (with offset) - 
    +;;
    +;; Default llvm behavior is to emit as section symbol relocs nearly
    +;; everything that is not an undefined external. Unfortunately, this 
    +;; diverges from what codesourcery ARM/gcc does!
    +;;
    +;; Tests that reloc to .L.str* show up as explicit symbols
    +
    +target triple = "armv7-none-linux-gnueabi"
    +
    + at .str = private constant [7 x i8] c"@null\0A\00", align 4
    + at .str1 = private constant [8 x i8] c"@write\0A\00", align 4
    + at .str2 = private constant [13 x i8] c"hello worldn\00", align 4
    + at .str3 = private constant [7 x i8] c"@exit\0A\00", align 4
    +
    +declare i32 @mystrlen(i8* nocapture %s) nounwind readonly 
    +
    +declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind 
    +
    +define i32 @main() nounwind {
    +entry:
    +  %0 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([7 x i8]* @.str, i32 0, i32 0), i32 6) nounwind
    +  %1 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([8 x i8]* @.str1, i32 0, i32 0), i32 7) nounwind
    +  %2 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([13 x i8]* @.str2, i32 0, i32 0), i32 12) nounwind
    +  %3 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([7 x i8]* @.str3, i32 0, i32 0), i32 6) nounwind
    +  tail call void @exit(i32 55) noreturn nounwind
    +  unreachable
    +}
    +
    +declare i32 @write(...)
    +
    +declare void @exit(i32) noreturn nounwind
    +
    +
    +;; OBJ:          Symbol 0x00000002
    +;; OBJ-NEXT:    '.L.str'
    +
    +;; OBJ:        Relocation 0x00000000
    +;; OBJ-NEXT:    'r_offset', 
    +;; OBJ-NEXT:    'r_sym', 0x00000002
    +;; OBJ-NEXT:    'r_type', 0x0000002b
    
    Added: llvm/trunk/test/MC/ARM/elf-reloc-03.ll
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-03.ll?rev=124996&view=auto
    ==============================================================================
    --- llvm/trunk/test/MC/ARM/elf-reloc-03.ll (added)
    +++ llvm/trunk/test/MC/ARM/elf-reloc-03.ll Sun Feb  6 19:11:15 2011
    @@ -0,0 +1,98 @@
    +;; RUN: llc -mtriple=armv7-linux-gnueabi -O3  \
    +;; RUN:    -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2  -arm-reserve-r9  \
    +;; RUN:    -filetype=obj %s -o - | \
    +;; RUN:   elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s
    +
    +;; FIXME: This file needs to be in .s form!
    +;; The args to llc are there to constrain the codegen only.
    +;; 
    +;; Ensure no regression on ARM/gcc compatibility for 
    +;; emitting explicit symbol relocs for nonexternal symbols 
    +;; versus section symbol relocs (with offset) - 
    +;;
    +;; Default llvm behavior is to emit as section symbol relocs nearly
    +;; everything that is not an undefined external. Unfortunately, this 
    +;; diverges from what codesourcery ARM/gcc does!
    +;;
    +;; Verifies that internal constants appear as explict symbol relocs
    +
    +
    +target triple = "armv7-none-linux-gnueabi"
    +
    + at startval = global i32 5
    + at vtable = internal constant [10 x i32 (...)*] [i32 (...)* bitcast (i32 ()* @foo0 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo1 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo2 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo3 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo4 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo5 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo6 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo7 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo8 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo9 to i32 (...)*)]
    +
    +declare i32 @mystrlen(i8* nocapture %s) nounwind readonly 
    +
    +declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind 
    +
    +define internal i32 @foo0() nounwind readnone {
    +entry:
    +  ret i32 0
    +}
    +
    +define internal i32 @foo1() nounwind readnone {
    +entry:
    +  ret i32 1
    +}
    +
    +define internal i32 @foo2() nounwind readnone {
    +entry:
    +  ret i32 2
    +}
    +
    +define internal i32 @foo3() nounwind readnone {
    +entry:
    +  ret i32 3
    +}
    +
    +define internal i32 @foo4() nounwind readnone {
    +entry:
    +  ret i32 4
    +}
    +
    +define internal i32 @foo5() nounwind readnone {
    +entry:
    +  ret i32 55
    +}
    +
    +define internal i32 @foo6() nounwind readnone {
    +entry:
    +  ret i32 6
    +}
    +
    +define internal i32 @foo7() nounwind readnone {
    +entry:
    +  ret i32 7
    +}
    +
    +define internal i32 @foo8() nounwind readnone {
    +entry:
    +  ret i32 8
    +}
    +
    +define internal i32 @foo9() nounwind readnone {
    +entry:
    +  ret i32 9
    +}
    +
    +define i32 @main() nounwind {
    +entry:
    +  %0 = load i32* @startval, align 4
    +  %1 = getelementptr inbounds [10 x i32 (...)*]* @vtable, i32 0, i32 %0
    +  %2 = load i32 (...)** %1, align 4
    +  %3 = tail call i32 (...)* %2() nounwind
    +  tail call void @exit(i32 %3) noreturn nounwind
    +  unreachable
    +}
    +
    +declare void @exit(i32) noreturn nounwind
    +
    +
    +;; OBJ:      Symbol 0x0000000c
    +;; OBJ-NEXT:    'vtable'
    +
    +;; OBJ:           Relocation 0x00000001
    +;; OBJ-NEXT:     'r_offset', 
    +;; OBJ-NEXT:     'r_sym', 0x0000000c
    +;; OBJ-NEXT:     'r_type', 0x0000002b
    
    
    
    From aggarwa4 at illinois.edu  Sun Feb  6 19:25:17 2011
    From: aggarwa4 at illinois.edu (Arushi Aggarwal)
    Date: Mon, 07 Feb 2011 01:25:17 -0000
    Subject: [llvm-commits] [poolalloc] r124997 -
    	/poolalloc/trunk/lib/DSA/StdLibPass.cpp
    Message-ID: <20110207012517.BAFDD2A6C12C@llvm.org>
    
    Author: aggarwa4
    Date: Sun Feb  6 19:25:17 2011
    New Revision: 124997
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124997&view=rev
    Log:
    1. Add a few more functions
    2. Changed the format for specifying function
    behavior, allowing merging only certain parameters
    with the return value. THis helps in certain
    string functions.
    
    
    Modified:
        poolalloc/trunk/lib/DSA/StdLibPass.cpp
    
    Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
    URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=124997&r1=124996&r2=124997&view=diff
    ==============================================================================
    --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
    +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Sun Feb  6 19:25:17 2011
    @@ -60,11 +60,8 @@
       // The return value/arguments that should be marked as heap.
       bool heap[numOps];
     
    -  // Flags whether all arguments should be merged together.
    -  bool mergeAllArgs;
    -
       // Flags whether the return value should be merged with all arguments.
    -  bool mergeWithRet;
    +  bool mergeNodes[numOps];
     
       // Flags whether the return value and arguments should be folded.
       bool collapse;
    @@ -84,106 +81,107 @@
       const char* name;
       libAction action;
     } recFuncs[] = {
    -  {"stat",       {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, false, false, false}},
    -  {"fstat",      {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, false, false, false}},
    -  {"lstat",      {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, false, false, false}},
    +  {"stat",       {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fstat",      {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"lstat",      {NRET_YNARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"read",       {NRET_YARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, 
     
       // printf not strictly true, %n could cause a write
    -  {"printf",     {NRET_YARGS,  NRET_NARGS,  NRET_NARGS, false, false, false}},
    -  {"fprintf",    {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, false, false, false}},
    -  {"sprintf",    {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, false, false, false}},
    -  {"snprintf",   {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, false, false, false}},
    -  {"puts",       {NRET_YARGS,  NRET_NARGS,  NRET_NARGS, false, false, false}},
    -  {"putc",       {NRET_NARGS,  NRET_NARGS,  NRET_NARGS, false, false, false}},
    -  {"putchar",    {NRET_NARGS,  NRET_NARGS,  NRET_NARGS, false, false, false}},
    -  {"fputs",      {NRET_YARGS,  NRET_NYARGS, NRET_NARGS, false, false, false}},
    -  {"fputc",      {NRET_YARGS,  NRET_NYARGS, NRET_NARGS, false, false, false}},
    -
    -
    -  {"calloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    -  {"malloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    -  {"valloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    -  {"memalign",   {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    -  {"realloc",    {NRET_NARGS, YRET_NARGS, YRET_YNARGS, false,  true,  true}},
    -  {"free",       {NRET_NARGS, NRET_NARGS, NRET_YNARGS, false, false, false}},
    +  {"printf",     {NRET_YARGS,  NRET_NARGS,  NRET_NARGS, NRET_NARGS, false}},
    +  {"fprintf",    {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sprintf",    {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"snprintf",   {NRET_YARGS,  NRET_YNARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"puts",       {NRET_YARGS,  NRET_NARGS,  NRET_NARGS, NRET_NARGS, false}},
    +  {"putc",       {NRET_NARGS,  NRET_NARGS,  NRET_NARGS, NRET_NARGS, false}},
    +  {"putchar",    {NRET_NARGS,  NRET_NARGS,  NRET_NARGS, NRET_NARGS, false}},
    +  {"fputs",      {NRET_YARGS,  NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fputc",      {NRET_YARGS,  NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +
    +
    +  {"calloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
    +  {"malloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
    +  {"valloc",     {NRET_NARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
    +  {"realloc",    {NRET_NARGS, YRET_NARGS, YRET_YNARGS, YRET_YNARGS,false}},
    +  {"memalign",   {NRET_NARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
    +  {"posix_memalign",   {NRET_YARGS, YRET_YNARGS, NRET_NARGS,  NRET_NARGS, false}},
    +  {"free",       {NRET_NARGS, NRET_NARGS, NRET_YNARGS, NRET_NARGS, false}},
       
    -  {"strdup",     {NRET_YARGS, YRET_NARGS, YRET_NARGS,  false, true, false}},
    -  {"wcsdup",     {NRET_YARGS, YRET_NARGS, YRET_NARGS,  false, true, false}},
    +  {"strdup",     {NRET_YARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
    +  {"wcsdup",     {NRET_YARGS, YRET_NARGS, YRET_NARGS,  NRET_NARGS, false}},
     
    -  {"atoi",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"atof",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"atol",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"atoll",      {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"atoq",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -
    -  {"memcmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"strcmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"wcscmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"strncmp",    {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"wcsncmp",    {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"strcasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"wcscasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"strncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"wcsncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"strlen",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"wcslen",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -
    -  {"memchr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"wmemchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"memrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"strchr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"wcschr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"strrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"wcsrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"strchrhul",  {YRET_YARGS, NRET_NARGS, NRET_NARGS, false, true, true}},
    -  {"strcat",     {YRET_YARGS, YRET_YARGS, NRET_NARGS,  true, true, true}},
    -  {"strncat",    {YRET_YARGS, YRET_YARGS, NRET_NARGS,  true, true, true}},
    -
    -  {"strcpy",     {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -  {"memccpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -  {"wmemccpy",   {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -  {"wcscpy",     {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -  {"strncpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -  {"wcsncpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, true, true, true}},
    -
    -
    -  {"fwrite",     {NRET_YARGS, NRET_NYARGS, NRET_NARGS, false, false, false}},
    -  {"fread",      {NRET_NYARGS, NRET_YARGS, NRET_NARGS, false, false, false}},
    -  {"fflush",     {NRET_YARGS,  NRET_YARGS, NRET_NARGS, false, false, false}},
    -  {"fclose",     {NRET_YARGS,  NRET_YARGS, NRET_NARGS, false, false, false}},
    -  {"fopen",      {NRET_YARGS,  YRET_NARGS, YRET_NARGS, false, false, false}},
    -  {"fileno",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"unlink",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, false, false, false}},
    +  {"atoi",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"atof",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"atol",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"atoll",      {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"atoq",       {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +
    +  {"memcmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"strcmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"wcscmp",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"strncmp",    {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"wcsncmp",    {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"strcasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"wcscasecmp", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"strncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"wcsncasecmp",{NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"strlen",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"wcslen",     {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +
    +  {"memchr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"wmemchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"memrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strchr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"wcschr",     {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"wcsrchr",    {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strchrhul",  {YRET_YARGS, NRET_NARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strcat",     {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strncat",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +
    +  {"strcpy",     {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"strncpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"memccpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"memcpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"memmove",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}}, 
    +  {"wmemccpy",   {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"wcscpy",     {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +  {"wcsncpy",    {YRET_YARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, true}},
    +
    +  {"fwrite",     {NRET_YARGS, NRET_NYARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"write",      {NRET_YARGS,  NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fread",      {NRET_NYARGS, NRET_YARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fflush",     {NRET_YARGS,  NRET_YARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fclose",     {NRET_YARGS,  NRET_YARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fopen",      {NRET_YARGS,  YRET_NARGS, YRET_NARGS, NRET_NARGS, false}},
    +  {"open",       {NRET_YARGS,  NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"fileno",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"unlink",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
     
    -  {"perror",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, false, false, false}},
    +  {"perror",     {NRET_YARGS,  NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
     
       // SAFECode Intrinsics
    -  {"sc.lscheck", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.lscheckui", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.lscheckalign", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.lscheckalignui", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_register_stack", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_unregister_stack", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_register_global", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_unregister_global", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_register", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_unregister", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    -  {"sc.pool_argvregister", {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    +  {"sc.lscheck", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.lscheckui", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.lscheckalign", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.lscheckalignui", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_register_stack", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_unregister_stack", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_register_global", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_unregister_global", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_register", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_unregister", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
    +  {"sc.pool_argvregister", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
     
     #if 0
       {"remove",     {false, false, false,  true, false, false, false, false, false}},
       {"unlink",     {false, false, false,  true, false, false, false, false, false}},
       {"rename",     {false, false, false,  true, false, false, false, false, false}},
    -  {"memcmp",     {false, false, false,  true, false, false, false, false, false}},
       {"execl",      {false, false, false,  true, false, false, false, false, false}},
       {"execlp",     {false, false, false,  true, false, false, false, false, false}},
       {"execle",     {false, false, false,  true, false, false, false, false, false}},
       {"execv",      {false, false, false,  true, false, false, false, false, false}},
       {"execvp",     {false, false, false,  true, false, false, false, false, false}},
       {"chmod",      {false, false, false,  true, false, false, false, false, false}},
    -  {"puts",       {false, false, false,  true, false, false, false, false, false}},
    -  {"write",      {false, false, false,  true, false, false, false, false, false}},
    -  {"open",       {false, false, false,  true, false, false, false, false, false}},
       {"create",     {false, false, false,  true, false, false, false, false, false}},
       {"truncate",   {false, false, false,  true, false, false, false, false, false}},
       {"chdir",      {false, false, false,  true, false, false, false, false, false}},
    @@ -194,21 +192,21 @@
       {"wait",       {false, false, false, false,  true, false, false, false, false}},
       {"time",       {false, false, false, false,  true, false, false, false, false}},
       {"getrusage",  {false, false, false, false,  true, false, false, false, false}},
    -  {"memmove",    {false,  true, false,  true,  true, false,  true,  true,  true}},
       {"bcopy",      {false, false, false,  true,  true, false,  true, false,  true}},
       {"getcwd",     { true,  true,  true,  true,  true,  true, false,  true,  true}},
     #endif
    +
       // C++ functions, as mangled on linux gcc 4.2
       // operator new(unsigned long)
    -  {"_Znwm",      {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    +  {"_Znwm",      {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}},
       // operator new[](unsigned long)
    -  {"_Znam",      {NRET_NARGS, YRET_NARGS, YRET_NARGS,  false, false, false}},
    +  {"_Znam",      {NRET_NARGS, YRET_NARGS, YRET_NARGS, NRET_NARGS, false}},
       // operator delete(void*)
    -  {"_ZdlPv",     {NRET_NARGS, NRET_NARGS, NRET_YNARGS,  false, false, false}},
    +  {"_ZdlPv",     {NRET_NARGS, NRET_NARGS, NRET_YNARGS,NRET_NARGS, false}},
       // operator delete[](void*)
    -  {"_ZdaPv",     {NRET_NARGS, NRET_NARGS, NRET_YNARGS,  false, false, false}},
    +  {"_ZdaPv",     {NRET_NARGS, NRET_NARGS, NRET_YNARGS, NRET_NARGS, false}},
       // Terminate the list of special functions recognized by this pass
    -  {0,            {NRET_NARGS, NRET_NARGS, NRET_NARGS, false, false, false}},
    +  {0,            {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}},
     };
     
     //
    @@ -316,6 +314,7 @@
         if (!I->isDeclaration())
           getOrCreateGraph(&*I);
     
    +  //FIXME: Should this happen in a "StdLib" Pass???
       //
       // Erase direct calls to functions that don't return a pointer and are marked
       // with the readnone annotation.
    @@ -393,12 +392,12 @@
                   // appropriate.
                   //
                   std::vector toMerge;
    -              if (recFuncs[x].action.mergeWithRet)
    +              if (recFuncs[x].action.mergeNodes[0])
                     if (isa(CI->getType()))
                       if (Graph->hasNodeForValue(CI))
                     toMerge.push_back(Graph->getNodeForValue(CI));
    -              if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet)
                     for (unsigned y = 1; y < CI->getNumOperands(); ++y)
    +              if (recFuncs[x].action.mergeNodes[y])
                       if (isa(CI->getOperand(y)->getType()))
                         if (Graph->hasNodeForValue(CI->getOperand(y)))
                           toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
    @@ -469,12 +468,12 @@
                           // appropriate.
                           //
                           std::vector toMerge;
    -                      if (recFuncs[x].action.mergeWithRet)
    +                      if (recFuncs[x].action.mergeNodes[0])
                             if (isa(CI->getType()))
                               if (Graph->hasNodeForValue(CI))
                                 toMerge.push_back(Graph->getNodeForValue(CI));
    -                      if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet)
                             for (unsigned y = 1; y < CI->getNumOperands(); ++y)
    +                        if (recFuncs[x].action.mergeNodes[y])
                               if (isa(CI->getOperand(y)->getType()))
                                 if (Graph->hasNodeForValue(CI->getOperand(y)))
                                   toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
    
    
    
    From anton at korobeynikov.info  Sun Feb  6 19:41:30 2011
    From: anton at korobeynikov.info (Anton Korobeynikov)
    Date: Mon, 7 Feb 2011 04:41:30 +0300
    Subject: [llvm-commits] Patch to build 64bit LLVM with MinGW64 compiler
    In-Reply-To: 
    References: 
    	
    	
    	
    	
    	
    	
    	
    	
    Message-ID: 
    
    > LLVM: r124350
    > TDM mingw: tdm64-1 4.5.1
    > Mingw64: x86_64-w64-mingw32-gcc.exe (GCC) 4.5.2 20100804 (prerelease)
    This sounds like a tdm bug, which is not compatible wrt mainline gcc.
    Given this we should be consistent with mainline gcc, not with some
    random (tdm) build.
    
    -- 
    With best regards, Anton Korobeynikov
    Faculty of Mathematics and Mechanics, Saint Petersburg State University
    
    From aggarwa4 at illinois.edu  Sun Feb  6 19:40:26 2011
    From: aggarwa4 at illinois.edu (Arushi Aggarwal)
    Date: Mon, 07 Feb 2011 01:40:26 -0000
    Subject: [llvm-commits] [poolalloc] r124998 - in /poolalloc/trunk/test:
     TEST.dsgraph.Makefile TEST.dsgraph.report
    Message-ID: <20110207014026.6D1932A6C12C@llvm.org>
    
    Author: aggarwa4
    Date: Sun Feb  6 19:40:26 2011
    New Revision: 124998
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124998&view=rev
    Log:
    Make use of the AssistDS passes. 
    Might help in call graph construction in some 
    cases. 
    
    Modified:
        poolalloc/trunk/test/TEST.dsgraph.Makefile
        poolalloc/trunk/test/TEST.dsgraph.report
    
    Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile
    URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.Makefile?rev=124998&r1=124997&r2=124998&view=diff
    ==============================================================================
    --- poolalloc/trunk/test/TEST.dsgraph.Makefile (original)
    +++ poolalloc/trunk/test/TEST.dsgraph.Makefile Sun Feb  6 19:40:26 2011
    @@ -15,6 +15,7 @@
     
     # Pathame to the DSA pass dynamic library
     DSA_SO   := $(PADIR)/$(CONFIGURATION)/lib/libLLVMDataStructure$(SHLIBEXT)
    +ASSIST_SO := $(PADIR)/$(CONFIGURATION)/lib/libAssistDS$(SHLIBEXT)
     
     # Command for running the opt program
     RUNOPT := $(RUNTOOLSAFELY) $(LLVM_OBJ_ROOT)/projects/poolalloc/$(CONFIGURATION)/bin/watchdog $(LOPT) -load $(DSA_SO)
    @@ -27,16 +28,22 @@
     ANALYZE_OPTS +=  -instcount -disable-verify -analyze
     MEM := -track-memory -time-passes -disable-output
     
    +#TYPE_INFERENCE_OPT := 1
    +
     #ifdef TYPE_INFERENCE_OPT
    -ANALYZE_OPTS += -enable-type-inference-opts
    +ANALYZE_OPTS += -enable-type-inference-opts -dsa-stdlib-no-fold
     #endif 
     
    +$(PROGRAMS_TO_TEST:%=Output/%.base.bc): \
    +Output/%.base.bc: Output/%.llvm.bc $(LOPT) $(ASSIST_SO)
    +	-$(RUNOPT) -load $(ASSIST_SO) -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -indclone -funcspec -ipsccp -deadargelim -instcombine -globaldce -stats -time-passes $< -f -o $@ 
    +
     $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
    -Output/%.$(TEST).report.txt: Output/%.llvm.bc Output/%.LOC.txt $(LOPT)
    +Output/%.$(TEST).report.txt: Output/%.base.bc Output/%.LOC.txt $(LOPT)
     	@# Gather data
     	-($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1
     	-($(RUNOPT) -dsa-$(PASS) -dsa-stdlib-no-fold  $(ANALYZE_OPTS) $<)> $@.time.2 2>&1
    -	-($(RUNOPT)  $(MEM) -dsa-$(PASS) -disable-verify -debug-pass=Details $<)> $@.mem.1 2>&1
    +	-($(RUNOPT)  $(MEM) -dsa-$(PASS) -disable-verify  $<)> $@.mem.1 2>&1
     	@# Emit data.
     	@echo "---------------------------------------------------------------" > $@
     	@echo ">>> ========= '$(RELDIR)/$*' Program" >> $@
    @@ -111,6 +118,13 @@
     	@echo >> $@
     	@/bin/echo -n "MEM: " >> $@
     	- at grep '  Top-down Data Structure' $@.mem.1 >> $@
    +	@# Emit AssistDS stats
    +	@/bin/echo -n "CLONED_FUNCSPEC: " >> $@
    +	- at grep 'Number of Functions Cloned in FuncSpec' $<.info >> $@
    +	@echo >> $@
    +	@/bin/echo -n "CLONED_INDCLONE: " >> $@
    +	- at grep 'Number of Functions Cloned in IndClone' $<.info >> $@
    +	@echo >> $@
     
     
     
    
    Modified: poolalloc/trunk/test/TEST.dsgraph.report
    URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.report?rev=124998&r1=124997&r2=124998&view=diff
    ==============================================================================
    --- poolalloc/trunk/test/TEST.dsgraph.report (original)
    +++ poolalloc/trunk/test/TEST.dsgraph.report Sun Feb  6 19:40:26 2011
    @@ -171,4 +171,6 @@
                 [],
     # Nodes Folded
                 ["StdLibFold", "STD_LIB_FOLD: *([0-9]+)"],
    +            ["IndClone", "CLONED_INDCLONE: *([0-9]+)"],
    +            ["FuncSpec", "CLONED_FUNCSPEC: *([0-9]+)"],
                );
    
    
    
    From anton at korobeynikov.info  Sun Feb  6 19:44:50 2011
    From: anton at korobeynikov.info (Anton Korobeynikov)
    Date: Mon, 7 Feb 2011 04:44:50 +0300
    Subject: [llvm-commits] [llvm] r124995 - in /llvm/trunk:
     lib/Target/ARM/ARMAsmPrinter.cpp lib/Target/ARM/ARMBuildAttrs.h
     test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll
     test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll
    In-Reply-To: <20110207004954.20D7F2A6C12C@llvm.org>
    References: <20110207004954.20D7F2A6C12C@llvm.org>
    Message-ID: 
    
    Hello Jason,
    
    > + ?if (CPUString == "cortex-a8" ||
    > + ? ? ?Subtarget->isCortexA8()) {
    > + ? ?AttrEmitter->EmitTextAttribute(ARMBuildAttrs::CPU_name, "CORTEX-A8");
    > + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch, ARMBuildAttrs::v7);
    > + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch_profile,
    > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::ApplicationProfile);
    > + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::ARM_ISA_use,
    > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::Allowed);
    > + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::THUMB_ISA_use,
    > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::AllowThumb32);
    > + ? ?// Fixme: figure out when this is emitted.
    > + ? ?//AttrEmitter->EmitAttribute(ARMBuildAttrs::WMMX_arch,
    > + ? ?// ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::AllowWMMXv1);
    Can't we deduce these attributes from -mattr stuff? I believe
    subtarget has all necessary stuff wrt ISA and CPU arch. You might only
    need to do some custom stuff for profile.
    
    -- 
    With best regards, Anton Korobeynikov
    Faculty of Mathematics and Mechanics, Saint Petersburg State University
    
    
    From aggarwa4 at illinois.edu  Sun Feb  6 19:42:46 2011
    From: aggarwa4 at illinois.edu (Arushi Aggarwal)
    Date: Mon, 07 Feb 2011 01:42:46 -0000
    Subject: [llvm-commits] [poolalloc] r124999 -
     /poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
    Message-ID: <20110207014246.62BDF2A6C12C@llvm.org>
    
    Author: aggarwa4
    Date: Sun Feb  6 19:42:46 2011
    New Revision: 124999
    
    URL: http://llvm.org/viewvc/llvm-project?rev=124999&view=rev
    Log:
    Change the utility function to return the count, 
    as the internal function does. 
    
    Modified:
        poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
    
    Modified: poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
    URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h?rev=124999&r1=124998&r2=124999&view=diff
    ==============================================================================
    --- poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h (original)
    +++ poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h Sun Feb  6 19:42:46 2011
    @@ -266,7 +266,7 @@
         return Tree.__remove(key);
       }
     
    -  bool count() { return Tree.__count(); }
    +  unsigned count() { return Tree.__count(); }
     
       void clear() { Tree.__clear(); }
     
    @@ -306,7 +306,7 @@
         return Tree.__remove(key);
       }
       
    -  bool count() { return Tree.__count(); }
    +  unsigned count() { return Tree.__count(); }
       
       void clear() { Tree.__clear(); }
       
    
    
    
    From geek4civic at gmail.com  Sun Feb  6 20:06:26 2011
    From: geek4civic at gmail.com (NAKAMURA Takumi)
    Date: Mon, 7 Feb 2011 11:06:26 +0900
    Subject: [llvm-commits] _WIN32_WINNT as predefined (was Re: [Review
     request][Win64] Patches for Mingw-w64(and mingw64-clang))
    Message-ID: 
    
    Anton gave me a comment on the github for:
    * 0004-lib-Support-Windows-Windows.h-Autoconf-provides-.patch.txt
    > View Commit: https://github.com/chapuni/LLVM/commit/45be38ca409cbbdf2b63be2eaf7bf230aa9d6b38
    
    > I don't think this is a good way of doing thing. You're passing platform-dependent macros to all files, even those which do not include windows.h. These #define's should be localized in windows-only places (e.g. libSupport)
    
    In the case of mingw-w64, _WIN32_WINNT would be defined (as 0x0502) by
    system headers even if we did not provide predefined _WIN32_WINNT. In
    reverse, predefined _WIN32_WINNT might affect to system headers on
    mingw-w64.
    
    IMHO, _WIN32_WINNT (and similar) is not "platform-dependent macro". I
    think it could be done even if _WIN32_WINNT were defined on command
    line (-D_WIN32_WINNT=0x0500).
    
    Similarly, I think, also, _GNU_SOURCE could be defined in config.h
    (not llvm-config.h).
    and definitions in command line might be reduced as possible.
    
    May I reopen PR7809 - TargetSelect.h shouldn't include llvm/Config/config.h ?
    http://llvm.org/bugs/show_bug.cgi?id=7809
    In TOT, a few headers depend on llvm/Config/config.h.
    
    Thank you,
    ...Takumi
    
    From ofv at wanadoo.es  Sun Feb  6 20:22:24 2011
    From: ofv at wanadoo.es (Oscar Fuentes)
    Date: Mon, 07 Feb 2011 02:22:24 -0000
    Subject: [llvm-commits] [llvm] r125001 -
    	/llvm/trunk/cmake/modules/CMakeLists.txt
    Message-ID: <20110207022224.13A9A2A6C12C@llvm.org>
    
    Author: ofv
    Date: Sun Feb  6 20:22:23 2011
    New Revision: 125001
    
    URL: http://llvm.org/viewvc/llvm-project?rev=125001&view=rev
    Log:
    Install only *.cmake files. Don't install .svn directory.
    
    Fixes PR9159.
    
    Modified:
        llvm/trunk/cmake/modules/CMakeLists.txt
    
    Modified: llvm/trunk/cmake/modules/CMakeLists.txt
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=125001&r1=125000&r2=125001&view=diff
    ==============================================================================
    --- llvm/trunk/cmake/modules/CMakeLists.txt (original)
    +++ llvm/trunk/cmake/modules/CMakeLists.txt Sun Feb  6 20:22:23 2011
    @@ -13,7 +13,8 @@
     
     install(DIRECTORY .
       DESTINATION share/llvm/cmake
    -  PATTERN *.cmake
    +  FILES_MATCHING PATTERN *.cmake
    +  PATTERN .svn EXCLUDE
       PATTERN LLVM.cmake EXCLUDE
       PATTERN LLVMConfig.cmake EXCLUDE
       PATTERN LLVMLibDeps.cmake EXCLUDE
    
    
    
    From jasonwkim at google.com  Sun Feb  6 23:30:02 2011
    From: jasonwkim at google.com (Jason Kim)
    Date: Sun, 6 Feb 2011 21:30:02 -0800
    Subject: [llvm-commits] [llvm] r124995 - in /llvm/trunk:
     lib/Target/ARM/ARMAsmPrinter.cpp lib/Target/ARM/ARMBuildAttrs.h
     test/CodeGen/ARM/2010-09-29-mc-asm-header-test.ll
     test/CodeGen/ARM/2010-10-19-mc-elf-objheader.ll
    In-Reply-To: 
    References: <20110207004954.20D7F2A6C12C@llvm.org>
    	
    Message-ID: 
    
    Hi Anton.
    
    
    On Sun, Feb 6, 2011 at 5:44 PM, Anton Korobeynikov
     wrote:
    > Hello Jason,
    >
    >> + ?if (CPUString == "cortex-a8" ||
    >> + ? ? ?Subtarget->isCortexA8()) {
    >> + ? ?AttrEmitter->EmitTextAttribute(ARMBuildAttrs::CPU_name, "CORTEX-A8");
    >> + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch, ARMBuildAttrs::v7);
    >> + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::CPU_arch_profile,
    >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::ApplicationProfile);
    >> + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::ARM_ISA_use,
    >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::Allowed);
    >> + ? ?AttrEmitter->EmitAttribute(ARMBuildAttrs::THUMB_ISA_use,
    >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::AllowThumb32);
    >> + ? ?// Fixme: figure out when this is emitted.
    >> + ? ?//AttrEmitter->EmitAttribute(ARMBuildAttrs::WMMX_arch,
    >> + ? ?// ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBuildAttrs::AllowWMMXv1);
    > Can't we deduce these attributes from -mattr stuff? I believe
    
    I am not sure what you mean here. see below.
    
    > subtarget has all necessary stuff wrt ISA and CPU arch. You might only
    > need to do some custom stuff for profile.
    
    This is a first cut approximation of what attributes gets emitted via
    arm-gcc when cortex-a8 is selected,
    
    >
    > --
    > With best regards, Anton Korobeynikov
    > Faculty of Mathematics and Mechanics, Saint Petersburg State University
    >