Commit Graph

313160 Commits

Author SHA1 Message Date
Sam Clegg e3a845e25e Re-land "[WebAssembly] Improve invalid relocation error message""
See https://reviews.llvm.org/D59860

The initial version of this change effected more than just the
error message.  This version is scoped down to only effect the error
itself.

llvm-svn: 357328
2019-03-29 22:56:39 +00:00
Alina Sbirlea c8d6e0496d [MemorySSA] Temporary fix assert when reaching 0 limit.
llvm-svn: 357327
2019-03-29 22:55:59 +00:00
Artem Dergachev 44551cf693 [analyzer] Move taint API from ProgramState to a separate header. NFC.
It is now an inter-checker communication API, similar to the one that
connects MallocChecker/CStringChecker/InnerPointerChecker: simply a set of
setters and getters for a state trait.

Differential Revision: https://reviews.llvm.org/D59861

llvm-svn: 357326
2019-03-29 22:49:30 +00:00
Artem Dergachev 60cde76f70 [analyzer] PR37501: Disable assertion for logical op short circuit evaluation.
The transfer function for the CFG element that represents a logical operation
computes the value of the operation and does nothing else. The element
appears after all the short circuit decisions were made, so they don't need
to be made again at this point.

Because our expression evaluation is imprecise, it is often hard to
discriminate between:

  (1) we don't know the value of the RHS because we failed to evaluate it

and

  (2) we don't know the value of the RHS because it didn't need to be evaluated.

This is hard because it depends on our knowledge about the value of the LHS
(eg., if LHS is true, then RHS in (LHS || RHS) doesn't need to be computed)
but LHS itself may have been evaluated imprecisely and we don't know whether
it is true or not. Additionally, the Analyzer wouldn't necessarily even remember
what the value of the LHS was because theoretically it's not really necessary
to know it for any future evaluations.

In order to work around these issues, the transfer function for logical
operations consists in looking at the ExplodedGraph we've constructed so far
in order to figure out from which CFG direction did we arrive here.
Such post-factum backtracking that doesn't involve looking up LHS and RHS values
is usually possible. However sometimes it fails because when we deduplicate
exploded nodes with the same program point and the same program state we may end
up in a situation when we reached the same program point from two or more
different directions.

By removing the assertion, we admit that the procedure indeed sometimes fails to
work. When it fails, we also admit that we don't know the value of the logical
operator.

Differential Revision: https://reviews.llvm.org/D59857

llvm-svn: 357325
2019-03-29 22:43:34 +00:00
Sanjoy Das 53a5952a93 Try to fix buildbot error
Error is:

llvm/lib/Analysis/ScalarEvolution.cpp:3534:10: error: chosen constructor is explicit in copy-initialization
  return {UniqueSCEVs.FindNodeOrInsertPos(ID, IP), std::move(ID), IP};
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/tuple:479:19: note: explicit constructor declared here
        constexpr tuple(_UElements&&... __elements)
                  ^
1 error generated.

llvm-svn: 357324
2019-03-29 22:27:10 +00:00
Artem Dergachev 6b39f10a00 [analyzer] Introduce a simplified API for adding custom path notes.
Almost all path-sensitive checkers need to tell the user when something specific
to that checker happens along the execution path but does not constitute a bug
on its own. For instance, a call to operator delete in C++ has consequences
that are specific to a use-after-free bug. Deleting an object is not a bug
on its own, but when the Analyzer finds an execution path on which a deleted
object is used, it'll have to explain to the user when exactly during that path
did the deallocation take place.

Historically such custom notes were added by implementing "bug report visitors".
These visitors were post-processing bug reports by visiting every ExplodedNode
along the path and emitting path notes whenever they noticed that a change that
is relevant to a bug report occurs within the program state. For example,
it emits a "memory is deallocated" note when it notices that a pointer changes
its state from "allocated" to "deleted".

The "visitor" approach is powerful and efficient but hard to use because
such preprocessing implies that the developer first models the effects
of the event (say, changes the pointer's state from "allocated" to "deleted"
as part of operator delete()'s transfer function) and then forgets what happened
and later tries to reverse-engineer itself and figure out what did it do
by looking at the report.

The proposed approach tries to avoid discarding the information that was
available when the transfer function was evaluated. Instead, it allows the
developer to capture all the necessary information into a closure that
will be automatically invoked later in order to produce the actual note.

This should reduce boilerplate and avoid very painful logic duplication.

On the technical side, the closure is a lambda that's put into a special kind of
a program point tag, and a special bug report visitor visits all nodes in the
report and invokes all note-producing closures it finds along the path.

For now it is up to the lambda to make sure that the note is actually relevant
to the report. For instance, a memory deallocation note would be irrelevant when
we're reporting a division by zero bug or if we're reporting a use-after-free
of a different, unrelated chunk of memory. The lambda can figure these thing out
by looking at the bug report object that's passed into it.

A single checker is refactored to make use of the new functionality: MIGChecker.
Its program state is trivial, making it an easy testing ground for the first
version of the API.

Differential Revision: https://reviews.llvm.org/D58367

llvm-svn: 357323
2019-03-29 22:21:00 +00:00
Sam Clegg 31a991eeba [libc++abi] Don't set POSITION_INDEPENDENT_CODE when building static library
With the current WebAssembly backend, objects built with -fPIC are not
compatible with static linking.  libc++abi was (mistakenly?) adding
-fPIC to the objects it was including in a static library.

IIUC this change should also mean the static build can be more efficient
on all platforms.

Differential Revision: https://reviews.llvm.org/D60005

llvm-svn: 357322
2019-03-29 22:08:56 +00:00
Thomas Lively 5f0c4c67bb [WebAssembly] Add mutable globals feature
Summary:
This feature is not actually used for anything in the WebAssembly
backend, but adding it allows users to get it into the target features
sections of their objects, which makes these objects
future-compatible.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D60013

llvm-svn: 357321
2019-03-29 22:00:18 +00:00
Sanjoy Das 32fd32bc6f [SCEV] Check the cache in get{S|U}MaxExpr before doing any work
Summary:
This lets us avoid e.g. checking if A >=s B in getSMaxExpr(A, B) if we've
already established that (A smax B) is the best we can do.

Fixes PR41225.

Reviewers: asbirlea

Subscribers: mcrosier, jlebar, bixia, jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60010

llvm-svn: 357320
2019-03-29 22:00:12 +00:00
Alina Sbirlea f085cc5aa7 [MemorySSA] Limit clobber walks.
Summary: This patch limits all getClobberingMemoryAccess() walks to MaxCheckLimit.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59569

llvm-svn: 357319
2019-03-29 21:56:09 +00:00
Jessica Paquette d3ffd47df9 [GlobalISel][AArch64] Add isel support for G_INSERT_VECTOR_ELT on v2s32s
This adds support for v2s32 vector inserts, and updates the selection +
regbankselect tests for G_INSERT_VECTOR_ELT.

Differential Revision: https://reviews.llvm.org/D59910

llvm-svn: 357318
2019-03-29 21:39:36 +00:00
Amara Emerson d413f41de6 [X86] When using Win64 ABI, exit with error if SSE is disabled for varargs
We need XMM registers to handle varargs with the Win64 ABI. Before we would
silently generate bad code resulting in an assertion failure elsewhere in the
backend.

llvm-svn: 357317
2019-03-29 21:30:51 +00:00
Alexandre Ganea b13f064b5d Fix build following r357308 : Ensure only live thunks are considered when creating import modules
llvm-svn: 357316
2019-03-29 21:24:19 +00:00
Alina Sbirlea e589067e61 [MemorySSA] Don't optimize incomplete phis.
Summary:
MemoryPhis cannot be optimized out until they are complete.
Resolves PR41254.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59966

llvm-svn: 357315
2019-03-29 21:16:31 +00:00
Reid Kleckner ba708619ad Don't copy the .drective section with std::string
Both COFF and bitcode input files expose these as stable strings.

llvm-svn: 357314
2019-03-29 21:00:22 +00:00
Jonas Devlieghere 6f8251fb38 [ScriptInterpreterPython] Fix the unit test after refactor
llvm-svn: 357313
2019-03-29 20:56:52 +00:00
Alexander Kornienko 397ee70180 [clang-tidy] Fix PR28406
Fix the crash resulting from a careless use of getLocWithOffset. At the
beginning of a macro expansion it produces an invalid SourceLocation that causes
an assertion failure later on.

llvm-svn: 357312
2019-03-29 20:55:29 +00:00
Thomas Lively 06391f34bd [WebAssembly] "atomics" feature requires shared memory
Summary:
Makes it a linker error if the "atomics" feature is used but the user
does not opt in to shared memory or if "atomics" is disallowed but the
user does opt in to shared memory. Also check that an appropriate max
memory size is supplied if shared memory is used.

Reviewers: sbc100, aheejin

Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59281

llvm-svn: 357310
2019-03-29 20:43:49 +00:00
Nirav Dave 54f7118de5 [DAGCombiner] Rewrite ImproveLifetimeNodeChain to avoid DAG loop.
Avoid EXPENSIVE_CHECK failure. NFCI.

llvm-svn: 357309
2019-03-29 20:26:23 +00:00
Alexandre Ganea 09cca5b243 [LLD][COFF] Generate import modules & COFF groups in PDB
Generate import modules for each imported DLL, along with its symbol stream.
Also create COFF groups in the * Linker * module, one for each PartialSection (input, unmerged sections)
Currently COFF groups are disabled for MINGW because it significantly increases PDB sizes. We could enable that later with an option.

The overall objective for this change is to support code hot patching tools. Such tools need to know the import libraries used, from the PDB alone.

Differential Revision: https://reviews.llvm.org/D54802

llvm-svn: 357308
2019-03-29 20:25:34 +00:00
Jonas Devlieghere 63dd5d2518 [Python] Remove Python include from ScriptInterpreterPython.h
This patch limits the scope of the python header to the implementation
of the python script interpreter plugin. ScriptInterpreterPython is now
an abstract interface that doesn't expose any Python specific types, and
is implemented by the ScriptInterpreterPythonImpl.

Differential revision: https://reviews.llvm.org/D59976

llvm-svn: 357307
2019-03-29 20:17:20 +00:00
Louis Dionne c7c6413119 [pstl] Qualify calls to internal functions
This guards against unintended ADL issues.
Thanks to Thomas Rogers for the patch.

Differential Revision: https://reviews.llvm.org/D60009

llvm-svn: 357306
2019-03-29 20:11:24 +00:00
Alexandre Ganea 347a45ccd5 [LLD][COFF] Improve checkFailIfMismatch()
As suggested by ruiu here (https://reviews.llvm.org/D58910#1425484), defer a call to toString(File) until it's really needed (if there's an error)

Differential Revision: https://reviews.llvm.org/D59411

llvm-svn: 357305
2019-03-29 19:58:58 +00:00
Erik Pilkington 233ff94212 [Sema] Avoid sending a dependent expression to the constant evaluator.
Fixes llvm.org/PR41286

llvm-svn: 357304
2019-03-29 19:53:41 +00:00
Heejin Ahn 67f74aceab [WebAssembly] Handle END_LOOP in unreachable BB in CFGStackify
Summary:
This fixes crashes when a BB in which an END_LOOP is to be placed is
unreachable and does not have any predecessors. Fixes PR41307.

Reviewers: dschuff

Subscribers: yurydelendik, sbc100, jgravelle-google, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60004

llvm-svn: 357303
2019-03-29 19:36:51 +00:00
Matt Arsenault 055e4dce45 AMDGPU: Remove dx10-clamp from subtarget features
Since this can be set with s_setreg*, it should not be a subtarget
property. Set a default based on the calling convention, and Introduce
a new amdgpu-dx10-clamp attribute to override this if desired.

Also introduce a new amdgpu-ieee attribute to match.

The values need to match to allow inlining. I think it is OK for the
caller's dx10-clamp attribute to override the callee, but there
doesn't appear to be the infrastructure to do this currently without
definining the attribute in the generic Attributes.td.

Eventually the calling convention lowering will need to insert a mode
switch somewhere for these.

llvm-svn: 357302
2019-03-29 19:14:54 +00:00
Simon Pilgrim d395bc1cc2 [Hexagon] Remove fcmp undef from reduced tests
Pre-commit for D60006 (Add fcmp UNDEF handling to SelectionDAG::FoldSetCC)

Approved by @kparzysz (Krzysztof Parzyszek)

llvm-svn: 357301
2019-03-29 19:14:52 +00:00
Craig Topper 103fbbbfca [X86] Add test cases showing failure to use RMW form of negate when only flags are used. NFC
llvm-svn: 357300
2019-03-29 19:09:37 +00:00
Nirav Dave 7e84cacdbd [DAG] Avoid redundancy in StoreMerge TokenFactor generation.
Avoid generating redundant TokenFactor when all merged stores have
the same chain.

llvm-svn: 357299
2019-03-29 18:50:22 +00:00
Volodymyr Sapsai 9e911f3a64 [Sema] Fix assertion when `auto` parameter in lambda has an attribute.
Fixes the assertion
> no Attr* for AttributedType*
> UNREACHABLE executed at llvm-project/clang/lib/Sema/SemaType.cpp:298!

In `TypeProcessingState::getAttributedType` we put into `AttrsForTypes`
types with `auto` but later in
`TypeProcessingState::takeAttrForAttributedType` we use transformed
types and that's why cannot find `Attr` corresponding to
`AttributedType`.

Fix by keeping `AttrsForTypes` up to date after replacing `AutoType`.

rdar://problem/47689465

Reviewers: rsmith, arphaman, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits

Differential Revision: https://reviews.llvm.org/D58659

llvm-svn: 357298
2019-03-29 18:47:07 +00:00
Craig Topper 4ccb3b96b6 [X86] Use cached OptForSize in X86ISelDAGToDAG.cpp instead of pulling it from the function attribute. NFCI
llvm-svn: 357297
2019-03-29 18:36:40 +00:00
Dan Albert 50e18a250f [Driver] Use --warn-shared-textrel for Android.
Android does not allow shared text relocations. Enable the linker
warning to detect them by default.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D53344

llvm-svn: 357296
2019-03-29 18:34:25 +00:00
Simon Pilgrim 759cbee744 [SystemZ] Regenerate double constant comparison test
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357295
2019-03-29 18:23:08 +00:00
Simon Pilgrim 05e2621342 [MIPS] Regenerate double constant comparison test
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357294
2019-03-29 18:22:18 +00:00
Simon Pilgrim a3fb3d5583 [ARM] Regenerate execute-only float comparison tests
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357293
2019-03-29 18:21:19 +00:00
Jonas Devlieghere 05f1dd9362 [ScriptInterpreterPython] Remove unused field (NFC)
The m_lldb_module was initialized but not used.

llvm-svn: 357292
2019-03-29 17:58:07 +00:00
Sanjay Patel 01c07b1a45 [InstCombine] autogenerate complete checks; NFC
llvm-svn: 357291
2019-03-29 17:51:39 +00:00
George Burgess IV 5456beb944 Various fixes and additions to creduce-clang-crash.py
Some more additions to the script - mainly reducing the clang args after
the creduce run by removing them one by one and seeing if the crash
reproduces. Other things:

- remove the --crash flag when "fatal error" occurs
- fixed to read stack trace functions from the top
- run creduce on a copy of the original file

Patch by Amy Huang!

Differential Revision: https://reviews.llvm.org/D59725

llvm-svn: 357290
2019-03-29 17:50:43 +00:00
Scott Linder 0bc9f15ddd [AMDGPU] Add an additional Code Object V3 assembler example
Document the intended use of the `.amdgcn.next_free_{s,v}gpr` in the
context of multiple kernels and functions.

Differential Revision: https://reviews.llvm.org/D59949

llvm-svn: 357289
2019-03-29 17:49:51 +00:00
Sanjay Patel 2bff8b4272 [InstCombine] regenerate test checks; NFC
llvm-svn: 357288
2019-03-29 17:47:51 +00:00
Jonas Devlieghere 4d63d8cf75 [CMake] Move link dependencies where they are used.
The utility library shouldn't depend on curses, libedit or python. Move
curses to core, libedit to host and python to the python plugin.

Differential revision: https://reviews.llvm.org/D59970

llvm-svn: 357287
2019-03-29 17:47:26 +00:00
Simon Pilgrim dee8a14389 [AArch64] Regenerate half precision tests
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357286
2019-03-29 17:46:06 +00:00
Scott Linder a377be6eb6 [AMDGPU] Switch default DWARF version to 5
Effectively reverts r337612. The issues that cropped up with the last
attempt appear to have gone away.

Differential Revision: https://reviews.llvm.org/D59008

llvm-svn: 357285
2019-03-29 17:45:40 +00:00
Mircea Trofin b27d0fd0bf [llvm][NFC] Factor out logic for getting incoming & back Loop edges
Reviewers: davidxl

Reviewed By: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59967

llvm-svn: 357284
2019-03-29 17:39:17 +00:00
Nirav Dave fe59e14031 [DAGCombine] Prune unnused nodes.
Summary:
Nodes that have no uses are eventually pruned when they are selected
from the worklist. Record nodes newly added to the worklist or DAG and
perform pruning after every combine attempt.

Reviewers: efriedma, RKSimon, craig.topper, spatel, jyknight

Reviewed By: jyknight

Subscribers: jdoerfert, jyknight, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, jsji, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58070

llvm-svn: 357283
2019-03-29 17:35:56 +00:00
Jonas Devlieghere ae1cc995e3 [Cmake] Unify python variables
FindPythonInterp and FindPythonLibs do two things, they set some
variables (PYTHON_LIBRARIES, PYTHON_INCLUDE_DIRS) and update the cached
variables (PYTHON_LIBRARY, PYTHON_INCLUDE_DIR) which are also used to
specify a custom python installation.

I believe the canonical way to do this is to use the PYTHON_LIBRARIES
and PYTHON_INCLUDE_DIRS variables instead of the cached ones. However,
since the cached variables are accessible from the cache and GUI, this
is a lot less confusing when you're trying to debug why a variable did
or didn't get the value you expected. Furthermore, as far as I can tell,
the implementation uses the cached variables to set their LIBRARIES/DIRS
counterparts. This is also the reason this works today even though we
mix-and-match.

Differential revision: https://reviews.llvm.org/D59968

llvm-svn: 357282
2019-03-29 17:35:42 +00:00
Simon Pilgrim b4b98a528b [ARM] Regenerate vector comparison tests
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357281
2019-03-29 17:35:11 +00:00
Evandro Menezes 0f797b8732 [CodeGen] Refactor the option for the maximum jump table size
Refactor the option `max-jump-table-size` to default to the maximum
representable number.  Essentially, NFC.

llvm-svn: 357280
2019-03-29 17:28:11 +00:00
Nirav Dave 610036c506 [DAG] Set up infrastructure to avoid smart constructor-based dangling nodes
Summary:
Various SelectionDAG non-combine operations (e.g. the getNode smart
constructor and legalization) may leave dangling nodes by applying
optimizations without fully pruning unused result values. This results
in nodes that are never added to the worklist and therefore can not be
pruned.

Add a node inserter for the combiner to make sure such nodes have the
chance of being pruned. This allows a number of additional peephole
optimizations.

Reviewers: efriedma, RKSimon, craig.topper, jyknight

Reviewed By: jyknight

Subscribers: msearles, jyknight, sdardis, nemanjai, javed.absar, hiraditya, jrtc27, atanasyan, jsji, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58068

llvm-svn: 357279
2019-03-29 17:26:40 +00:00
Simon Pilgrim 4e00a93558 [X86] Fix some tests using fcmp with undef arguments
Prep work for PR40800 (Add UNDEF handling to SelectionDAG::FoldSetCC) 

llvm-svn: 357278
2019-03-29 17:20:27 +00:00