aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-06-19Fix an x86-64 fast-isel address calculation overflow.Jim Stichnoth
Disallow large displacements in NaCl addressing modes, by rejecting the fast-isel selection and using the logic in the DAG-based isel. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3502 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16959013
2013-06-19Insulate calling conventions in PNaCl bitcode files.Karl Schimpf
Creates a bitcode-local enumeration for calling conventions for the PNaCl bitcode file, so that the bitcode file is better protected from (accidental) changes in LLVM code. Also removes invokes from the bitcode. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3497 R=dschuff@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/17118002
2013-06-17PNaCl: Turn on ABI verifier by default in sandboxed translatorMark Seaborn
Change pnacl-llc.cpp to enable the verifier. This causes two problems which we fix: * The ABI check for declared-but-not-defined functions fails in streaming mode. Fixing this would involve changing the bitcode reader. For now, disable this check when in streaming mode. Add a flag to PNaClABIVerifyModule. * ARM's GlobalMerge pass modifies functions' global variable references to use ConstantExprs that the ABI checker rejects. Address this by disabling GlobalMerge for now. GlobalMerge does not provide much benefit at the moment anyway, because, with the FlattenGlobals pass applied, GlobalMerge doesn't merge variables with alignment >1. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3465 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17190002
2013-06-17When running pnacl-llc sandboxed, force input to always be PNaCl bitcode.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/17295004
2013-06-16PNaCl ABI: Disallow non-default symbol visibility ("hidden" and "protected")Mark Seaborn
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3495 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16903003
2013-06-14PNaCl ABI: Disallow the "available_externally" linkage typeMark Seaborn
"define available_externally void @foo()" would mean that the definition of foo() can be dropped from the pexe, because a definition of foo() can be found in an external native library. This is not something we support for a PNaCl pexe. Clang generates "available_externally" for non-static inline function definitions at -O1, but not at -O0, and generally not at -O2 either because inlining removes the "available_externally" definition. "available_externally" gets removed at bitcode link time, so we can disallow it in the ABI checker without any further work required. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3495 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17035015
2013-06-14PNaCl ABI: Convert "private" linkage to "internal"Mark Seaborn
This simplifies the ABI by reducing the number of linkage types we have to check for and represent in the wire format. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3495 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17084003
2013-06-13Fix PrologEpilogInserter to save and restore all callee saved registersDerek Schuff
if the function calls _builtin_unwind_init() Also fix the list of callee-saved registers returned by X86RegisterInfo::getCalleeSavedRegisters BUG= https://code.google.com/p/nativeclient/issues/detail?id=3486 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/16987002
2013-06-13PNaCl: Strip more unwanted attributes: "align" on functions and "unnamed_addr"Mark Seaborn
Do this stripping in the StripAttributes pass. Change the pass to be a ModulePass so that it can modify global variables. Change the ABI verifier to check this. Also update a comment about "nuw" and "nsw". BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16991002
2013-06-13Remove unused function from PNaCl bitcode writer.Karl Schimpf
BUG=none R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16838018
2013-06-13Insulate PNaCl bitcode from LLVM encodings of floating point optimization flags.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16836017
2013-06-13Fix reading of headers when using a streamable memory object.Karl Schimpf
Fixes bug where we computed the length of fields buffer on the size of a pointer, rather then the actual length of the field. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3485 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/17003002
2013-06-13PNaCl: Fix new[]/delete mismatch in FlattenGlobals pass by using delete[]Mark Seaborn
BUG=none TEST=*.ll tests Review URL: https://codereview.chromium.org/16865012
2013-06-12Move llvm.expect from dev to blacklist. Convert with -lower-expect.Jan Voung
The backend currently treats llvm.expect as a nop pass-through. Until it becomes more useful, we don't need it in stable bitcode. It sounds like the backend may prefer to use the !prof metadata instead. The -lower-expect pass will convert it into branch weights, which can be consumed by the middle end optimizer's block placement pass. It is already converted to !prof metadata when clang is run with -O2, but not when clang is run at -O0. Also move the llvm.frameaddress from the dev part of the intrinsics test to the disallowed part of the test. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/16882002
2013-06-12Take some of the LLVM LibM intrinsics out of the "must be external" list.Jan Voung
Intrinsic::sin, Intrinsic::cos, etc., aren't generated. Intrinsic::sqrt is implemented in hardware we support now. If future hardware does not support it, we can supply a library function in the runtime. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3339 TEST=scons, llvm test suite, gcc torture, spec2k R=eliben@chromium.org Review URL: https://codereview.chromium.org/16868002
2013-06-12Move non-Pow transcendentals back to disallowed list (unused).Jan Voung
Initially whitelisted to satisfy tests/toolchain/llvm_math_intrinsics.c, which tests the intrinsics directly. Those tests now skip ABI verification so they will continue to pass. Outside of those direct uses, they are not used. llvm.powi gets introduced during the llvm sandboxed build. Clang CGBuiltin.cpp has a way to introduce Intrinsic::pow and Intrinsic::powi. It does not introduce any of the other intrinsics. We can add them back later and supply something in compiler_rt when clang or some transformation actually introduces them. For now that is not the case. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 TEST= scons, llvm nightly, gcc torture, spec2k, naclports R=eliben@chromium.org Review URL: https://codereview.chromium.org/16794006
2013-06-12PNaCl ABI: Strip out arithmetic attributes "nsw", "nuw" and "exact"Mark Seaborn
"nsw" and "nuw" -- "no signed wrap" and "no unsigned wrap" -- are not used by the backend, which is not surprising because it makes no difference to the hardware if arithmetic overflows. Although "exact" is used by the backend to convert "sdiv exact" to an "ashr" shift, it appears that "sdiv exact" does not get used in practice, and arguably such a transformation belongs in the user toolchain, not the PNaCl translator. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3483 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16746005
2013-06-12Revert llc to upstreamEli Bendersky
tools/llc is reset to revision 279b9184c2ff4fea93b198a3519b8cb3a1d8d195 from which the last LLVM merge was made. NaCl-specific files are removed. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16510008
2013-06-12Remove a stray usage of NACL_SRPCEli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16663008
2013-06-11Apply upstream r183551, r183601, r183624 and r183794JF Bastien
Rename countTrailingZeros to the older CountTrailingZeros_32, mark as localmod. These patches fix correctness issues with ARM FastISel, and should make it faster while generating better code. BUG= none TEST= self R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16712002
2013-06-11Clean-up shared-library related code from pnacl-llc.Eli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16123031
2013-06-10Fix the ninja build by adding naclbitreader to dependencies.Jim Stichnoth
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3485 R=kschimpf@google.com Review URL: https://codereview.chromium.org/16146012
2013-06-10Change NaCl-specific tests from llc to pnacl-llcEli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16273014
2013-06-10Merge the NACL_SRPC preprocessor flag into __native_client__Eli Bendersky
We always build the sandboxed translator with NACL_SRPC. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16667016
2013-06-10PNaCl: Extend ExpandStructRegs to handle "insertvalue" instructionsMark Seaborn
Previously, the pass could expand out struct_load+extractvalue combinations (via ReplaceUsesOfStructWithFields()). This change makes the pass more general by converting struct_loads to scalar_load+insertvalue combinations and then by expanding out insertvalue+extractvalue combinations. This means the pass can now handle the insertvalue instructions that are sometimes generated by the SROA pass. (Clang compiles ScummVM's use of C++ method pointers to struct loads+stores which SROA generates insertvalue instructions from.) To make the pass more general, we also extend it to be able to handle phi nodes of struct type. These are split into extractvalue+scalar_phi+insertvalue combinations. However, the pass is not yet fully general, because it doesn't handle: * nested struct types * array types Change ExpandArithWithOverflow to rely on ExpandStructRegs' insertvalue handling rather than the less general ReplaceUsesOfStructWithFields() helper function, which can now be removed. SplitUpStore() no longer needs to handle Constants, because this case is handled by ExpandExtractValue(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3476 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16448006
2013-06-07Updated the links in the LLDB 3.3 sub-project (now 3.3 links) to fix the 3.4 ↵Ashok Thirumurthi
merge from trunk. - Also split out a section on build portability and updated the list of features and improvements. --- This now reflects the up-coming merge of patches from trunk into the release_33 branch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183554 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07Fix Mispelled local variable in llc.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3479 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16440008
2013-06-07Add CL argument -bitcode-format to llvm-dis, llc, and pnacl-llc.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16385002
2013-06-07Add blurb for PowerPC.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183500 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06PNaCl ABI: Strip out calling conventions from functions and callsMark Seaborn
Always use the standard C calling conventions. Disallow "fastcc" etc. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2346 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16529004
2013-06-06Make PNaCl bitcode files have a different format from LLVM bitcode files.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/15907008
2013-06-06Release notes for dragonegg.Duncan Sands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06Add missing space.Duncan Sands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183386 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05PNaCl ABI: Strip out attributes on functions and function callsMark Seaborn
Add a pass, StripAttributes, for doing this, and enable it. Add an ABI check to reject these attributes. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2346 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16325025
2013-06-05Change CL flag -pnacl-freeze to -bitcode-format={llvm,pnacl}.Karl Schimpf
Also removes flag from llvm-as.cpp and LTOCodeGenerator.cpp since one should call pnacl-finalize to transform pexe's to PNaCl bitcode form. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=dschuff@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/16295014
2013-06-04PNaCl ABI checker: Reject functions that are declared but not definedMark Seaborn
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3339 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16270007
2013-06-04PNaCl: Enable RewritePNaClLibraryCalls and fix it to remove unused declsMark Seaborn
Removing the unused declarations of setjmp()/longjmp() will be necessary for future ABI checks which will reject these external function declarations because they are not intrinsics. StripDeadPrototypes is supposed to remove these declarations, but it fails to do so because there are dead ConstantExprs referencing the declarations. I suspect these are left behind by ReplacePtrsWithInts. We could fix this by adding calls to removeDeadConstantUsers() to StripDeadPrototypes or to ReplacePtrsWithInts, but for now it seems cleaner to fix RewritePNaClLibraryCalls. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 TEST=*.ll tests + tested along with an ABI check Review URL: https://codereview.chromium.org/15931009
2013-06-04PNaCl ABI checker: Reject the "addrspace" attributeMark Seaborn
It doesn't appear to be possible to set the address space on a Function, but we can still put the check in checkGlobalValueCommon() in case this changes in the future. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests Review URL: https://codereview.chromium.org/15993019
2013-06-04Update release notes for mips.Akira Hatanaka
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183249 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04Merging r183060:Bill Wendling
------------------------------------------------------------------------ r183060 | atrick | 2013-05-31 16:34:46 -0700 (Fri, 31 May 2013) | 11 lines Prevent loop-unroll from making assumptions about undefined behavior. Fixes rdar:14036816, PR16130. There is an opportunity to compute precise trip counts for 'or' expressions and multi-exit loops. rdar:14038809: Optimize trip count computation for multi-exit loops. To do this we need to record the fact that ExitLimit assumes NSW. When it does not we can safely assume that the loop trip count is the minimum ExitLimt across all subexpressions and loop exits. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183246 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04Merging r182989:Bill Wendling
------------------------------------------------------------------------ r182989 | atrick | 2013-05-30 23:43:25 -0700 (Thu, 30 May 2013) | 13 lines Fix ScalarEvolution::ComputeExitLimitFromCond for 'or' conditions. Fixes PR16130 - clang produces incorrect code with loop/expression at -O2. This is a 2+ year old bug that's now holding up the release. It's a case where we knowingly made aggressive assumptions about undefined behavior. These assumptions are wrong when SCEV is computing a subexpression that does not directly control the branch. With this fix, we avoid making assumptions in those cases but still optimize the common case. SCEV's trip count computation for exits controlled by 'or' expressions is now analagous to the trip count computation for loops with multiple exits. I had already fixed the multiple exit case to be conservative. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183245 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04PNaCl ABI checker: Check for normal form introduced by ReplacePtrsWithIntsMark Seaborn
Move most of the per-instruction checking in PNaClABIVerifyFunctions::runOnFunction() to a top-level function so that it can do an early exit to reject the instruction. Reporting just a single error per instruction makes the test expectations easier to understand and update. Remove the check for metadata types. Metadata won't be part of PNaCl's stable ABI, so if the metadata-rejecting check is disabled for debugging purpose, we don't really need to recursively check the metadata's types. This lets us remove the recursive checks of Constants and types. We now only accept a very restricted, non-recursive set of Constants inside functions and global variable initialisers. This means PNaClABITypeChecker doesn't need to be stateful any more, and its methods can become static. This change also fixes a hole where the operands of "switch" instructions weren't fully checked. Add a test to replace-ptrs-with-ints.ll to ensure that "undef" doesn't appear directly in loads and stores. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/15780014
2013-06-04Update the release notes for the 3.3 release.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183207 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04Merging r181909:Bill Wendling
------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183190 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04Merging r183035:Bill Wendling
------------------------------------------------------------------------ r183035 | arnolds | 2013-05-31 12:53:50 -0700 (Fri, 31 May 2013) | 7 lines LoopVectorize: PHIs with only outside users should prevent vectorization We check that instructions in the loop don't have outside users (except if they are reduction values). Unfortunately, we skipped this check for if-convertable PHIs. Fixes PR16184. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183189 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04Merging r183108:Bill Wendling
------------------------------------------------------------------------ r183108 | vljn | 2013-06-03 08:44:42 -0700 (Mon, 03 Jun 2013) | 1 line R600: CALL_FS consumes a stack size entry ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183181 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-03PNaCl gep expansion: avoid mul by 1 for i8 arrays.Jan Voung
Makes the bitcode a tiny bit smaller, and avoids generating shift left by 0 code under fast-isel. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/15861029
2013-06-03PNaCl ABI checker: Disallow ExtractValue and InsertValue instructions (2nd try)Mark Seaborn
Uses of these are removed by ExpandMulWithOverflow and ExpandStructRegs. This change was previously committed but reverted because it broke a varargs function call in 255.vortex in Spec2k. This has since been fixed by changing ExpandVarArgs. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=PNaCl toolchain trybots + all the Spec2k tests this time around Review URL: https://codereview.chromium.org/16336012
2013-06-03PNaCl: Fix ReplacePtrsWithInts so that ptrtoint always casts to i32Mark Seaborn
The normal form introduced by ReplacePtrsWithInts (as documented in the comments) is intended to have the property that ptrtoint and inttoptr only convert to/from i32, not other size types. Using IRBuilder's CreateZExtOrTrunc() broke that, though, because it performs some constant folding on global variable references. Fix this by creating CastInsts directly. I found this via the ABI checks I've been writing, which gave this error when building the sandboxed translator: non-i32 ptrtoint: %expanded1 = ptrtoint void ()* @ARMCompilationCallback to i8 LLVM ERROR: PNaCl ABI verification failed BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + tested full PNaCl build with ABI checks applied too Review URL: https://codereview.chromium.org/15955012
2013-06-03PNaCl: ExpandVarArgs: Use memcpy() instead of struct load+store for struct argsMark Seaborn
Although PNaCl doesn't fully support struct types as varargs arguments, there is a test in Spec2k (255.vortex) that passes a struct as a varargs argument but never reads the argument using va_arg (which is legal, but strange). ExpandVarArgs was handling the struct argument by copying it with a struct load+store. This is undesirable because currently SROA converts that into code that uses extractvalue, which was rejected by the PNaCl ABI checker. Struct load/store will soon be rejected by the ABI checker too. We could fix this by running ExpandStructRegs after ExpandVarArgs, but it's cleaner for ExpandVarArgs to use memcpy() instead of struct load+store. memcpy() is potentially more efficient because it avoids having a temporary copy of the struct, and using memcpy() avoids dependencies between IR passes. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + built 255.vortex from Spec2k Review URL: https://codereview.chromium.org/16232021