OSDN Git Service
Philip Reames [Tue, 31 Oct 2017 04:19:06 +0000 (04:19 +0000)]
[SimplifyIndVar] Extract out invariant expression handling
Previously, the code returned early from the *function* when it couldn't find a free expansion, it should be returning from the *transform*. I don't have a test case, noticed this via inspection.
As a follow up, I'm going to revisit the logic in the extract function. I think that essentially the whole helper routine can be replaced with SCEVExpander, but I wanted to do that in a series of separate commits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316974
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Tue, 31 Oct 2017 02:34:29 +0000 (02:34 +0000)]
[X86] Clang-format some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316973
91177308-0d34-0410-b5e6-
96231b3b80d8
Shoaib Meenai [Tue, 31 Oct 2017 01:30:46 +0000 (01:30 +0000)]
[cmake] Make check_linker_flags operate via linker flags
`check_linker_flags` currently sets the *compiler* flags (via
`CMAKE_REQUIRED_FLAGS`), and thus implicitly relies on cmake's default
behavior of passing the compiler flags to the linker. This breaks when
cmake's build rules have been altered to not pollute the link line with
compiler flags (which can be desirable for build cleanliness). Instead,
set `CMAKE_EXE_LINKER_FLAGS` explicitly and use `CMP0056` to ensure the
linker flags are passed along. Additionally, since we're inside a
function, we can just alter the variable directly (as the alteration
will be limited to the scope of the function) rather than saving and
restoring the old value.
Differential Revision: https://reviews.llvm.org/D39431
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316972
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Tue, 31 Oct 2017 00:04:09 +0000 (00:04 +0000)]
Undo accidental commit
These files shouldn't have been submitted in 316967
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316968
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Mon, 30 Oct 2017 23:59:51 +0000 (23:59 +0000)]
[CGP] Fix crash on i96 bit multiply
Issue found by llvm-isel-fuzzer on OSS fuzz, https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3725
If anyone actually cares about > 64 bit arithmetic, there's a lot more to do in this area. There's a bunch of obviously wrong code in the same function. I don't have the time to fix all of them and am just using this to understand what the workflow for fixing fuzzer cases might look like.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316967
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 22:38:07 +0000 (22:38 +0000)]
Fix unused variable warnings. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316964
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 22:23:57 +0000 (22:23 +0000)]
[SelectionDAG] Tidyup computeKnownBits extension/truncation cases. NFCI.
We don't need to extend/truncate the Known structure before calling computeKnownBits - it will reset at the start of the function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316962
91177308-0d34-0410-b5e6-
96231b3b80d8
Javed Absar [Mon, 30 Oct 2017 22:00:06 +0000 (22:00 +0000)]
[AArch64]: range loopify frame-lowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316960
91177308-0d34-0410-b5e6-
96231b3b80d8
Rui Ueyama [Mon, 30 Oct 2017 21:19:54 +0000 (21:19 +0000)]
Fix -fuse-ld feature detection error.
check_cxx_compiler_flag doesn't seem to try to link a program, so
the existing code doesn't correctly detect the availability of a given
linker. This patch uses check_cxx_source_compiles instead.
I confirmed that cmake now reports this error
Host compiler does not support '-fuse-ld=foo'
for -DLLVM_USE_LINKER=foo.
Differential Revision: https://reviews.llvm.org/D39274
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316958
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaxun Liu [Mon, 30 Oct 2017 21:19:41 +0000 (21:19 +0000)]
InferAddressSpaces: Fix bug about replacing addrspacecast
InferAddressSpaces assumes the pointee type of addrspacecast
is the same as the operand, which is not always true and causes
invalid IR.
This bug cause build failure in HCC.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D39432
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316957
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Shen [Mon, 30 Oct 2017 21:12:14 +0000 (21:12 +0000)]
[CMake] Fix linker detection in AddLLVM.cmake
Fix linker not being correctly detected when a custom one is specified
through LLVM_USE_LINKER CMake variable.
In particular,
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold ../llvm
resulted into
Linker detection: GNU ld
instead of
Linker detection: GNU Gold
due to the construction not accounting for such variable. It led to the general
confusion and prevented setting linker-specific flags inside functions defined
in AddLLVM.cmake.
Thanks Oleksii Vilchanskyi for the patch!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316956
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 21:09:19 +0000 (21:09 +0000)]
[X86] Add AVX512 support to fast isel's X86ChooseCmpOpcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316955
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Mon, 30 Oct 2017 20:20:16 +0000 (20:20 +0000)]
[NewGVN] Stop assuming PHI args ordering when looking at phi-of-ops.
It's not guaranteed. There's a bug open to sort them in predecessor
order, but it won't happen anytime soon. In the meanwhile, passes
will have to do an O(#preds) scan. Such is life.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316953
91177308-0d34-0410-b5e6-
96231b3b80d8
Stefan Pintilie [Mon, 30 Oct 2017 19:55:38 +0000 (19:55 +0000)]
Revert "[PowerPC] Try to simplify a Swap if it feeds a Splat"
Revert r316478.
A test case has failed.
Will recommit this change once we find and fix the failure.
This reverts commit
7c330fabaedaba3d02c58bc3cc1198896c895f34.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316952
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Neilson [Mon, 30 Oct 2017 19:51:48 +0000 (19:51 +0000)]
Create instruction classes for identifying any atomicity of memory intrinsic. (NFC)
Summary:
For reference, see: http://lists.llvm.org/pipermail/llvm-dev/2017-August/116589.html
This patch fleshes out the instruction class hierarchy with respect to atomic and
non-atomic memory intrinsics. With this change, the relevant part of the class
hierarchy becomes:
IntrinsicInst
-> MemIntrinsicBase (methods-only class)
-> MemIntrinsic (non-atomic intrinsics)
-> MemSetInst
-> MemTransferInst
-> MemCpyInst
-> MemMoveInst
-> AtomicMemIntrinsic (atomic intrinsics)
-> AtomicMemSetInst
-> AtomicMemTransferInst
-> AtomicMemCpyInst
-> AtomicMemMoveInst
-> AnyMemIntrinsic (both atomicities)
-> AnyMemSetInst
-> AnyMemTransferInst
-> AnyMemCpyInst
-> AnyMemMoveInst
This involves some class renaming:
ElementUnorderedAtomicMemCpyInst -> AtomicMemCpyInst
ElementUnorderedAtomicMemMoveInst -> AtomicMemMoveInst
ElementUnorderedAtomicMemSetInst -> AtomicMemSetInst
A script for doing this renaming in downstream trees is included below.
An example of where the Any* classes should be used in LLVM is when reasoning
about the effects of an instruction (ex: aliasing).
---
Script for renaming AtomicMem* classes:
PREFIXES="[<,([:space:]]"
CLASSES="MemIntrinsic|MemTransferInst|MemSetInst|MemMoveInst|MemCpyInst"
SUFFIXES="[;)>,[:space:]]"
REGEX="(${PREFIXES})ElementUnorderedAtomic(${CLASSES})(${SUFFIXES})"
REGEX2="visitElementUnorderedAtomic(${CLASSES})"
FILES=$( grep -E "(${REGEX}|${REGEX2})" -r . | tr ':' ' ' | awk '{print $1}' | sort | uniq )
SED_SCRIPT="s~${REGEX}~\1Atomic\2\3~g"
SED_SCRIPT2="s~${REGEX2}~visitAtomic\1~g"
for f in $FILES; do
echo "Processing: $f"
sed -i ".bak" -E "${SED_SCRIPT};${SED_SCRIPT2};${EA_SED_SCRIPT};${EA_SED_SCRIPT2}" $f
done
Reviewers: sanjoy, deadalnix, apilipenko, anna, skatkov, mkazantsev
Reviewed By: sanjoy
Subscribers: hfinkel, jholewinski, arsenm, sdardis, nhaehnle, JDevlieghere, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D38419
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316950
91177308-0d34-0410-b5e6-
96231b3b80d8
Mandeep Singh Grang [Mon, 30 Oct 2017 19:42:41 +0000 (19:42 +0000)]
[GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions
Summary: This fixes failure in Transforms/GVNHoist/hoist.ll uncovered by D39245.
Reviewers: hiraditya, spop, dberlin
Reviewed By: dberlin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D39410
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316949
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 19:31:08 +0000 (19:31 +0000)]
[SelectionDAG] Add VSELECT demanded elts support to computeKnownBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316947
91177308-0d34-0410-b5e6-
96231b3b80d8
Zvi Rackover [Mon, 30 Oct 2017 19:29:15 +0000 (19:29 +0000)]
X86 Tests: Update the variable-index permute tests with FP types. NFC.
These cases will be addressed in a future update to D39126.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316946
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 19:19:58 +0000 (19:19 +0000)]
[X86][SSE] Add another computeKnownBits test showing missing VSELECT demandedelts support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316945
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 19:08:21 +0000 (19:08 +0000)]
[SelectionDAG] Add VSELECT support to computeKnownBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316944
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 18:48:31 +0000 (18:48 +0000)]
[X86][SSE] computeKnownBits tests showing missing VSELECT demandedelts support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316940
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 18:37:27 +0000 (18:37 +0000)]
[X86][AVX512] Cleanup scheduler tests - split GENERIC and SKX targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316938
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 17:53:51 +0000 (17:53 +0000)]
[SelectionDAG] Add SELECT demanded elts support to ComputeNumSignBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316933
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 17:46:50 +0000 (17:46 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing VSELECT demandedelts support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316932
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 17:24:40 +0000 (17:24 +0000)]
[MC] Split out register def/use idx calls to make debugging simpler. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316927
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 17:23:17 +0000 (17:23 +0000)]
[X86][AVX] Add missing vcvtpd2dq/vcvtps2dq scheduling tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316926
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Mon, 30 Oct 2017 17:20:50 +0000 (17:20 +0000)]
[X86][SSE] Add clflush scheduling test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316925
91177308-0d34-0410-b5e6-
96231b3b80d8
Jina Nahias [Mon, 30 Oct 2017 16:37:28 +0000 (16:37 +0000)]
[X86][AVX512] Adding a pattern for broadcastm intrinsic.
Differential Revision: https://reviews.llvm.org/D38312
Change-Id: I71c8605a8e4c98013ef25289694afc5cfd46bb0b
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316921
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 30 Oct 2017 16:32:31 +0000 (16:32 +0000)]
Move isDSOLocal check and add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316920
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Mon, 30 Oct 2017 16:03:44 +0000 (16:03 +0000)]
[PPC CodeGen] Fix the bitreverse.i64 intrinsic.
Summary: The two 32-bit words were swapped. Update a test omitted in reverted r316270.
Reviewers: jtony, aaron.ballman
Subscribers: nemanjai, kbarton
Differential Revision: https://reviews.llvm.org/D39163
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316916
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 14:51:37 +0000 (14:51 +0000)]
[X86] Make sure we don't create locked inc/dec instructions when the carry flag is being used.
Summary:
INC/DEC don't update the carry flag so we need to make sure we don't try to use it.
This patch introduces new X86ISD opcodes for locked INC/DEC. Teaches lowerAtomicArithWithLOCK to emit these nodes if INC/DEC is not slow or the function is being optimized for size. An additional flag is added that allows the INC/DEC to be disabled if the caller determines that the carry flag is being requested.
The test_sub_1_cmp_1_setcc_ugt test is currently showing this bug. The other test case changes are recovering cases that were regressed in r316860.
This should fully fix PR35068 finishing the fix started in r316860.
Reviewers: RKSimon, zvi, spatel
Reviewed By: zvi
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D39411
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316913
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 14:50:11 +0000 (14:50 +0000)]
[X86] Remove AVX512 early out from X86FastISel::X86SelectCmp.
This shouldn't be needed anymore since i1 isn't a legal type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316912
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 14:50:10 +0000 (14:50 +0000)]
[X86] Regenerate test using update_llc_test_checks.py
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316911
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Mon, 30 Oct 2017 14:34:30 +0000 (14:34 +0000)]
[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC
Sinking common insts and converting to select early can inhibit better folds in other passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316908
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaxun Liu [Mon, 30 Oct 2017 14:30:28 +0000 (14:30 +0000)]
[AMDGPU] Emit metadata for hidden arguments for kernel enqueue
Identifies kernels which performs device side kernel enqueues and emit
metadata for the associated hidden kernel arguments. Such kernels are
marked with calls-enqueue-kernel function attribute by
AMDGPUOpenCLEnqueueKernelLowering pass and later on
hidden kernel arguments metadata HiddenDefaultQueue and
HiddenCompletionAction are emitted for them.
Differential Revision: https://reviews.llvm.org/D39255
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316907
91177308-0d34-0410-b5e6-
96231b3b80d8
Clement Courbet [Mon, 30 Oct 2017 14:19:33 +0000 (14:19 +0000)]
[CodeGen][ExpandMemcmp] Allow memcmp to expand to vector loads (2).
- Targets that want to support memcmp expansions now return the list of
supported load sizes.
- Expansion codegen does not assume that all power-of-two load sizes
smaller than the max load size are valid. For examples, this is not the
case for x86(32bit)+sse2.
Fixes PR34887.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316905
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Mon, 30 Oct 2017 14:11:52 +0000 (14:11 +0000)]
[Hexagon] Allow the RDF optimizations to be run in .mir testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316904
91177308-0d34-0410-b5e6-
96231b3b80d8
Javed Absar [Mon, 30 Oct 2017 13:51:56 +0000 (13:51 +0000)]
[GlobalISel|ARM] : Allow legalizing G_FSUB
Adding support for VSUB.
Reviewed by: @rovka
Differential Revision: https://reviews.llvm.org/D39261
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316902
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew V. Tischenko [Mon, 30 Oct 2017 12:02:06 +0000 (12:02 +0000)]
Invalid used of 'w' suffix on push and pop using 64-bit register.
Differential Revision: https://reviews.llvm.org/D38626
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316898
91177308-0d34-0410-b5e6-
96231b3b80d8
Diana Picus [Mon, 30 Oct 2017 11:58:09 +0000 (11:58 +0000)]
[ARM GlobalISel] Fixup r316572. NFC
Just missed a few spots...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316897
91177308-0d34-0410-b5e6-
96231b3b80d8
Jina Nahias [Mon, 30 Oct 2017 10:35:53 +0000 (10:35 +0000)]
Revert "[X86][AVX512] Adding a pattern for broadcastm intrinsic."
This reverts commit r316890.
Change-Id: I683cceee9848ef309b452293086b1f26a941950d
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316894
91177308-0d34-0410-b5e6-
96231b3b80d8
Florian Hahn [Mon, 30 Oct 2017 10:07:42 +0000 (10:07 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.
Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.
For the following function, f() can be optimized to ret i32 2 with
this change
source_filename = "sccp.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call fastcc i32 @f(i32 1)
%call1 = tail call fastcc i32 @f(i32 47)
%add3 = add nsw i32 %call, %call1
ret i32 %add3
}
; Function Attrs: noinline norecurse nounwind readnone uwtable
define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
entry:
%c1 = icmp sle i32 %x, 100
%cmp = icmp sgt i32 %x, 300
%. = select i1 %cmp, i32 1, i32 2
ret i32 %.
}
attributes #1 = { noinline }
Reviewers: davide, sanjoy, efriedma, dberlin
Reviewed By: davide, dberlin
Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits
Differential Revision: https://reviews.llvm.org/D36656
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316891
91177308-0d34-0410-b5e6-
96231b3b80d8
Jina Nahias [Mon, 30 Oct 2017 09:59:52 +0000 (09:59 +0000)]
[X86][AVX512] Adding a pattern for broadcastm intrinsic.
Differential Revision: https://reviews.llvm.org/D38312
Change-Id: I6551fb13879e098aed74de410e29815cf37d9ab5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316890
91177308-0d34-0410-b5e6-
96231b3b80d8
Max Kazantsev [Mon, 30 Oct 2017 09:35:16 +0000 (09:35 +0000)]
[IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316889
91177308-0d34-0410-b5e6-
96231b3b80d8
Florian Hahn [Mon, 30 Oct 2017 09:21:50 +0000 (09:21 +0000)]
Revert r316887 to fix buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316888
91177308-0d34-0410-b5e6-
96231b3b80d8
Florian Hahn [Mon, 30 Oct 2017 09:04:18 +0000 (09:04 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.
Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.
For the following function, f() can be optimized to ret i32 2 with
this change
source_filename = "sccp.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call fastcc i32 @f(i32 1)
%call1 = tail call fastcc i32 @f(i32 47)
%add3 = add nsw i32 %call, %call1
ret i32 %add3
}
; Function Attrs: noinline norecurse nounwind readnone uwtable
define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
entry:
%c1 = icmp sle i32 %x, 100
%cmp = icmp sgt i32 %x, 300
%. = select i1 %cmp, i32 1, i32 2
ret i32 %.
}
attributes #1 = { noinline }
Reviewers: davide, sanjoy, efriedma, dberlin
Reviewed By: davide, dberlin
Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits
Differential Revision: https://reviews.llvm.org/D36656
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316887
91177308-0d34-0410-b5e6-
96231b3b80d8
Max Kazantsev [Mon, 30 Oct 2017 04:48:34 +0000 (04:48 +0000)]
[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE
It is done to uniformly handle instructions removal.
Differential Revision: https://reviews.llvm.org/D39369
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316884
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 04:39:18 +0000 (04:39 +0000)]
[X86] Rearrange code in X86InstrInfo.cpp to put all the foldMemoryOperandImpl methods together without partial/undef register handling in the middle. NFC
I have a future patch that wants to make use of the one of the partial functions in one of the earlier memory folding methods and the current ordering prevents that.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316883
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 03:35:44 +0000 (03:35 +0000)]
[X86] Simplify code by removing an unnecessary temporary variable. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316882
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 30 Oct 2017 03:35:43 +0000 (03:35 +0000)]
[X86] Move some EVEX->VEX code to a helper function to prepare for a future patch. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316881
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 29 Oct 2017 22:03:37 +0000 (22:03 +0000)]
[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316875
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 29 Oct 2017 21:35:28 +0000 (21:35 +0000)]
[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test
Max depth was being exceeded which could prevent some combines working
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316871
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Sun, 29 Oct 2017 20:49:31 +0000 (20:49 +0000)]
[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM
The old PM sets the options of what used to be known as "latesimplifycfg" on the
instantiation after the vectorizers have run, so that's what we'redoing here.
FWIW, there's a later SimplifyCFGPass instantiation in both PMs where we do not
set the "late" options. I'm not sure if that's intentional or not.
Differential Revision: https://reviews.llvm.org/D39407
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316869
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 29 Oct 2017 20:49:27 +0000 (20:49 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316868
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 29 Oct 2017 18:19:37 +0000 (18:19 +0000)]
[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits
Introduce a isConstOrDemandedConstSplat helper function that can recognise a constant splat build vector for at least the demanded elts we care about.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316866
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 29 Oct 2017 18:01:31 +0000 (18:01 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SHL/SRA demandedelts support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316865
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 17:15:09 +0000 (17:15 +0000)]
[X86] Add a slow-incdec command line to atomic-eflags-reuse.ll
I believe the test_sub_1_cmp_1_setcc_ugt test case is being miscompiled in the fast inc/dec case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316864
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 06:51:04 +0000 (06:51 +0000)]
[X86] Remove combine that turns X86ISD::LSUB into X86ISD::LADD. Update patterns that depended on this.
If the carry flag is being used, this transformation isn't safe.
This does prevent some test cases from using DEC now, but I'll try to look into that separately.
Fixes PR35068.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316860
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 06:51:02 +0000 (06:51 +0000)]
[X86] Fix typo in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316859
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 05:14:26 +0000 (05:14 +0000)]
[X86] Use the extended vector register classes in fast isel with AVX512F/VL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316857
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 02:50:31 +0000 (02:50 +0000)]
[X86] Add AVX512 support to X86FastISel::X86SelectFPExt and X86FastISel::X86SelectFPTrunc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316856
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 02:25:48 +0000 (02:25 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-int-float-conversion.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316855
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 02:18:43 +0000 (02:18 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-fptrunc-fpext.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316854
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 29 Oct 2017 02:18:41 +0000 (02:18 +0000)]
[X86] Add AVX512 support to X86FastISel::X86MaterializeFP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316853
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 23:10:13 +0000 (23:10 +0000)]
[X86] Remove invalid code from LowerVSELECT.
This code attempted to say that v8i16/v16i16 VSELECT is legal if BWI and VLX are enabled, but the only way we could reach this point is if the condition was not a vXi1 type. Which means it really wasn't legal.
We don't have any tests that exercise this code. So I'm hoping it wasn't really reachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316851
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 28 Oct 2017 22:10:40 +0000 (22:10 +0000)]
[SelectionDAG] Add support for INSERT_SUBVECTOR to computeKnownBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316847
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 28 Oct 2017 20:51:27 +0000 (20:51 +0000)]
[X86][SSE] Combine 128-bit target shuffles to PACKSS/PACKUS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316845
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 28 Oct 2017 20:27:22 +0000 (20:27 +0000)]
[X86][SSE] Split off matchVectorShuffleWithPACK. NFCI.
Split matchVectorShuffleWithPACK from lowerVectorShuffleWithPACK so that we can reuse it for target shuffle combines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316844
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 19:56:57 +0000 (19:56 +0000)]
[X86] Fix a mistake in the X86ISelDAGToDAG.cpp code for MUL8r/IMUL8r.
I think this code is unreachable due to some promotions that occur elsewhere. I'll look into that to be sure, but for now I thought I should at least fix the obvious typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316840
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 19:56:56 +0000 (19:56 +0000)]
[X86] Replace some default cases in X86SelectShift with llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316839
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Sat, 28 Oct 2017 19:15:05 +0000 (19:15 +0000)]
ADT: add a helper to check if the Triple is ARM64
Add a trivial helper for checking if the architecture is AArch64 Little
Endian or Big Endian.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316837
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Sat, 28 Oct 2017 18:43:07 +0000 (18:43 +0000)]
[SimplifyCFG] use pass options and remove the latesimplifycfg pass
This is no-functional-change-intended.
This is repackaging the functionality of D30333 (defer switch-to-lookup-tables) and
D35411 (defer folding unconditional branches) with pass parameters rather than a named
"latesimplifycfg" pass. Now that we have individual options to control the functionality,
we could decouple when these fire (but that's an independent patch if desired).
The next planned step would be to add another option bit to disable the sinking transform
mentioned in D38566. This should also make it clear that the new pass manager needs to
be updated to limit simplifycfg in the same way as the old pass manager.
Differential Revision: https://reviews.llvm.org/D38631
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316835
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 28 Oct 2017 17:59:56 +0000 (17:59 +0000)]
[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.
We no longer rely on the vector source being a comparison result, just have sufficient sign bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316834
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 17:37:51 +0000 (17:37 +0000)]
[X86] Correct the alignments on the aligned test cases in fast-isel-vecload.ll to make sure they test selection of aligned loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316833
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 28 Oct 2017 14:27:53 +0000 (14:27 +0000)]
[SelectionDAG] Support 'bit preserving' floating points bitcasts on computeKnownBits/ComputeNumSignBits
For cases where we know the floating point representations match the bitcasted integer equivalent, allow bitcasting to these types.
This is especially useful for the X86 floating point compare results which return all/zero bits but as a floating point type.
Differential Revision: https://reviews.llvm.org/D39289
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316831
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 06:31:48 +0000 (06:31 +0000)]
[X86] Add avx command lines to fast-isel-constpool.ll to improve coverage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316829
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 06:31:46 +0000 (06:31 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-constpool.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316828
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 06:10:03 +0000 (06:10 +0000)]
[X86] Add a fast-isel test for the i8 pseudo cmov.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316827
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 05:52:23 +0000 (05:52 +0000)]
[X86] Remove unneeded MVT::i1 related code from fast isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316825
91177308-0d34-0410-b5e6-
96231b3b80d8
Haicheng Wu [Sat, 28 Oct 2017 02:27:14 +0000 (02:27 +0000)]
[ConstantFold] Fix a crash when folding a GEP that has vector index
LLVM crashes when factoring out an out-of-bound index into preceding dimension
and the preceding dimension uses vector index. Simply bail out now when this
case happens.
Differential Revision: https://reviews.llvm.org/D38677
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316824
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 02:03:59 +0000 (02:03 +0000)]
[X86] Add avx command lines to two fast-isel tests to get coverage of selecting vucomiss/vucomisd.
The selection of these shows up as a code coverage hole when looking at the llvm-cov link on llvm.org
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316823
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 02:03:58 +0000 (02:03 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-select-cmov2.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316822
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 28 Oct 2017 00:36:58 +0000 (00:36 +0000)]
[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has
Summary:
We shouldn't do this transformation if the function is marked nobuitlin.
We were only checking that the return type is floating point, we really should be checking the argument types and argument count as well. This can be accomplished by using the other version of getLibFunc that takes the Function and not just the name.
We should also be checking TLI::has since sqrtf is a macro on Windows.
Fixes PR32559.
Reviewers: hfinkel, spatel, davide, efriedma
Reviewed By: davide, efriedma
Subscribers: efriedma, llvm-commits, eraman
Differential Revision: https://reviews.llvm.org/D39381
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316819
91177308-0d34-0410-b5e6-
96231b3b80d8
Eugene Zelenko [Sat, 28 Oct 2017 00:24:26 +0000 (00:24 +0000)]
[ADT] 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@316818
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 27 Oct 2017 23:57:41 +0000 (23:57 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FADD as legal
Reviewers: arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D38439
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316815
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Haarman [Fri, 27 Oct 2017 23:41:17 +0000 (23:41 +0000)]
[support] remove tautological comparison in Support/Windows/Path.inc
Summary:
The removed code checks that we are able to handle a 64-bit number, but
the code we're calling takes two dwords (for a total of 64 bits), so this
is always true.
Reviewers: zturner, rnk, majnemer, compnerd
Reviewed By: zturner
Subscribers: amccarth, hiraditya, lebedev.ri, llvm-commits
Differential Revision: https://reviews.llvm.org/D39263
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316814
91177308-0d34-0410-b5e6-
96231b3b80d8
Jake Ehrlich [Fri, 27 Oct 2017 23:39:31 +0000 (23:39 +0000)]
Revert "Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit"
This reverts commit r316805.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316813
91177308-0d34-0410-b5e6-
96231b3b80d8
Jake Ehrlich [Fri, 27 Oct 2017 22:26:37 +0000 (22:26 +0000)]
Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit
This should fix https://bugs.llvm.org//show_bug.cgi?id=34189
This change makes it so that if writing a K_GNU style archive, you need
to output a > 32-bit offset it should output in K_GNU64 style instead.
Differential Revision: https://reviews.llvm.org/D36812
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316805
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Fri, 27 Oct 2017 22:24:49 +0000 (22:24 +0000)]
[Hexagon] Adjust patterns to reflect instruction selection preferences
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316804
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 27 Oct 2017 22:12:46 +0000 (22:12 +0000)]
Add a few missing headers for modularization/IWYU/etc
Several cases where class definitions are required for DenseMap pointer
traits handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316803
91177308-0d34-0410-b5e6-
96231b3b80d8
Guozhi Wei [Fri, 27 Oct 2017 21:54:24 +0000 (21:54 +0000)]
[DAGCombine] Don't combine sext with extload if sextload is not supported and extload has multi users
In function DAGCombiner::visitSIGN_EXTEND_INREG, sext can be combined with extload even if sextload is not supported by target, then
if sext is the only user of extload, there is no big difference, no harm no benefit.
if extload has more than one user, the combined sextload may block extload from combining with other zext, causes extra zext instructions generated. As demonstrated by the attached test case.
This patch add the constraint that when sextload is not supported by target, sext can only be combined with extload if it is the only user of extload.
Differential Revision: https://reviews.llvm.org/D39108
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316802
91177308-0d34-0410-b5e6-
96231b3b80d8
Jake Ehrlich [Fri, 27 Oct 2017 21:47:38 +0000 (21:47 +0000)]
Make 32-bit member offset in Archive::Symbol::getMember 64-bit
When accessing a member for a symbol with an offset greater than 2^32 -
1 the current Archive::Symbol::getMember implementation will overflow
and cause unexpected behavior. This change simply fixes that. In
particular if you call "llvm-nm --print-armap" on an archive that has
this behavior you'll get an error.
Differential Revision: https://reviews.llvm.org/D39379
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316801
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 27 Oct 2017 21:18:48 +0000 (21:18 +0000)]
Handle undefined weak hidden symbols on all architectures.
We were handling the non-hidden case in lib/Target/TargetMachine.cpp,
but the hidden case was handled in architecture dependent code and
only X86_64 and AArch64 were covered.
While it is true that some code sequences in some ABIs might be able
to produce the correct value at runtime, that doesn't seem to be the
common case.
I left the AArch64 code in place since it also forces a got access for
non-pic code. It is not clear if that is needed, but it is probably
better to change that in another commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316799
91177308-0d34-0410-b5e6-
96231b3b80d8
Zachary Turner [Fri, 27 Oct 2017 21:12:28 +0000 (21:12 +0000)]
Force #define GTEST_LANG_CXX11.
gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace. The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11. In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.
This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316798
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 27 Oct 2017 21:00:59 +0000 (21:00 +0000)]
[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316797
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 27 Oct 2017 21:00:56 +0000 (21:00 +0000)]
[X86] Add fast-isel tests for integer shifts. We definitely had no coverage of i16 and i32/i64 are only tested by larger tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316796
91177308-0d34-0410-b5e6-
96231b3b80d8
Artur Gainullin [Fri, 27 Oct 2017 20:53:41 +0000 (20:53 +0000)]
Improve clamp recognition in ValueTracking.
Summary:
ValueTracking was recognizing not all variations of clamp. Swapping of
true value and false value of select was added to fix this problem. The
first patch was reverted because it caused miscompile in NVPTX target.
Added corresponding test cases.
Reviewers: spatel, majnemer, efriedma, reames
Subscribers: llvm-commits, jholewinski
Differential Revision: https://reviews.llvm.org/D39240
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316795
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 27 Oct 2017 20:13:10 +0000 (20:13 +0000)]
[X86] Teach fastisel to use VLX VMOVNTDQA for v4f64 and 256-bit integers when available.
This looks to have been missed from r280682.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316790
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 27 Oct 2017 20:13:06 +0000 (20:13 +0000)]
[X86] Add avx512vl command line to fast-isel-nontemporal.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316789
91177308-0d34-0410-b5e6-
96231b3b80d8
Vlad Tsyrklevich [Fri, 27 Oct 2017 19:15:13 +0000 (19:15 +0000)]
Fix llvm-special-case-list-fuzzer regexp exception
Summary:
Original oss-fuzz report:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2
The minimized test case that causes this failure:
5b 5b 5b 3d 47 53 00 5b 3d 5d 5b 5d 0a [[[=GS.[=][].
Note the string "=GS\x00". The failure happens because the code is
searching the string against an array of known collated names. "GS\x00"
is a hit, but since len takes into account an extra NUL byte, indexing
into cp->name[len] goes one byte past it's allocated memory. Fix this to
use a strlen(cp->name) comparison to account for NUL bytes in the input.
Reviewers: pcc
Reviewed By: pcc
Subscribers: hctim, kcc
Differential Revision: https://reviews.llvm.org/D39380
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316786
91177308-0d34-0410-b5e6-
96231b3b80d8