Age | Commit message (Collapse) | Author |
|
When GlobalOpt has determined that a GlobalVariable only ever has two values,
it would convert the GlobalVariable to a boolean, and introduce SelectInsts
at every load, to choose between the two possible values. These SelectInsts
introduce overhead and other unpleasantness.
This patch makes GlobalOpt just add range metadata to loads from such
GlobalVariables instead. This enables the same main optimization (as seen in
test/Transforms/GlobalOpt/integer-bool.ll), without introducing selects.
The main downside is that it doesn't get the memory savings of shrinking such
GlobalVariables, but this is expected to be negligible.
|
|
some places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
By using a reverse-postorder traversal of the basic blocks, we can perform
this transform in a single pass. This eliminates the need for tricky
coordination between the passes.
|
|
|
|
|
|
The initial version of ExceptionInfoWriter.cpp encodes a landingpad's
"cleanup" clause the same as "catch i8* null" (a catch-all).
But it turns out we do want to distinguish these two: If an uncaught
exception occurs, we don't want the runtime to run C++ destructors
(cleanups), because this involves unwinding the stack to jump to
landingpads, which loses the context of where the uncaught exception
was thrown from, which is unhelpful for debugging. (The C++ standard
says it's optional whether destructors are run when an uncaught
exception occurs.)
So, change the encoding as follows:
* Use 0 as the ID for "cleanup" clauses.
* Add 1 to the IDs of types and "catch" clauses. (Adding 1 to both
seems neater than just one of them.)
* This means we can use 0 for the terminator of filter lists instead
of -1, which seems a little neater.
This requires a corresponding change to eh_pnacl.cc in libsupc++.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696
TEST=NaCl's EH tests with libsupc++ change applied
Review URL: https://codereview.chromium.org/69923008
|
|
that may affect them, to clearing before operations that may be affected
This is just a cleanup that doesn't have any significant performance or
functionality impact, but I thought it might make fixing bug 3714 a bit
simpler.
R=mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3714
Review URL: https://codereview.chromium.org/59533011
|
|
no uses.
This was the deeper cause of the issues I fixed in https://codereview.chromium.org/33233002/ and is therefore a better fix. (The problem was that StripDeadPrototypes was not stripping a variable that was actually dead because the bitcast constexpr inserted by FlattenGlobals referred to it.) I reverted most of that CL's changes, though not the comment and test cleanup.
R=dschuff@chromium.org
TEST= pnacl-clang++ pnacl/git/libcxx/test/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp -stdlib=libc++
Review URL: https://codereview.chromium.org/34843003
|
|
libc++'s iostream values are extern, and never actually used in the headers (unlike libstdc++'s) which means that including iostream and doing something like (void)std::clog used to leave a global external ostream object declaration without a definition, which cause PNaCl's module ABI verifier to fail ('has no initializer' and 'is not a valid external symbol').
R=dschuff@chromium.org
BUG= http://code.google.com/p/nativeclient/issues/detail?id=3623
TEST= globalcleanup.ll
Review URL: https://codereview.chromium.org/33233002
|
|
setjmp()+longjmp()
There are two parts to this:
* PNaClSjLjEH.cpp expands out the "invoke", "landingpad" and "resume"
instructions, modifying the control flow to use setjmp().
* ExceptionInfoWriter.cpp lowers landingpads' clause lists to data
that PNaCl's C++ runtime library will interpret. This part will be
reused when we drop the SjLj part and create a stable ABI for
zero-cost EH.
This pass isn't enabled in PNaClABISimplify yet: I'll do that in a
separate change.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696
TEST=*.ll tests (also tested end-to-end: plumbing for this will follow later)
Review URL: https://codereview.chromium.org/24777002
|
|
See:
http://llvm.org/viewvc/llvm-project?view=revision&revision=187787
The newer version of newlib tickles this x86-32 bug
when building the exception handling tests, which don't
strip the "tail" attribute.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3702
Waiting on trybots, but it seems to have fixed the minimal
reproducer I have:
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/922
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/870
http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/875
R=jfb@chromium.org
Review URL: https://codereview.chromium.org/26538008
|
|
The pass gets confused in some cases when library functions get passed to
other functions as arguments, because use_iterator returns the call instruction.
The existing test (rewrite-longjmp-noncall-uses.ll) did not catch this problem
because there a bitcast constexpr was applied to the library function pointer,
and it came up as the use instead of the containing call.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3706
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/26952003
|
|
Cherry-pick r191978 from upstream.
Original commit message:
Author: Akira Hatanaka <ahatanaka@mips.com>
Date: Fri Oct 4 20:51:40 2013 +0000
[mips] Fix a bug in MipsLongBranch::replaceBranch, which was erasing
instructions in delay slots along with the original branch instructions
This has to be cherrypicked, as it is a bug in backend. It was exposed in
a long function inside of llc, which caused llc.nexe to work incorrectly.
TBR= mseaborn@chromium.org, dschuff@chromium.org
BUG= bug in MIPS backend
Review URL: https://codereview.chromium.org/26933005
|
|
Cherry-pick r187244 from upstream.
Original commit message:
Author: Akira Hatanaka <ahatanaka@mips.com>
Date: Fri Jul 26 20:58:55 2013 +0000
[mips] Implement llvm.trap intrinsic.
Patch by Sasa Stankovic.
This has to be cherrypicked, as two tests fail due to missing llvm.trap
intrinsic. The tests are:
- run_sysbrk_test
- run_abi_types_test
TBR= mseaborn@chromium.org, dschuff@chromium.org
BUG= sysbrk and abi_types tests fail for MIPS
Review URL: https://codereview.chromium.org/26953003
|
|
Cherry-pick r185186 from upstream.
Original commit message:
Author: Lang Hames <lhames@gmail.com>
Date: Fri Jun 28 18:36:42 2013 +0000
Add missing case to switch statement - DAGTypeLegalizer::ExpandIntegerResult
should expand ATOMIC_CMP_SWAP nodes the same way that it does for ATOMIC_SWAP.
Since ATOMIC_LOADs on some targets (e.g. older ARM variants) get legalized to
ATOMIC_CMP_SWAPs, the missing case had been causing i64 atomic loads to crash
during isel.
This has to be cherry-picked, as we have experienced the same bug described
in the original message. Missing case caused MIPS 64 atomics to crash.
TBR= mseaborn@chromium.org, dschuff@chromium.org
BUG= crash for MIPS atomics
Review URL: https://codereview.chromium.org/26958002
|
|
Cherry-pick r182306 from upstream.
Original commit message:
Author: Akira Hatanaka <ahatanaka@mips.com>
Date: Mon May 20 18:07:43 2013 +0000
[mips] Trap on integer division by zero.
By default, a teq instruction is inserted after integer divide. No divide-by-zero
checks are performed if option "-mnocheck-zero-division" is used.
TBR= mseaborn@chromium.org, dschuff@chromium.org
BUG= missing trap for MIPS
Review URL: https://codereview.chromium.org/26846007
|
|
The PNaCl bitcode writer had some complex logic for deciding when to
omit casts in the output. This was left over from when the writer was
trying to leave in the casts in some but not all cases (as part of
incrementally removing casts).
This is no longer needed now that the writer just omits all inttoptrs,
all ptrtoints, and all pointer bitcasts.
This cleanup also fixes the writer so that it elides an inttoptr of a
ptrtoint. This sequence is allowed by the PNaCl ABI verifier, but
never occurred in practice because ReplacePtrsWithInts'
SimplifyCasts() function converts this sequence to an equivalent
bitcast. Before this change, the writer would give this error for an
inttoptr-of-ptrtoint:
LLVM ERROR: Illegal (PNaCl ABI) pointer cast : %1 = ptrtoint [4 x i8]* @bytes to i32
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=toolchain trybots
Review URL: https://codereview.chromium.org/25817002
|
|
Its handling is the same as add (may overflow, may set upper bits)
R=jvoung@chromium.org, mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3599
Review URL: https://codereview.chromium.org/24244008
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23503071
|
|
GCC bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416
causes the bf64-1.c test to fail in the GCC torture test suite.
This provides an upstreamable workaround.
Inspection of the LLVM code base showed no other instances of
the pattern that triggers the gcc bug.
This can also be upstreamed as soon as I can get a working
x86-32 upstream build working to verify/test against. In the
meantime, we can make one pnacl-fyi bot go green again.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3685
R=jfb@chromium.org, jfb@google.com
Review URL: https://codereview.chromium.org/23437037
|
|
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
+ NaCl's toolchain_tests with bitcode v2 enabled
Review URL: https://codereview.chromium.org/23523041
|
|
There are now no uses of pointer type IDs in PNaCl bitcode, so we can
stop outputting pointer types into the type table.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/23600013
|
|
Before, FORWARDTYPEREFs used i8* type rather than i32 if they
referenced an "alloca" instruction.
Clean this up so that FORWARDTYPEREFs use i32 instead in this case.
Note that this means that a forward-referenced "alloca" can be used
via an ptrtoint+inttoptr, rather than a bitcast, but that's no
problem.
This is a step towards removing TYPE_CODE_POINTER from the types
table, to simplify the PNaCl bitcode format.
Rename NormalizeParamType() to NormalizeScalarType() to reflect that
it's used in more cases; make it public.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=test/NaCl/Bitcode/*.ll
Review URL: https://codereview.chromium.org/23719016
|
|
Change the writer to strip pointer types from intrinsics' argument and
return types, replacing them with i32. This simplifies the PNaCl
bitcode format so that pointer types don't need to be represented
here.
Change the reader to restore the pointer types so that the intrinsic
declarations pass the LLVM and PNaCl verifiers.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=intrinsic tests in call-elide.ll
+ intrinsic-pointer-args.ll
+ run small_tests with bitcode v2 enabled
Review URL: https://codereview.chromium.org/23793005
|
|
* Removes code that is no longer used because global variables are handled
separately.
* Removes CST_CODE_NULL.
* Adds special abbreviations for constant integer 0, replacing
most of what was lost when CST_CODE_NULL is removed.
* Adds abbreviation for floating point constants.
* Removes CST_CODE_AGGREGATE and CST_CODE_DATA, except for reading
old PNaCl version 1 bitcode files.
* Removes call to ParseConstants() in ParseModule() since the module
block no longer contains a constants block (globals are handled
separately).
* Removes getConstantFwdRef() method, since it is no longer needed.
* Remove ConstantPlaceHolder class, since it is no longer needed.
* Remove ResolvedConstants and ResolveConstantForwardRefs()
from the bitcode reader, since it is no longer needed.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3668
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23522024
|
|
Remove an unused "i32* %ptr" argument from a couple of test cases.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=call-elide.ll
Review URL: https://codereview.chromium.org/23945004
|
|
Pointer-typed arguments are only allowed for intrinsics, so change the
test of pointer-args to call an intrinsic.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=call-elide.ll
Review URL: https://codereview.chromium.org/23735008
|
|
For indirect call instructions (INST_CALL_INDIRECT), it's not
necessary to store the full function type. The argument types are
already known from the arguments in the instruction. We only need to
store the return type to be able to reconstruct the full function
type.
Storing only the return type ID will make the bitcode a little more
compact. Return type IDs will be frequently-used scalar types, which
can be given smaller type IDs than function types, which are less
frequently used.
This potentially makes the writer simpler: In principle, the writer no
longer needs to make a pass across all functions' bodies to determine
which function types are used in order to build the type table.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544
TEST=*.ll tests
Review URL: https://codereview.chromium.org/23521005
|
|
The type ID for the "label" type is never referenced.
The "label" type was only being added to the type table because
EnumerateType() treats BasicBlock and Value operands the same.
However, the rest of the reader and writer treat BasicBlock operands
specially and not like other Values.
Change some tests to use wildcards for some type IDs. This is so that
I don't have to update all the type ID numbers now that the generated
type tables have changed.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=run small_tests with v2 bitcode format enabled
Review URL: https://codereview.chromium.org/23530031
|
|
The value selector list for switch statements are represented using
ARRAY/VECTOR constants, but this information is not put into the bitcode file.
This CL changes the value enumerator to not emit these constants.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3649
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23653013
|
|
Make the bitcode reader stricter, so that it disallows pointer
arguments in indirect function calls, which are disallowed by the
PNaCl ABI checker. Pointer arguments in function calls are only
allowed in intrinsic calls, and calls to intrinsics must always be
direct calls, not indirect calls.
This involves removing two tests that specifically test for pointer
args.
This is in preparation for tweaking how indirect calls are
represented, so that they store the call's return type rather than the
function type.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544
TEST=*.ll tests
Review URL: https://codereview.chromium.org/23660005
|
|
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow STRUCT_ANON in bitcode files PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23455023
|
|
For PNaClVersion==2, removes remaining pointer casts from bitcode files.
This includes:
* Return value can be casted to a scalar value.
* Intrinsic calls may return an inherent pointer, which may
need casting to a scalar value.
Also modifies tests bitcast-elide.ll and inttoptr-elide.ll
by removing tests that assumed there were remaining pointer
bitcasts that do not get removed.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23524003
|
|
Localmods came from: https://codereview.chromium.org/10825082/, and earlier.
(1) The original change was so that byval parameters always
go on the stack. That part was added because the original
ARM code was buggy, and did not actually make a copy of the
value, modifying the caller's struct (ouch!).
(2) Then came a localmod to make all arguments following a
byval go on the stack and to make the var-args code aware of
that. This is so that arguments stay in the correct order
for var-args to pick up.
For (1) there has been some work upstream to make it work
better. In any case, clang with --target=armv7a-...-gnueabi
only used byval in some limited cases -- when the size of
the struct is > 64 bytes where the backend will know
that part of it could be in regs, and the rest can be
memcpy'ed to the stack.
For le32, clang will still generate byval without
satisfying the same ARM condition (only for structs
bigger than 64 bytes), so it could be *very bad* if
we didn't have the ABI simpification passes rewrite
the byval and try to let the ARM backend do things
with byval...
TEST=the GCC torture tests: va-arg-4.c, and 20030914-2.c
and the example in issue 2746 still pass.
BUG=none, cleanup
R=dschuff@chromium.org
Review URL: https://codereview.chromium.org/23691009
|
|
This reverts commit 2302e5d39e2302962d1a0e45d60e00ed47b9b061.
BUG=
R=eliben@chromium.org
Review URL: https://codereview.chromium.org/23827002
|
|
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow and STRUCT records in bitcode files
when PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23431008
|
|
Named struct types should not appear in LLVM IR that passes the PNaCl
ABI verifier.
Remove the test struct-types.ll because it no longer passes.
Handling of TYPE_CODE_STRUCT_ANON must remain for now until this issue
is fixed: https://code.google.com/p/nativeclient/issues/detail?id=3648
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23490018
|
|
This also should complete the changes associated with removing pointer cast
instructions from the PNaCl bitcode file.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=dschuff@chromium.org, jvoung@chromium.org
Review URL: https://codereview.chromium.org/23482002
|
|
Handles the eliding of pointer to integer casts operands of the phi node.
Also caches unelided casts generated in the reader (removing
duplicates within the same block). This reduces the size of
thawed pnacl-llc.pexe by about 2%.
BUG= https://code.google.com/p/nativeclient/issues/detailid=3544
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/22909016
|
|
Removes ptrtoint instructions when applicable (currently only in stores), and add them back just before their use.
Note: This code does not handle ptrtoint casts for calls and phi nodes, binary operators, etc. because handling of casts for these instructions has not been added yet.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/22633002
|
|
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3627
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23060004
|
|
16-bit atomics aren't handled properly by the current validator, this patch changes the translator so that on x86-32 it emulates 16-bit atomics with 32-bit atomics in a compare-exchange loop.
TEST= ./scons run_synchronization_sync_test bitcode=1 platform=x86-32
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3579
BUG= https://code.google.com/p/nativeclient/issues/detail?id=2981
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475
R=dschuff@chromium.org
Review URL: https://codereview.chromium.org/22760002
|
|
This is a follow-up to:
https://codereview.chromium.org/22240002/
And requires the Clang changes from:
https://codereview.chromium.org/22294002/
This new intrinsic represents ``asm("":::"~{memory}")`` as well as ``__sync_synchronize()``, and in IR it corresponds to a sequentially-consistent fence surrounded by ``call void asm sideeffect "", "~{memory}"()``.
R=jvoung@chromium.org
TEST= ninja check-all
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475
Review URL: https://codereview.chromium.org/22474008
|
|
Fixes so that the volatile bit is no longer put into the bitcode file,
since the volatile bit is not in the PNaCl ABI.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3610
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/21949006
|