156145 Commits

Author SHA1 Message Date
Reid Kleckner
eb271e82ff [PDB] Handle an empty globals hash table with no buckets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 00:45:51 +00:00
Balaram Makam
b2c3f3b949 Revert "[CGP] Merge empty case blocks if no extra moves are added."
This reverts commit r316711. The domtree isn't getting updated correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316721 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 00:35:18 +00:00
Sam Clegg
8200df755e [WebAssembly] MC: Don't allow zero sized data segments
This ensures that each segment has a unique address.
Without this, consecutive zero sized symbols would
end up with the same address and the linker cannot
map symbols to unique data segments.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 00:08:55 +00:00
David Blaikie
7be6b37802 InstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member function to expose the debug name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316715 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 23:39:54 +00:00
David Blaikie
921ae2bfbf MCCodePadder.h: Include definition of type for use with DenseMap
Pointer traits require a full definition of a type to function
correctly, so the header must be included rather than only a forward
declaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316714 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 23:39:52 +00:00
Balaram Makam
9a0f2ee60e [CGP] Merge empty case blocks if no extra moves are added.
Summary:
Currently we skip merging when extra moves may be added in the header of switch instead of the case block, if the case block is used as an incoming
block of a PHI. If all the incoming values of the PHIs are non-constants and the destination block is dominated by the switch block then extra moves are likely not added by ISel, so there is no need to skip merging in this case.

Reviewers: efriedma, junbuml, davidxl, hfinkel, qcolombet

Reviewed By: efriedma

Subscribers: dberlin, kuhar, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 22:34:01 +00:00
Philip Reames
76074cad4d [SimplifyIndVars] Shorten code by using SCEV helper [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316709 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 22:02:16 +00:00
Eli Friedman
15a2af58f7 [ARM] Honor -mfloat-abi for libcall calling convention
As far as I can tell, this matches gcc: -mfloat-abi determines the
calling convention for all functions except those explicitly defined as
soft-float in the ARM RTABI.

This change only affects cases where the user specifies -mfloat-abi to
override the default calling convention derived from the target triple.

Fixes https://bugs.llvm.org//show_bug.cgi?id=34530.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316708 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:42:32 +00:00
David Blaikie
1da3748d0f Support/reg*: Roll some non-modular headers into their singular uses
These headers have static variables in them, which would easily create
ODR violations if the header was included in another header, and the
constants were used by an inline function, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:32:58 +00:00
Dehao Chen
b1bfcf247f Do not add discriminator encoding for debug intrinsics.
Summary: There are certain requirements for debug location of debug intrinsics, e.g. the scope of the DILocalVariable should be the same as the scope of its debug location. As a result, we should not add discriminator encoding for debug intrinsics.

Reviewers: dblaikie, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, aprantl, bjope, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:20:52 +00:00
Craig Topper
7d937df6d0 [X86] Improve handling of UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG to support 64-bit extensions.
If the extend type is 64-bits, emit a 32-bit -> 64-bit extend after the UDIVREM8_ZEXT_HREG/UDIVREM8_SEXT_HREG operation.

This gives a shorter encoding for the second extend in the sext case, and allows us to completely remove the second extend in the zext case.

This also adds known bit and num sign bits support for UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316702 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:12:03 +00:00
Craig Topper
97d365b0a7 [X86] Teach the assembly parser to warn on duplicate registers in gather instructions.
Fixes PR32238.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:03:54 +00:00
Philip Reames
fa00b3d52d [LICM] Restructure implicit exit handling to be more clear [NFCI]
When going to explain this to someone else, I got tripped up by the complicated meaning of IsKnownNonEscapingObject in load-store promotion.  Extract a helper routine and clarify naming/scopes to make this a bit more obvious.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316699 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 21:00:15 +00:00
Craig Topper
1af8077b28 [TableGen] Use Twine instead of std::string concatenation in two calls to PrintFatalError.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316697 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 20:49:36 +00:00
David Blaikie
2555ced389 Support/reg*.h: Make headers include their dependencies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316696 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 20:23:11 +00:00
Aditya Nandakumar
6b9f2f6345 [GISel]: Missed checking if it's okay to create a G_CONSTANT of DstTy in the legalizationCombiner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316694 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 20:13:54 +00:00
Martin Storsjo
a6175a4b97 [COFF] Support ordinals in def files with space between @ and the number
Both GNU ld and MS link.exe support declaring ordinals this way.

A test will be added in lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 20:11:32 +00:00
Sanjay Patel
f4c162bbd1 [x86] use an insert op to put one variable element into a constant of vectors
Instead of loading (a potential ton of) scalar constants, load those as a vector and then insert into it.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 18:27:55 +00:00
Vedant Kumar
beb047f3df [docs] Fix a small typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316682 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 17:58:05 +00:00
Konstantin Zhuravlyov
fdd275fc25 AMDGPU: Commit missing fence-barrier test
This should have been committed with memory model implementation


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 17:54:09 +00:00
Yichao Yu
675c21a186 Clear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer
Summary:
This causes a segfault on ARM when (I think) the pass manager is used multiple times.

Reset set the (last) current section to NULL without saving the corresponding LastEMSInfo back into the map. The next use of the streamer then save the LastEMSInfo for the NULL section leaving the LastEMSInfo mapping for the last current section (the one that was there before the reset) NULL which cause the LastEMSInfo to be set to NULL when the section is being used again.

The reuse of the section (pointer) might mean that the map was holding dangling pointers previously which is why I went for clearing the map and resetting the info, making it as similar to the state right after the constructor run as possible. The AArch64 one doesn't have segfault (since LastEMS isn't a pointer) but it seems to have the same issue.

The segfault is likely caused by https://reviews.llvm.org/D30724 which turns LastEMSInfo into a pointer. As mentioned above, it seems that the actual issue was older though.

No test is included since the test is believed to be too complicated for such an obvious fix and not worth doing.

Reviewers: llvm-commits, shankare, t.p.northover, peter.smith, rengolin

Reviewed By: rengolin

Subscribers: mgorny, aemerson, rengolin, javed.absar, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 17:36:43 +00:00
Keno Fischer
ea6f05e017 [dsymutil] Check AttrInfo.Name validity before using it
Summary:
This upstreams a patch from the osxcross [1] toolchain.
It appears that llvm-dsymutil crashes at this place during GCC
bootstrap. Adding the check here seems reasonable, since it operates
on arbitrary input DWARF, not necessarily generated by the LLVM
toolchain, and it seems the un-mangled name need not necessarily exist.

Patch by Thomas Pöchtrager

[1] https://github.com/tpoechtrager/osxcross

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D39336

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316678 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 17:31:33 +00:00
Keno Fischer
ae8900a883 [DynamicLibrary] Fix build on musl libc
Summary:
On musl libc, stdin/out/err are defined as `FILE* const` globals,
and their address is not implicitly convertible to void *,
or at least gcc 6 doesn't allow it, giving errors like:

```
error: cannot initialize return object of type 'void *' with an rvalue of type 'FILE *const *' (aka '_IO_FILE *const *')
    EXPLICIT_SYMBOL(stderr);
    ^~~~~~~~~~~~~~~~~~~~~~~
```

Add an explicit cast to fix that problem.

Reviewers: marsupial, krytarowski, dim
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D39297

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316672 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 16:44:13 +00:00
Mandeep Singh Grang
228f43d82f [MachineModuleInfoImpls] Replace qsort with array_pod_sort
Summary:
This seems to be the only place in llvm we directly call qsort. We can replace
this with a call to array_pod_sort. Also minor cleanup of the sorting function.

Reviewers: bkramer, Eugene.Zelenko, rafael

Reviewed By: bkramer

Subscribers: efriedma, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 16:07:20 +00:00
Balaram Makam
e7df36ebba Reapply r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.
Summary: This reverts r316612 to reapply r316582. The buildbot failure was unrelated to this commit.

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 15:04:53 +00:00
Sean Fertile
509132b368 Represent runtime preemption in the IR.
Currently we do not represent runtime preemption in the IR, which has several
drawbacks:

  1) The semantics of GlobalValues differ depending on the object file format
     you are targeting (as well as the relocation-model and -fPIE value).
  2) We have no way of disabling inlining of run time interposable functions,
     since in the IR we only know if a function is link-time interposable.
     Because of this llvm cannot support elf-interposition semantics.
  3) In LTO builds of executables we will have extra knowledge that a symbol
     resolved to a local definition and can't be preemptable, but have no way to
     propagate that knowledge through the compiler.

This patch adds preemptability specifiers to the IR with the following meaning:

dso_local --> means the compiler may assume the symbol will resolve to a
 definition within the current linkage unit and the symbol may be accessed
 directly even if the definition is not within this compilation unit.

dso_preemptable --> means that the compiler must assume the GlobalValue may be
replaced with a definition from outside the current linkage unit at runtime.

To ease transitioning dso_preemptable is treated as a 'default' in that
low-level codegen will still do the same checks it did previously to see if a
symbol should be accessed indirectly. Eventually when IR producers emit the
specifiers on all Globalvalues we can change dso_preemptable to mean 'always
access indirectly', and remove the current logic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 15:00:26 +00:00
Marek Olsak
b25352f371 AMDGPU: Handle s_buffer_load_dword hazard on SI
Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316666 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 14:43:02 +00:00
Bjorn Pettersson
4ff96e5fbb [LSV] Avoid adding vectors of pointers as candidates
Summary:
We no longer add vectors of pointers as candidates for
load/store vectorization. It does not seem to work anyway,
but without this patch we can end up in asserts when trying
to create casts between an integer type and the pointer of
vectors type.

The test case I've added used to assert like this when trying to
cast between i64 and <2 x i16*>:
opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 Vectorizer::vectorizeStoreChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: nhaehnle, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 13:59:15 +00:00
Bjorn Pettersson
941b1f1426 [LSV] Skip all non-byte sizes, not only less than eight bits
Summary:
The code comments indicate that no effort has been spent on
handling load/stores when the size isn't a multiple of the
byte size correctly. However, the code only avoided types
smaller than 8 bits. So for example a load of an i28 could
still be considered as a candidate for vectorization.

This patch adjusts the code to behave according to the code
comment.

The test case used to hit the following assert when
trying to use "cast" an i32 to i28 using CreateBitOrPointerCast:

opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 (anonymous namespace)::Vectorizer::vectorizeLoadChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 13:42:55 +00:00
Simon Dardis
975b1d7a6b [mips] Fix (dis)assembly of abs.fmt for micromips
These instructions were previously marked as codegen only preventing
them from being assembled as microMIPS or disassembled.

Reviewers: atanasyan, abeserminji

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 11:36:54 +00:00
Andrew V. Tischenko
525c1c6d93 It's a test to demonstrate wrong disassembler with 0x67 prefix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316655 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 11:14:43 +00:00
Simon Dardis
46690e4aa0 [mips] Fix PR35071
PR35071 exposed the fact that MipsInstrInfo::removeBranch did not walk past
debug instructions when removing branches for the control flow optimizer, which
lead to duplicated conditional branches. If the target of the branch was a
removable block, only the conditional branch in the terminating position would
have it's MBB operands updated, leaving the first branch with a dangling MBB
operand. The MIPS long branch pass would then trigger an assertion when
attempting to examine the instruction with dangling MBB operand.

This resolves PR35071.

Thanks to Alex Richardson for reporting the issue!

Reviewers: atanasyan

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 10:58:36 +00:00
Simon Dardis
b723ea0a40 Update my email addresses, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316651 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 10:16:54 +00:00
Hiroshi Inoue
e703b24676 [PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1
Currently a record-form instruction is used for comparison of "greater than -1" and "less than 1" by modifying the predicate (e.g. LT 1 into LE 0) in addition to the naive case of comparison against 0.
This patch also enables emitting a record-form instruction for "less than or equal to -1" (i.e. "less than 0") and "greater than or equal to 1" (i.e. "greater than 0") to increase the optimization opportunities.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 09:01:51 +00:00
Hans Wennborg
ddfb984471 Tidy up CountingFunctionInserter a little. NFC.
Use StringRef for CountingFunctionName, remove erroneous comment
copied from InstructionNamer, and drop some trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316644 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 08:29:08 +00:00
Craig Topper
e1b56f0dcf [AsmParser][TableGen] Add VariantID argument to the generated mnemonic spell check function so it can use the correct table based on variant.
I'm considering implementing the mnemonic spell checker for x86, and that would require the separate intel and att variants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316641 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 06:46:41 +00:00
Craig Topper
939e970215 [AsmParser][TableGen] Make the generated mnemonic spell checker function a file local static function.
Also only emit in targets that specificially request it. This is required so we don't get an unused static function error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316640 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 06:46:40 +00:00
Craig Topper
34837ae7a0 [X86] Use correct type for return value of ComputeAvailableFeatures in the AsmParser. NFC
There aren't enough used bits to make this a functional change, but we should fix it for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316639 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 06:46:38 +00:00
Eugene Zelenko
0dfe884a45 [Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build bots (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 01:25:14 +00:00
Eugene Zelenko
46057fe01a [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316630 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26 00:55:39 +00:00
Matthew Simpson
052d11cee6 Attempt to unbreak the expensive-checks-win bot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316625 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 22:46:34 +00:00
Jonas Devlieghere
c2c04200c8 Re-land "[dwarfdump] Add -lookup option"
Add the option to lookup an address in the debug information and print
out the file, function, block and line table details.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316619 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:56:41 +00:00
Alexander Richardson
5d1f72d3b5 Fix CodeGen/AMDGPU/fcanonicalize-elimination.ll on FreeBSD 11.0
Summary:
On FreeBSD11.0 the FileCheck NOT string "1.0" will be matched by
`.amd_amdgpu_isa "amdgcn-unknown-freebsd11.0--gfx802"` at the end of the
file. Add a CHECK for that directive to avoid failing the test.

Reviewers: rampitec, kzhuravl

Reviewed By: rampitec, kzhuravl

Subscribers: emaste, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits, krytarowski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316616 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:44:21 +00:00
Sanjoy Das
b500839596 [SCEV] Fix an assertion failure in the max backedge taken count
Max backedge taken count is always expected to be a constant; and this is
usually true by construction -- it is a SCEV expression with constant inputs.
However, if the max backedge expression ends up being computed to be a udiv with
a constant zero denominator[0], SCEV does not fold the result to a constant
since there is no constant it can fold it to (SCEV has no representation for
"infinity" or "undef").

However, in computeMaxBECountForLT we already know the denominator is positive,
and thus at least 1; and we can use this fact to avoid dividing by zero.

[0]: We can end up with a constant zero denominator if the signed range of the
stride is more precise than the unsigned range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316615 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:41:00 +00:00
Sanjoy Das
bc1160282c Add a comment to clarify a future change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316614 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:40:59 +00:00
Balaram Makam
2bbf52db0b Revert r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.
Summary: This reverts commit r316582. It looks like this commit broke tests on one buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5719

. . .
Failing Tests (1):
    LLVM :: Transforms/CalledValuePropagation/simple-arguments.ll

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:32:54 +00:00
Mitch Phillips
46254ad823 Add FileVerifier::isCFIProtected().
Add a CFI protection check that is implemented by building a graph and inspecting the output to deduce if the indirect CF instruction is CFI protected. Also added the output of this instruction to printIndirectInstructions().

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 21:21:16 +00:00
David Blaikie
3498a4cb17 Hexagon: Fold a single-use textual header into its use
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316604 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 19:52:21 +00:00
Aditya Nandakumar
ca37830df0 Make the combiner check if shifts are legal before creating them
Summary: Make sure shifts are legal/specified by the legalizerinfo before creating it

Reviewers: qcolombet, dsanders, rovka, t.p.northover

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 18:49:18 +00:00
Krzysztof Parzyszek
c936ad3889 [Hexagon] Account for negative offset when limiting max deviation
In getOffsetRange, Max can be set to 0 to force the extender replacement
to be at or below the original value. This would cause the new offset to
be non-negative, which is preferred for memory instructions (to reduce
the likelihood of it getting constant-extended due to predication). The
problem happens when the range is shifted by an offset (present in the
instruction being examined) and the offset is negative. The entire range
for the allowable deviation will then be strictly negative. This creates
a problem, since 0 is assumed to be a valid deviation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 18:46:40 +00:00