20690 Commits

Author SHA1 Message Date
Craig Topper
b4dab097da [InstCombine] Fix incorrect usage of getPrimitiveSizeInBits when we should be using the element size for vectors
For vectors, getPrimitiveSizeInBits returns the full vector width. This code should using the element size for vectors. This could be fixed by calling getScalarSizeInBits, but its even easier to just get it from the APInt we're checking.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 17:57:20 +00:00
Florian Hahn
451b5b8c5a [CallSiteSplitting] Add debug location to created PHI nodes.
There are 2 cases when we create PHI nodes:
 * For the result of the call that was duplicated in the split blocks.
   Those PHI nodes should have the debug location of the call.

 * For values produced before the call. Those instructions need to be
   duplicated in the split blocks and the PHI nodes should have the
   debug locations of those instructions.

Fixes PR37962.

Reviewers: junbuml, gbedwell, vsk

Reviewed By: junbuml

Tags: #debug-info

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341970 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 17:55:58 +00:00
Matt Morehouse
6c62511795 Revert "[SanitizerCoverage] Create comdat for global arrays."
This reverts r341951 due to bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341965 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 17:20:14 +00:00
Craig Topper
9d207e5918 [InstCombine] Use dyn_cast instead of match(m_Constant). NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341962 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 16:51:26 +00:00
Craig Topper
a0b208b805 [InstCombine] Support (mul (sext x), cst) --> (sext (mul x, cst')) and (mul (zext x), cst) --> (zext (mul x, cst')) for vectors constants.
Similar to D51236, but for mul instead of add.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341961 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 16:51:24 +00:00
Alexandros Lamprineas
95b0318677 [GVNHoist] Re-enable GVNHoist by default
Rebase rL340922 since https://bugs.llvm.org/show_bug.cgi?id=38807
has been fixed by rL341947.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341954 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 15:55:45 +00:00
Matt Morehouse
18dd74a3d2 [SanitizerCoverage] Create comdat for global arrays.
Summary:
Place global arrays in comdat sections with their associated functions.
This makes sure they are stripped along with the functions they
reference, even on the BFD linker.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: eraman, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 15:23:14 +00:00
Johannes Doerfert
d690862bbc [FuncAttrs] Remove "access range attributes" for read-none functions
The presence of readnone and an access range attribute (argmemonly,
inaccessiblememonly, inaccessiblemem_or_argmemonly) is considered an
error by the verifier. This seems strict but also not wrong. This
patch makes sure function attribute detection will remove all access
range attributes for readnone functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341927 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 11:51:29 +00:00
Serguei Katkov
7cee7a5682 [LICM] Avoid duplicate work during building AliasSetTracker
Currently we re-use cached info from sub loops or traverse them
to populate AliasSetTracker. But after that we traverse all basic blocks
from the current loop. This is redundant work.

All what we need is traversing the all basic blocks from the loop except
those which are used to get the data from the cache.

This should improve compile time only.

Reviewers: mkazantsev, reames, kariddi, anna
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51715


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341896 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 04:07:36 +00:00
Max Kazantsev
3b81e5c28a [IndVars][NFC] Refactor to make modifications of Changed transparent
IndVarSimplify's design is somewhat odd in the way how it reports that
some transform has made a change. It has a `Changed` field which can
be set from within any function, which makes it hard to track whether or
not it was set properly after a transform was made. It leads to oversights
in setting this flag where needed, see example in PR38855.

This patch removes the `Changed` field, turns it into a local and unifies
the signatures of all relevant transform functions to return boolean value
which designates whether or not this transform has made a change.

Differential Revision: https://reviews.llvm.org/D51850
Reviewed By: skatkov


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341893 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 03:57:22 +00:00
Philip Reames
d15dc0bfc9 [LICM] (re-)simplify code using MemoryLocation API [NFC]
I'd made exactly this same change before, but it appears to have been accidentally reverted in another change.  (I'm assuming accidental since it was without comment or test case, and in an unrelated change.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341892 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 03:28:28 +00:00
Alina Sbirlea
5ec364705c [InstCombine] Partially revert rL341674 due to PR38897.
Summary:
Revert min/max changes in rL341674 dues to high compile times causing timeouts (PR38897).
Checking in to unblock failing builds. Patch available for post-commit review and re-revert once resolved.
Working on a smaller reproducer for PR38897.

Reviewers: craig.topper, spatel

Subscribers: sanjoy, jlebar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341883 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 23:47:21 +00:00
Sanjay Patel
4eef9f6908 [InstCombine] use SelectInst operand names to make code clearer; NFC
Cleanup step for D51433.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341850 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 18:37:59 +00:00
Sebastian Pop
d126aab2ef HotColdSplitting: check that target supports cold calling convention
Before tagging a function with coldcc make sure the target supports cold calling
convention. Without this patch HotColdSplitting pass fails on aarch64 with:

  fatal error: error in backend: Unsupported calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 15:08:02 +00:00
Sebastian Pop
09372b8e71 add flag instead of using a constant [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 15:07:59 +00:00
Sebastian Pop
341b8a710b make flag name more specific to gvn [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341836 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 15:07:56 +00:00
Tim Northover
0d018d17b3 InstCombine: move hasOneUse check to the top of foldICmpAddConstant
There were two combines not covered by the check before now, neither of which
actually differed from normal in the benefit analysis.

The most recent seems to be because it was just added at the top of the
function (naturally). The older is from way back in 2008 (r46687) when we just
didn't put those checks in so routinely, and has been diligently maintained
since.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341831 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 14:26:44 +00:00
Benjamin Kramer
3ebb2159ed Don't create a temporary vector of loop blocks just to iterate over them.
Loop's getBlocks returns an ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341821 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 12:32:06 +00:00
John Brawn
2c6fa12578 [GVN] Invalidate cached info for values replaced by equality propagation
When GVN propagates an equality by replacing one value with another it also
needs to invalidate the cached information for the value being replaced.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341820 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 12:23:05 +00:00
Max Kazantsev
fa259d80ca [IndVars] Set Changed if rewriteFirstIterationLoopExitValues changes IR. PR38863
Currently, `rewriteFirstIterationLoopExitValues` does not set Changed flag even if it makes
changes in the IR. There is no clear evidence that it can cause a crash, but it
looks highly suspicious and likely invalid.

Differential Revision: https://reviews.llvm.org/D51779
Reviewed By: skatkov


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341779 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 06:50:16 +00:00
Max Kazantsev
768427d162 [IndVars] Set Changed if sinkUnusedInvariants changes IR. PR38863
Currently, `sinkUnusedInvariants` does not set Changed flag even if it makes
changes in the IR. There is no clear evidence that it can cause a crash, but it
looks highly suspicious and likely invalid.

Differential Revision: https://reviews.llvm.org/D51777
Reviewed By: skatkov


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341777 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 06:32:00 +00:00
Vikram TV
dfb80c8b79 Move a transformation routine from LoopUtils to LoopVectorize.
Summary:
Move InductionDescriptor::transform() routine from LoopUtils to its only uses in LoopVectorize.cpp.
Specifically, the function is renamed as InnerLoopVectorizer::emitTransformedIndex().

This is a child to D51153.

Reviewers: dmgreen, llvm-commits

Reviewed By: dmgreen

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341776 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 06:16:44 +00:00
Vikram TV
5d1d358120 Move createMinMaxOp() out of RecurrenceDescriptor.
Reviewers: dmgreen, llvm-commits

Reviewed By: dmgreen

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341773 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 05:05:08 +00:00
Abderrazek Zaafrani
72cb007a52 [SimplifyIndVar] Avoid generating truncate instructions with non-hoisted Laod operand.
Differential Revision: https://reviews.llvm.org/D49151

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341726 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 22:41:57 +00:00
Alina Sbirlea
566693531e [MemorySSA] Update MemoryPhi wiring for block splitting to consider if identical edges were merged.
Summary:
Block splitting is done with either identical edges being merged, or not.
Only critical edges can be split without merging identical edges based on an option.
Teach the memoryssa updater to take this into account: for the same edge between two blocks only move one entry from the Phi in Old to the new Phi in New.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341709 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 21:14:48 +00:00
Sanjay Patel
a5f1bd0217 [InstCombine] narrow vector select with padded condition and extracted result (PR38691)
shuf (sel (shuf NarrowCond, undef, WideMask), X, Y), undef, NarrowMask) -->
sel NarrowCond, (shuf X, undef, NarrowMask), (shuf Y, undef, NarrowMask)

The motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=38691
...is the last regression test. In that case, we're just left with the narrow select.

Note that if we do create new shuffles, they use the existing extraction identity mask, 
so there's no danger that this transform creates arbitrary shuffles.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 21:03:34 +00:00
Fangrui Song
33d40b3195 [PGO] Fix some style issue of ControlHeightReduction
Reviewers: yamauchi

Reviewed By: yamauchi

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341702 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 20:23:15 +00:00
Hiroshi Yamauchi
96a04e655c [PGO][CHR] Build/warning fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341692 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 18:44:53 +00:00
JF Bastien
537da4277f NFC: remove magic bool in LoopIdiomRecognize
Use an enum class instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 18:17:59 +00:00
Hiroshi Yamauchi
66f1f168e0 [PGO][CHR] Small cleanup.
Summary:
Do away with demangling. It wasn't really necessary.
Declared some local functions to be static.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341681 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 18:00:58 +00:00
Craig Topper
189c2c8cb6 [InstCombine] Fold (min/max ~X, Y) -> ~(max/min X, ~Y) when Y is freely invertible
If the ~X wasn't able to simplify above the max/min, we might be able to simplify it by moving it below the max/min.

I had to modify the ~(min/max ~X, Y) transform to prevent getting stuck in a loop when we saw the new ~(max/min X, ~Y) before the ~Y had been folded away to remove the new not.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341674 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 16:19:50 +00:00
Anna Thomas
78b2eddfbc [LV] Fix code gen for conditionally executed loads and stores
Fix a latent bug in loop vectorizer which generates incorrect code for
memory accesses that are executed conditionally. As pointed in review,
this bug definitely affects uniform loads and may affect conditional
stores that should have turned into scatters as well).

The code gen for conditionally executed uniform loads on architectures
that support masked gather instructions is broken.

Without this patch, we were unconditionally executing the *conditional*
load in the vectorized version.

This patch does the following:
1. Uniform conditional loads on architectures with gather support will
   have correct code generated. In particular, the cost model
   (setCostBasedWideningDecision) is fixed.
2. For the recipes which are handled after the widening decision is set,
   we use the isScalarWithPredication(I, VF) form which is added in the
   patch.

3. Fix the vectorization cost model for scalarization
   (getMemInstScalarizationCost): implement and use isPredicatedInst to
   identify *all* predicated instructions, not just scalar+predicated. So,
   now the cost for scalarization will be increased for maskedloads/stores
   and gather/scatter operations. In short, we should be choosing the
   gather/scatter in place of scalarization on archs where it is
   profitable.
4. We needed to weaken the assert in useEmulatedMaskMemRefHack.

Reviewers: Ayal, hsaito, mkuper

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341673 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 15:53:48 +00:00
Aditya Kumar
55883c9439 Hot cold splitting pass
Find cold blocks based on profile information (or optionally with static analysis).
Forward propagate profile information to all cold-blocks.
Outline a cold region.
Set calling conv and prof hint for the callsite of the outlined function.

Worked in collaboration with: Sebastian Pop <s.pop@samsung.com>
Differential Revision: https://reviews.llvm.org/D50658

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341669 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 15:03:49 +00:00
Florian Hahn
1b57b3d686 [InstCombine] Do not fold scalar ops over select with vector condition.
If OtherOpT or OtherOpF have scalar types and the condition is a vector,
we would create an invalid select.

Reviewers: spatel, john.brawn, mssimpso, craig.topper

Reviewed By: spatel

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 14:40:06 +00:00
Florian Hahn
49e8ec0307 [NewGVN] Mark function as changed if we erase instructions.
Currently eliminateInstructions only returns true if any instruction got
replaced. In the test case for this patch, we eliminate the trivially
dead calls, for which eliminateInstructions not do a replacement and the
function is not marked as changed, which is why the inliner crashes
while traversing the call graph.

Alternatively we could also change eliminateInstructions to return true
in case we mark instructions for deletion, but that's slightly more code
and doing it at the place where the replacement happens seems safer.

Fixes PR37517.

Reviewers: davide, mcrosier, efriedma, bjope

Reviewed By: bjope

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341651 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 11:41:34 +00:00
Alexander Potapenko
0e364e1356 [MSan] don't access MsanCtorFunction when using KMSAN
MSan has found a use of uninitialized memory in MSan, fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341646 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 09:56:36 +00:00
Alexander Potapenko
f774071018 [MSan] Add KMSAN instrumentation to MSan pass
Introduce the -msan-kernel flag, which enables the kernel instrumentation.

The main differences between KMSAN and MSan instrumentations are:

- KMSAN implies msan-track-origins=2, msan-keep-going=true;
- there're no explicit accesses to shadow and origin memory.
  Shadow and origin values for a particular X-byte memory location are
  read and written via pointers returned by
  __msan_metadata_ptr_for_load_X(u8 *addr) and
  __msan_store_shadow_origin_X(u8 *addr, uptr shadow, uptr origin);
- TLS variables are stored in a single struct in per-task storage. A call
  to a function returning that struct is inserted into every instrumented
  function before the entry block;
- __msan_warning() takes a 32-bit origin parameter;
- local variables are poisoned with __msan_poison_alloca() upon function
  entry and unpoisoned with __msan_unpoison_alloca() before leaving the
  function;
- the pass doesn't declare any global variables or add global constructors
  to the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341637 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 09:10:30 +00:00
Max Kazantsev
5c4d2c1d43 [IndVars] Set Changed when we delete dead instructions. PR38855
IndVars does not set `Changed` flag when it eliminates dead instructions. As result,
it may make IR modifications and report that it has done nothing. It leads to inconsistent
preserved analyzes results.

Differential Revision: https://reviews.llvm.org/D51770
Reviewed By: skatkov


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341633 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 07:23:39 +00:00
Wei Mi
e465d88cde [SampleFDO] Make sample profile loader unaware of compact format change.
The patch tries to make sample profile loader independent of profile format
change. It moves compact format related code into FunctionSamples and
SampleProfileReader classes, and sample profile loader only has to interact
with those two classes and will be unaware of profile format changes.

The cleanup also contain some fixes to further remove the difference between
compactbinary format and binary format. After the cleanup using different
formats originated from the same profile will generate the same binaries,
which we verified by compiling two large server benchmarks w/wo thinlto.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341591 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 22:03:37 +00:00
Sanjay Patel
80b7585dc6 [InstCombine] add xor+not folds
This fold is needed to avoid a regression when we try
to recommit rL300977. 
We can't see the most basic win currently because 
demanded bits changes the patterns:
https://rise4fun.com/Alive/plpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341559 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 16:23:40 +00:00
Alexander Potapenko
066246b993 [MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls
Add the __msan_va_arg_origin_tls TLS array to keep the origins for variadic function parameters.
Change the instrumentation pass to store parameter origins in this array.

This is a reland of r341528.

test/msan/vararg.cc doesn't work on Mips, PPC and AArch64 (because this
patch doesn't touch them), XFAIL these arches.
Also turned out Clang crashed on i80 vararg arguments because of
incorrect origin type returned by getOriginPtrForVAArgument() - fixed it
and added a test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341554 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 15:14:36 +00:00
Sanjay Patel
48afe9e636 [InstCombine] fix formatting in SimplifyDemandedVectorElts->Select; NFCI
I'm preparing to add the same functionality both here and to the DAG 
version of this code in D51696 / D51433, so try to make those cases 
as similar as possible to avoid bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341545 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 13:19:22 +00:00
Alexander Potapenko
7b6a2c6037 [MSan] revert r341528 to unbreak the bots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341541 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 12:19:27 +00:00
Florian Hahn
f61d5e4a2a [LoopInterchange] Cleanup unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341537 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 10:41:01 +00:00
Florian Hahn
8502b00a75 [LoopInterchange] Move preheader creation to transform stage and simplify.
There is no need to create preheaders in the analysis stage, we only
need them when adjusting the branches. Also, the only cases we need to
create our own preheaders is when they have more than 1 predecessors or
PHI nodes (even with only 1 predecessor, we could have an LCSSA phi
node). I have simplified the conditions and added some assertions to be
sure. Because we know the inner and outer loop need to be tightly
nested, it is sufficient to check if the inner loop preheader is the
outer loop header to check if we need to create a new preheader.

Reviewers: efriedma, mcrosier, karthikthecool

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341533 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 09:57:27 +00:00
Alexander Potapenko
a044b58ab1 [MSan] store origins for variadic function parameters in __msan_va_arg_origin_tls
Add the __msan_va_arg_origin_tls TLS array to keep the origins for
variadic function parameters.
Change the instrumentation pass to store parameter origins in this array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341528 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 08:50:11 +00:00
Alexander Potapenko
ac23fcdc32 [MSan] Make sure variadic function arguments do not overflow __msan_va_arg_tls
Turns out that calling a variadic function with too many (e.g. >100 i64's)
arguments overflows __msan_va_arg_tls, which leads to smashing other TLS
data with function argument shadow values.

getShadow() already checks for kParamTLSSize and returns clean shadow if
the argument does not fit, so just skip storing argument shadow for such
arguments.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 08:21:54 +00:00
Max Kazantsev
fba980b524 Revert "[IndVars] Turn isValidRewrite into an assertion" because it seems wrong
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341517 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 05:52:47 +00:00
Max Kazantsev
a8709f19fb [IndVars] Turn isValidRewrite into an assertion
Function rewriteLoopExitValues contains a check on isValidRewrite which
is needed to make sure that SCEV does not convert the pattern
`gep Base, (&p[n] - &p[0])` into `gep &p[n], Base - &p[0]`. This problem
has been fixed in SCEV long ago, so this check is just obsolete.

This patch converts it into an assertion to make sure that the SCEV will
not mess up this case in the future.

Differential Revision: https://reviews.llvm.org/D51582
Reviewed By: atrick


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 05:21:25 +00:00
Benjamin Kramer
559403cc05 [ControlHeightReduction] Remove unused includes
Also clang-format them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341468 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-05 13:51:05 +00:00