aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
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
2013-06-02Revert "PNaCl ABI checker: Disallow ExtractValue and InsertValue instructions"JF Bastien
This reverts commit 99c2f236a1a09b6c550e91b71dabbbb0e634ea37. It broken 255.vortex. See https://codereview.chromium.org/16257002/ TBR= mseaborn@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/15888014
2013-06-01Merge 183060: Prevent loop-unroll from making assumptions about undefined ↵Andrew Trick
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/trunk@183060 91177308-0d34-0410-b5e6-96231b3b80d8 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31Apply LLVM upstream: r182877 - Enable FastISel on ARM for Linux and NaClJF Bastien
This also pulls in a TargetMachine.h change from r176986 and changes NaCl's intrinsics-bitmanip.ll test to account for register spills at O0. FastISel was only enabled for iOS ARM and Thumb2, this patch enables it for ARM (not Thumb2) on Linux and NaCl. Thumb2 support needs a bit more work, mainly around register class restrictions. The patch punts to SelectionDAG when doing TLS relocation on non-Darwin targets. I will fix this and other FastISel-to-SelectionDAG failures in a separate patch. The patch also forces FastISel to retain frame pointers: iOS always keeps them for backtracking (so emitted code won't change because of this), but Linux was getting much worse code that was incorrect when using big frames (such as test-suite's lencod). I'll also fix this in a later patch, it will probably require a peephole so that FastISel doesn't rematerialize frame pointers back-to-back. The test changes are straightforward, similar to: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130513/174279.html They also add a vararg test that got dropped in that change. I ran all of test-suite on A15 hardware with --optimize-option=-O0 and all the tests pass. R=dschuff@chromium.org, jvoung@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3120 Review URL: https://codereview.chromium.org/15671004
2013-05-31PNaCl ABI checker: Require global variable initialisers to be flattenedMark Seaborn
Check for the normal form produced by FlattenGlobals. We also require that all GlobalVariables have initialisers. External globals are not allowed. Note that we don't need to call TC.isValidType() on GlobalVariables any more: the new check is stricter. Update types.ll: * Split some checks into separate files for clarity. Otherwise the ordering of aliases/functions/globals/metadata gets tricky. * Convert a lot of the type-whitelisting tests to test via phi nodes rather than via global variables, since most of these types are now rejected for global variables. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3113 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/15914017
2013-05-31PNaCl: FlattenGlobals: Use ptrtoint+add instead of getelementptr+bitcastMark Seaborn
The constructor for getelementptr ConstantExprs does some constant folding which can add 1 or 2 more indexes to the getelementptr. This complicates checking for FlattenGlobals' normal form in the PNaCl ABI checker. Worse, the GCC torture tests turned up a pathological case where this constant folding adds 4 indexes to the getelementptr and leaves the original struct type behind: @q = global i8* getelementptr inbounds ( %union.u* bitcast ([260 x i8]* @v to %union.u*), i32 0, i32 0, i32 0, i32 0, i32 4) That comes from the following code in gcc/testsuite/gcc.c-torture/execute/pr43784.c: struct s { unsigned char a[256]; }; union u { struct { struct s b; int c; } d; struct { int c; struct s b; } e; }; static union u v; static struct s *q = &v.e.b; We can fix this by using ptrtoint+add instead of getelementptr+bitcast, because ConstantExpr won't automatically convert ptrtoint to something else. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3113 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/15647009
2013-05-31PNaCl: Remove and disallow llvm.invariant.start/end intrinsicsMark Seaborn
These markers work in a similar way to llvm.lifetime.start/end, so we should remove them for similar reasons: it's not very well defined how one marker cancels out the effects of the other. Arguably, invariant.start/end are less useful than lifetime.start/end. They are ignored by the backend. They are generated in fewer places: invariant.start is generated by Clang (at -O1 or higher) when a const global is initialised with a non-POD initialiser. invariant.end is apparently not generated at all. Do the stripping in ReplacePtrsWithInts for consistency with the existing lifetime.start/end stripping. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3443 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/15995004
2013-05-31PNaCl ABI checker: Disallow ExtractValue and InsertValue instructionsMark Seaborn
Uses of these are removed by ExpandMulWithOverflow and ExpandStructRegs. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/15995005
2013-05-31Merging 182989: Fix ScalarEvolution::ComputeExitLimitFromCond for 'or' ↵Andrew Trick
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/trunk@182989 91177308-0d34-0410-b5e6-96231b3b80d8 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183013 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30PNaCl ABI checker: Disallow llvm.lifetime.start/end intrinsicsMark Seaborn
Run StripDeadPrototypes as a final pass to ensure that the prototypes for lifetime.start/end are removed. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3443 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16063005
2013-05-30PNaCl: Add a pass to expand out Clang's use of registers of struct typeMark Seaborn
Clang's implementation of C++ method pointers generates IR that uses LLVM registers with struct type -- specifically, loads and stores of struct values, and extractvalue instructions. See lib/CodeGen/ItaniumCXXABI.cpp in Clang. Add a pass, ExpandStructRegs, which expands out those uses. Factor out a function from ExpandArithWithOverflow so that the two passes can share some code. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/15692014
2013-05-30Enable integer promotion pass and add ABI check for integer typesDerek Schuff
This is a reapply of dc58e24a with one cleanup of a commented-out line in PromoteIntegers.cpp R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 Review URL: https://codereview.chromium.org/16015003
2013-05-30Add switch support to integer promotion passDerek Schuff
Odd-sized switch statements can appear in the sandboxed translator build. R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 Review URL: https://codereview.chromium.org/15894006
2013-05-29PNaCl ABI checker: Reject integer arguments smaller than i32Mark Seaborn
We can simplify the varargs checks by doing the checking on the FunctionType rather than having separate checks for the Function and the CallInst. (We couldn't do that prior to enabling ReplacePtrsWithInts because at that point the IR contained bitcasts to and from varargs FunctionTypes.) That simplification means we can also add the check for argument/return types in a single place too. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3342 TEST=*.ll tests + PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/15899011
2013-05-29PNaCl: Add ExpandSmallArguments pass to widen parameters to 32 bitsMark Seaborn
This widens i1, i8 and i16 function arguments and return types. Factor out RecreateFunction() helper function from existing PNaCl passes since this is a reoccurring code fragment. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3342 TEST=*.ll tests + PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/15971007
2013-05-29Revert "Enable integer promotion pass and enable ABI check for integer types."Mark Seaborn
This reverts commit dc58e24a36836fc19c534bdcbef5152717a3c3fc. That change broke the build of the sandboxed PNaCl translator. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3360 TEST=PNaCl toolchain trybots TBR=dschuff@chromium.org Review URL: https://codereview.chromium.org/15845009
2013-05-29Apply LLVM upstream: r182175 - Support unaligned load/store on more ARM targetsJF Bastien
This patch matches GCC behavior: the code used to only allow unaligned load/store on ARM for v6+ Darwin, it will now allow unaligned load/store for v6+ Darwin as well as for v7+ on Linux and NaCl. The distinction is made because v6 doesn't guarantee support (but LLVM assumes that Apple controls hardware+kernel and therefore have conformant v6 CPUs), whereas v7 does provide this guarantee (and Linux/NaCl behave sanely). The patch keeps the -arm-strict-align command line option, and adds -arm-no-strict-align. They behave similarly to GCC's -mstrict-align and -mnostrict-align. I originally encountered this discrepancy in FastIsel tests which expect unaligned load/store generation. Overall this should slightly improve performance in most cases because of reduced I$ pressure. R=dschuff@chromium.org Review URL: https://codereview.chromium.org/15677005
2013-05-29Fix PromoteIntegers pass to handle undef constantsDerek Schuff
ConvertConstant now returns an undef constant of the appropriate type. This fixes the translator build failure caused by enabling the pass. R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 Review URL: https://codereview.chromium.org/16086005
2013-05-29Enable integer promotion pass and enable ABI check for integer types.Derek Schuff
R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 Review URL: https://codereview.chromium.org/15950006
2013-05-29Merging r182585:Bill Wendling
------------------------------------------------------------------------ r182585 | aaronballman | 2013-05-23 07:55:00 -0700 (Thu, 23 May 2013) | 1 line Setting the default value (fixes CRT assertions about uninitialized variable use when doing debug MSVC builds), and fixing coding style. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182830 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Merging r182394:Bill Wendling
------------------------------------------------------------------------ r182394 | jholewinski | 2013-05-21 09:51:30 -0700 (Tue, 21 May 2013) | 1 line [NVPTX] Add @llvm.nvvm.sqrt.f() intrinsic ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182829 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Merging r182298:Bill Wendling
------------------------------------------------------------------------ r182298 | jholewinski | 2013-05-20 09:42:18 -0700 (Mon, 20 May 2013) | 1 line [NVPTX] Fix mis-use of CurrentFnSym in NVPTXAsmPrinter. This was causing a symbol name error in the output PTX. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182828 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Merging r182297:Bill Wendling
------------------------------------------------------------------------ r182297 | jholewinski | 2013-05-20 09:42:16 -0700 (Mon, 20 May 2013) | 1 line [NVPTX] Add programmatic interface to NVVMReflect pass ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182827 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Merging r182254:Bill Wendling
------------------------------------------------------------------------ r182254 | jholewinski | 2013-05-20 05:13:32 -0700 (Mon, 20 May 2013) | 12 lines [NVPTX] Add GenericToNVVM IR converter to better handle idiomatic LLVM IR inputs This converter currently only handles global variables in address space 0. For these variables, they are promoted to address space 1 (global memory), and all uses are updated to point to the result of a cvta.global instruction on the new variable. The motivation for this is address space 0 global variables are illegal since we cannot declare variables in the generic address space. Instead, we place the variables in address space 1 and explicitly convert the pointer to address space 0. This is primarily intended to help new users who expect to be able to place global variables in the default address space. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182826 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Merging r182253:Bill Wendling
------------------------------------------------------------------------ r182253 | jholewinski | 2013-05-20 05:13:28 -0700 (Mon, 20 May 2013) | 1 line [NVPTX] Fix i1 kernel parameters and global variables. ABI rules say we need to use .u8 for i1 parameters for kernels. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182825 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28PNaCl: Disable parts of InstCombine that introduce *.with.overflow intrinsicsMark Seaborn
Change the PNaCl ABI checker to disallow these intrinsics. Note that I had originally intended to commit this before my earlier change (https://codereview.chromium.org/15688011) that enables the ExpandArithWithOverflow pass. Enabling ExpandArithWithOverflow without changing InstCombine causes ExpandArithWithOverflow to fail on some of the *.with.overflow intrinsic calls that InstCombine introduces. This change therefore fixes some breakage. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/16042011
2013-05-28Expess NaClTransforms' dependence on IPO in LLVMBuild instead of CMakeLists.Derek Schuff
This is the style used by other libs in LLVM; the explicit version seems to be only used in tools (e.g. opt or llc) R=eliben@chromium.org, mseaborn@chromium.org BUG=none TEST=ninja and make builds Review URL: https://codereview.chromium.org/15917013
2013-05-28Fix integer promotion pass to handle casts to struct pointer types.Derek Schuff
Also fix the diagnostic asserts in getPromotedType. R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 Review URL: https://codereview.chromium.org/16004003
2013-05-28PNaCl: Extend ExpandMulWithOverflow pass to handle uadd.with.overflow tooMark Seaborn
It turned out that umul.with.overflow wasn't the only *.with.overflow intrinsic usage introduced by Clang. I knew that Clang's CGExprCXX.cpp generates umul.with.overflow for an overflow check for C++'s "new Foo[]". The same code for handling "new Foo[]" also generates uadd.with.overflow in some cases. This happens if class Foo has a destructor or a delete[] operator that takes a size argument. In those cases, the C++ ABI adds a "cookie" to the allocation which contains the array's size. Rename the pass to "ExpandArithWithOverflow" and rename files accordingly. Also enable the pass. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/15688011
2013-05-28PNaCl ABI checker: Disallow inline assemblyMark Seaborn
Reject module-level assembly and inline assembly within functions. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2345 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/16123005
2013-05-28Merging r182656:Bill Wendling
------------------------------------------------------------------------ r182656 | d0k | 2013-05-24 11:05:35 -0700 (Fri, 24 May 2013) | 3 lines LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases. Fixes PR16139. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182785 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28Add two passes that implement conversions from PNaCl's specific intrinsicsEli Bendersky
to external function calls during the translation stage (llc). One of the passes is a ModulePass that adds the appropriate function declarations to the module. The other is a FunctionPass that performs the actual call replacement. This split exists because of bitcode streaming. Initially the passes handle the llvm.nacl.{set|long}jmp intrinsics. In the future they may handle additional intrinsics that are part of the PNaCl stable bitcode ABI. This CL also removes the previous approach to handling this conversion (in SelectionDAGBuilder.cpp). That ended up not working - more details in issue 3429. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/16047002
2013-05-28PNaCl: Enable the ReplacePtrsWithInts passMark Seaborn
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/15767004
2013-05-24PNaCl: Add "-pnacl-abi-simplify-{pre,post}opt" meta-passes to "opt"Mark Seaborn
These meta-passes will be used to replace the pass lists that are currently in the pnacl-ld.py driver script in the NaCl repo. I've moved the comments across from pnacl-ld.py and added a couple more comments for ExpandByVal and StripMetadata. Fix the declaration of createResolveAliasesPass(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3435 TEST=new *.ll tests + tested with change to pnacl-ld.py Review URL: https://codereview.chromium.org/15669002
2013-05-24PNaCl: Add pass to expand out Clang-generated umul.with.overflow callsMark Seaborn
This adds a pass, ExpandMulWithOverflow, to expand out the llvm.umul.with.overflow calls that Clang generates to implement an overflow check for C++'s new[] operator. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=expand-mul-with-overflow.ll Review URL: https://codereview.chromium.org/14649027
2013-05-24PNaCl: Fix ReplacePtrsWithInts to handle some corner cases correctlyMark Seaborn
Running the LLVM test suite with the ReplacePtrsWithInts pass enabled produced a single failure (in MultiSource/Applications/SPASS), revealing a corner case in which a mixture of forward and backward references plus a bitcast causes the pass to fail (see @forwards_reference() in the test). The problem was that we were doing replaceAllUsesWith() on a placeholder value too early. RewriteMap was mapping a bitcast to a placeholder P, but RewriteMap's reference to P didn't get updated by P->replaceAllUsesWith() and P became a dangling pointer. The fix is: * Change convert() to strip off casts first, so that RewriteMap isn't used for mapping casts to converted values. * Defer the replaceAllUsesWith() calls until after creating all the replacement instructions. This makes the pass more robust against instruction ordering in the input. This requires debug instrinsics to be updated in a separate pass, because replaceAllUsesWith() doesn't work for references by metadata nodes. This also fixes some pathological corner cases of cyclic references in unreachable blocks. Fix indentation in one place. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=replace-ptrs-with-ints.ll + LLVM test suite Review URL: https://codereview.chromium.org/15761003
2013-05-24Make abbreviations explicit in pnacl-freeze/thaw.Karl Schimpf
[1] Explicitly enumerate all abbreviation values, including the maximum abbreviation for each type of block. [2] Make "enter subblock" calculate number of bits needed by passing in maximum abbreviation (associated with block) rather than requiring the developer to compute this value every time a subblock is entered. *NOTE* This code changes encoding sizes to be based on the maximum allowed value, rather than requiring the developer to calculate out the number of bits needed. This change doesn't make the PNaCL bitcode files incompatable with LLVM bitcode files, since it does not effect the bitcode reader. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/14813032
2013-05-22Promote bswap i16, i32, and i64 to be allowed llvm intrinsics.Jan Voung
Disallow i1, i8, which don't make sense for "byte" swapping. None of these generate outcalls to compiler_rt. Test coverage: * test/CodeGen/AArch64/dp1.ll (only testing i32, i64) * test/CodeGen/ARM/rev.ll (only testing i16) * test/CodeGen/Mips/bswap.ll (only testing i32, i64) * test/CodeGen/X86/bswap.ll (i16, i32, i64, on i686) * test/NaCl/{ARM,X86}/intrinsics-bitmanip.ll (i16, i32, i64) (maybe the last set of tests could be merged into the upstream tests) For targets without native i16 bswap, the i16 could just be a bswap on an i32 plus a shift right 16. Other test coverage: * gcc/testsuite/gcc.dg/builtin-bswap-[1,2,3,4,5].c Misc: style cleanups, and add comments to the undocumented intrinsics in the dev list. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/14914011
2013-05-22PNaCl: Add ReplacePtrsWithInts pass for stripping out pointer typesMark Seaborn
ReplacePtrsWithInts converts IR to a normal form in which functions don't reference any aggregate pointer types and pointer types only appear inside a few instructions. Change BlockAddress::replaceUsesOfWithOnConstant() to handle changing a function's type by replacing a function with a bitcast ConstantExpr of a new function. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=replace-ptrs-with-ints.ll + PNaCl toolchain trybots, torture tests, etc. Review URL: https://codereview.chromium.org/14262011
2013-05-22Merging r182485:Bill Wendling
------------------------------------------------------------------------ r182485 | arnolds | 2013-05-22 09:54:56 -0700 (Wed, 22 May 2013) | 7 lines LoopVectorize: Make Value pointers that could be RAUW'ed a VH The Value pointers we store in the induction variable list can be RAUW'ed by a call to SCEVExpander::expandCodeFor, use a TrackingVH instead. Do the same thing in some other places where we store pointers that could potentially be RAUW'ed. Fixes PR16073. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182492 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22Merging r182486:Bill Wendling
------------------------------------------------------------------------ r182486 | d0k | 2013-05-22 10:01:12 -0700 (Wed, 22 May 2013) | 3 lines X86: When expanding PCMPGTQ to PCMPGTD we always want to compare the lower halves as unsigned. Take #2 on fixing PR15977. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182489 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22PNaCl: Fix ExpandCtors to handle an empty list caseMark Seaborn
While writing a test, I noticed that ExpandCtors crashes if given the empty list "[]", because this gets converted into an UndefValue ConstantExpr by the LLVM assembly reader. Fix this by checking the array's size via its type. This replaces the isNullValue() check. Make error handling cleaner by splitting out a separate function. BUG=none TEST=test/Transforms/NaCl/expand-ctors-emptylist.ll Review URL: https://codereview.chromium.org/15659005
2013-05-21Merging r181363:Bill Wendling
------------------------------------------------------------------------ r181363 | cdavis | 2013-05-07 14:14:15 -0700 (Tue, 07 May 2013) | 3 lines MCStreamer: Also clear vector of W64UnwindInfos on reset(). Patch by Kai Nacke! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182439 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21Merging r181366:Bill Wendling
------------------------------------------------------------------------ r181366 | enderby | 2013-05-07 14:40:58 -0700 (Tue, 07 May 2013) | 6 lines Fix a bug in the MC asm parser evaluating expressions. It was treating: A = 9 B = 3 * A - 2 * A + 1 as B = 3 * A - (2 * A + 1) rdar://13816516 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182438 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21Merging r182385:Bill Wendling
------------------------------------------------------------------------ r182385 | hfinkel | 2013-05-21 07:21:09 -0700 (Tue, 21 May 2013) | 9 lines Fix PPC branch selection for counter-based branches Although I had added some support for the BDZ/BDNZ branches into the selector (in r158204), I had not correctly adjusted the condition at the top of the loop. As a result, these branches were still essentially unsupported. This fixes PR16086. Unfortunately, any test case would be very large (because it would need to force the loop backedge to exceed the range of the 16-bit immediate). ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21Merging r182387:Bill Wendling
------------------------------------------------------------------------ r182387 | jholewinski | 2013-05-21 07:37:16 -0700 (Tue, 21 May 2013) | 7 lines Drop @llvm.annotation and @llvm.ptr.annotation intrinsics during codegen. The intrinsic calls are dropped, but the annotated value is propagated. Fixes PR 15253 Original patch by Zeng Bin! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182417 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21Merging r182112:Bill Wendling
------------------------------------------------------------------------ r182112 | tstellar | 2013-05-17 08:23:12 -0700 (Fri, 17 May 2013) | 1 line R600: Pass MCSubtargetInfo reference to R600CodeEmitter ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182416 91177308-0d34-0410-b5e6-96231b3b80d8