Gil Rapaport [Wed, 30 Dec 2020 21:11:20 +0000 (23:11 +0200)]
[SCEV] Simplify trunc to zero based on known bits
Let getTruncateExpr() short-circuit to zero when the value being truncated is
known to have at least as many trailing zeros as the target type.
Differential Revision: https://reviews.llvm.org/D93973
Alexey Lapshin [Wed, 16 Dec 2020 13:34:12 +0000 (16:34 +0300)]
[dsymutil][DWARFLinker][NFC] Refactor usages of UniquingStringPool.
That refactoring is helpful since it reduces data inter-dependencies.
Which is good for current implementation and even more good for
fully multi-thread implementation. The idea of the refactoring
is to delete UniquingStringPool from the global DWARFLinker level.
It is used to unique type names while ODR deduplication is done.
Thus we move UniquingStringPool into the DeclContextTree which
matched to UniquingStringPool usage scope.
golden-dsymutil/dsymutil
23787992
clang MD5:
7d9873ff94f0246b6ab1ec3e8d0f3f06
build-Release/bin/dsymutil
23921272
clang MD5:
7d9873ff94f0246b6ab1ec3e8d0f3f06
Differential Revision: https://reviews.llvm.org/D93460
Nico Weber [Sat, 2 Jan 2021 23:54:37 +0000 (18:54 -0500)]
Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"
...and follow-ups. It still doesn't build on Android, see https://reviews.llvm.org/D93848#2476310
This reverts commit
a92d01534f1c4fb79210975573e774d0393f2533.
This reverts commit
52d7e183bf25ea38e1149e39e19d21e6212e701f.
This reverts commit
34489da81b39972b40d2ff5581fe48911339406e.
Lang Hames [Thu, 31 Dec 2020 03:20:53 +0000 (14:20 +1100)]
[RuntimeDyld] Fix dangling reference in RuntimeDyldELF.
Patch by Moritz Sichert. Thanks Moritz!
Differential Revision: https://reviews.llvm.org/D89373
LLVM GN Syncbot [Sat, 2 Jan 2021 22:46:43 +0000 (22:46 +0000)]
[gn build] Port
5799fc79c3f
Roman Lebedev [Sat, 2 Jan 2021 22:26:42 +0000 (01:26 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation, take 2
Roman Lebedev [Sat, 2 Jan 2021 21:45:53 +0000 (00:45 +0300)]
[NFC][SimplifyCFG] Add another test for switch creation where we fail to maintain DomTree
Roman Lebedev [Sat, 2 Jan 2021 18:27:19 +0000 (21:27 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation
Roman Lebedev [Sat, 2 Jan 2021 17:11:48 +0000 (20:11 +0300)]
[NFC][SimplifyCFG] Add test for switch creation where we fail to maintain DomTree
Reduced from vanilla test-suite
Roman Lebedev [Sat, 2 Jan 2021 16:56:27 +0000 (19:56 +0300)]
[llvm-reduce] Refactor global variable delta pass
The limitation of the current pass that it skips initializer-less GV's
seems arbitrary, in all the reduced cases i (personally) looked at,
the globals weren't needed, yet they were kept.
So let's do two things:
1. allow reducing initializer-less globals
2. before reducing globals, reduce their initializers, much like we do function bodies
Roman Lebedev [Sat, 2 Jan 2021 16:29:01 +0000 (19:29 +0300)]
[llvm-reduce] Fix removal of unused llvm intrinsics declarations
ee6e25e4391a6d3ac0a3c89615474e512f44cda6 changed
the delta pass to skip intrinsics, which means we may end up being
left with declarations of intrinsics, that aren't otherwise referenced
in the module. This is obviously unwanted, do drop them.
Roman Lebedev [Sat, 2 Jan 2021 18:58:48 +0000 (21:58 +0300)]
[SimplifyCFG][AMDGPU] AMDGPUUnifyDivergentExitNodes: SimplifyCFG isn't ready to preserve PostDomTree
There is a number of transforms in SimplifyCFG that take DomTree out of
DomTreeUpdater, and do updates manually. Until they are fixed,
user passes are unable to claim that PDT is preserved.
Note that the default for SimplifyCFG is still not to preserve DomTree,
so this is still effectively NFC.
Hongtao Yu [Sat, 2 Jan 2021 07:05:43 +0000 (23:05 -0800)]
Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.
`UniqueInternalLinkageNamesPass` is useful to CSSPGO, especially when pseudo probe is used. It solves naming conflict for static functions which otherwise will share a merged profile and likely have a profile quality issue with mismatched CFG checksums. Since the pseudo probe instrumentation happens very early in the pipeline, I'm moving `UniqueInternalLinkageNamesPass` right before it. This is being done only to the new pass manager.
Reviewed By: dblaikie, aeubanks
Differential Revision: https://reviews.llvm.org/D93656
Nathan James [Sat, 2 Jan 2021 19:56:27 +0000 (19:56 +0000)]
[NFC] Switch up some dyn_cast calls
Brandon Bergren [Sat, 2 Jan 2021 18:21:28 +0000 (12:21 -0600)]
[PowerPC] NFC: Apply minor clang-format fix
Brandon Bergren [Sat, 2 Jan 2021 18:18:07 +0000 (12:18 -0600)]
[PowerPC] Enable OpenMP for powerpcle target. [5/5]
Enable OpenMP for powerpcle to match the rest of powerpc*.
Update tests.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D92445
Brandon Bergren [Sat, 2 Jan 2021 18:18:05 +0000 (12:18 -0600)]
[PowerPC] Support powerpcle target in LLD [4/5]
Add support for linking powerpcle code in LLD.
Rewrite lld/test/ELF/emulation-ppc.s to use a shared check block and add powerpcle tests.
Update tests.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D93917
Brandon Bergren [Sat, 2 Jan 2021 18:17:58 +0000 (12:17 -0600)]
[PowerPC] Support powerpcle target in Clang [3/5]
Add powerpcle support to clang.
For FreeBSD, assume a freestanding environment for now, as we only need it in the first place to build loader, which runs in the OpenFirmware environment instead of the FreeBSD environment.
For Linux, recognize glibc and musl environments to match current usage in Void Linux PPC.
Adjust driver to match current binutils behavior regarding machine naming.
Adjust and expand tests.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D93919
Brandon Bergren [Sat, 2 Jan 2021 18:17:39 +0000 (12:17 -0600)]
[PowerPC] Support powerpcle target in LLVMObject [2/5]
Add object file handling for powerpcle-*-*.
Adjust tests.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D93916
Brandon Bergren [Sat, 2 Jan 2021 18:17:22 +0000 (12:17 -0600)]
[PowerPC] Add the LLVM triple for powerpcle [1/5]
Add a triple for powerpcle-*-*.
This is a little-endian encoding of the 32-bit PowerPC ABI, useful in certain niche situations:
1) A loader such as the FreeBSD loader which will be loading a little endian kernel. This is required for PowerPC64LE to load properly in pseries VMs.
Such a loader is implemented as a freestanding ELF32 LSB binary.
2) Userspace emulation of a 32-bit LE architecture such as x86 on 64-bit hosts such as PowerPC64LE with tools like box86 requires having a 32-bit LE toolchain and library set, as they operate by translating only the main binary and switching to native code when making library calls.
3) The Void Linux for PowerPC project is experimenting with running an entire powerpcle userland.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D93918
Michał Górny [Fri, 18 Dec 2020 15:07:20 +0000 (16:07 +0100)]
[Process/NetBSD] Copy changes from FreeBSDRemote and reformat
Copy changes, including:
- NativeProcessNetBSD::GetLoadedModuleFileSpec()
and NativeProcessNetBSD::GetFileLoadAddress() methods
- split x86 register sets by CPU extensions
- use offset/size-based register reading/writing
Differential Revision: https://reviews.llvm.org/D93541
Pavel Labath [Sun, 27 Dec 2020 14:01:37 +0000 (15:01 +0100)]
[lldb] Deduplicate more lldb-server tests
Use auto-generation of lldb-server&debugserver variants.
Pavel Labath [Sun, 27 Dec 2020 13:46:37 +0000 (14:46 +0100)]
[lldb/test] Deduplicate the rest of TestLldbGdbServer.py
Kazu Hirata [Sat, 2 Jan 2021 17:24:16 +0000 (09:24 -0800)]
[Transforms] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Sat, 2 Jan 2021 17:24:15 +0000 (09:24 -0800)]
[llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Kazu Hirata [Sat, 2 Jan 2021 17:24:13 +0000 (09:24 -0800)]
[TableGen] Use llvm::append_range (NFC)
Florian Hahn [Sat, 2 Jan 2021 12:19:52 +0000 (12:19 +0000)]
[LV] Clean up trailing whitespace (NFC).
Clean up some stray whitespace that sneaked in recently.
Gil Rapaport [Sat, 2 Jan 2021 11:43:33 +0000 (13:43 +0200)]
[LV] Add missed optimization fold-tail test
The loop vectorizer avoids folding the tail for loop's whose trip-count is
known to SCEV to be divisible by VF. In this case the assumption providing this
information is not taken into account, so the tail is needlessly folded.
Roman Lebedev [Sat, 2 Jan 2021 11:40:55 +0000 (14:40 +0300)]
[SimplifyCFG] Don't actually take DomTreeUpdater unless we intend to maintain DomTree validity
This guards against unintentional mistakes
like the one i just fixed in previous commit.
Roman Lebedev [Sat, 2 Jan 2021 11:38:52 +0000 (14:38 +0300)]
[NFCI][CodeGen] DwarfEHPrepare: don't actually pass DTU into simplifyCFG by default
also, don't verify DomTree unless we intend to maintain it.
This is a very dumb think-o, i guess i was even warned about it
by subconsciousness in
4b80647367950ba3da6a08260487fd0dbc50a9c5's
commit message..
Fixes a compile-time regression reported by Martin Storsjö
in post-commit review of
2461cdb41724298591133c811df82b0064adfa6b.
Nico Weber [Sat, 2 Jan 2021 04:19:48 +0000 (23:19 -0500)]
Temporarily disable to clang-tidy tests on Windows
They fail at least on my Win bot after switching it to Py3.
See PR48646 for details.
Nico Weber [Sat, 2 Jan 2021 03:58:40 +0000 (22:58 -0500)]
fix typos to cycle bots
Nico Weber [Sat, 2 Jan 2021 03:28:11 +0000 (22:28 -0500)]
fix typo to cycle bots
Nico Weber [Sat, 2 Jan 2021 03:12:58 +0000 (22:12 -0500)]
[gn build] (manually) port
5e31e226b5: Use Py3 for the build
Made necessary by
20670ba440, the first Py3-only change.
Yang Fan [Sat, 2 Jan 2021 02:42:58 +0000 (10:42 +0800)]
[CodeGen][NFC] Fix a build warning due to an extra semicolon
Chengji Yao [Sat, 2 Jan 2021 01:25:40 +0000 (06:55 +0530)]
[MLIR] Fix affine_map compose with multi-symbols
Fix bug: https://bugs.llvm.org/show_bug.cgi?id=46845
Differential Revision: https://reviews.llvm.org/D93831
Hsiangkai Wang [Fri, 1 Jan 2021 16:29:40 +0000 (00:29 +0800)]
[NFC][RISCV] Move vmsge{u}.vx processing to RISCVAsmParser.
We could expand vmsge{u}.vx pseudo instructions in RISCVAsmParser.
It is more appropriate to expand it before encoding.
Differential Revision: https://reviews.llvm.org/D93968
Fangrui Song [Fri, 1 Jan 2021 22:43:08 +0000 (14:43 -0800)]
[sanitizer] Enable mallopt and mallinfo interceptors on Android after D93848
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D93970
Fangrui Song [Fri, 1 Jan 2021 22:09:13 +0000 (14:09 -0800)]
[compiler-rt][test] Suppress stderr of ldd output
Roman Lebedev [Fri, 1 Jan 2021 20:18:35 +0000 (23:18 +0300)]
[AMDGPU][SimplifyCFG] Teach AMDGPUUnifyDivergentExitNodes to preserve {,Post}DomTree
This is a (last big?) part of the patch series to make SimplifyCFG
preserve DomTree. Currently, it still does not actually preserve it,
even thought it is pretty much fully updated to preserve it.
Once the default is flipped, a valid DomTree must be passed into
simplifyCFG, which means that whatever pass calls simplifyCFG,
should also be smart about DomTree's.
As far as i can see from `check-llvm` with default flipped,
this is the last LLVM test batch (other than bugpoint tests)
that needed fixes to not break with default flipped.
The changes here are boringly identical to the ones i did
over 42+ times/commits recently already,
so while AMDGPU is outside of my normal ecosystem,
i'm going to go for post-commit review here,
like in all the other 42+ changes.
Note that while the pass is taught to preserve {,Post}DomTree,
it still doesn't do that by default, because simplifycfg
still doesn't do that by default, and flipping default
in this pass will implicitly flip the default for simplifycfg.
That will happen, but not right now.
Roman Lebedev [Fri, 1 Jan 2021 18:58:12 +0000 (21:58 +0300)]
[SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 17:27:09 +0000 (20:27 +0300)]
[CodeGen][SimplifyCFG] Teach DwarfEHPrepare to preserve DomTree
Once the default for SimplifyCFG flips, we can no longer pass nullptr
instead of DomTree to SimplifyCFG, so we need to propagate it here.
We don't strictly need to actually preserve DomTree in DwarfEHPrepare,
but we might as well do it, since it's trivial.
Roman Lebedev [Fri, 1 Jan 2021 18:15:07 +0000 (21:15 +0300)]
[NFC][CodeGen][Tests] Mark all tests that fail to preserve DomTree for SimplifyCFG as such
These tests start to fail when the SimplifyCFG's default regarding DomTree
updating is switched on, so mark them as needing changes.
Roman Lebedev [Fri, 1 Jan 2021 16:06:44 +0000 (19:06 +0300)]
[NFC][CodeGen] Split DwarfEHPrepare pass into an actual transform and an legacy-PM wrapper
This is consistent with the layout of other passes,
and simplifies further refinements regarding DomTree handling.
This is indended to be a NFC commit.
Roman Lebedev [Fri, 1 Jan 2021 14:57:14 +0000 (17:57 +0300)]
[NFC] clang-format the entire DwarfEHPrepare.cpp
Roman Lebedev [Fri, 1 Jan 2021 21:20:50 +0000 (00:20 +0300)]
[Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require-and-preserve-domtree=1`
Roman Lebedev [Fri, 1 Jan 2021 14:06:56 +0000 (17:06 +0300)]
[IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass
Otherwise these particular tests fail when SimplifyCFG requires DomTree
Roman Lebedev [Fri, 1 Jan 2021 13:37:55 +0000 (16:37 +0300)]
[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 2
Roman Lebedev [Fri, 1 Jan 2021 13:33:19 +0000 (16:33 +0300)]
[SimplifyCFG] Teach tryWidenCondBranchToCondBranch() to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 13:31:11 +0000 (16:31 +0300)]
[SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG
It's probably better than hoping that it will happen to be
already initialized.
Kazu Hirata [Fri, 1 Jan 2021 20:44:56 +0000 (12:44 -0800)]
[llvm] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Fri, 1 Jan 2021 20:44:54 +0000 (12:44 -0800)]
[llvm] Use *Map::lookup (NFC)
Kazu Hirata [Fri, 1 Jan 2021 20:44:52 +0000 (12:44 -0800)]
[SSAUpdater] Remove unused code InstrIsPHI (NFC)
The last use of this function was removed on Jan 4, 2018 in commit
commit
90ecac01e9dcbcaf92781a6dcffa07a27191b661.
Fangrui Song [Fri, 1 Jan 2021 18:46:34 +0000 (10:46 -0800)]
test/OpenMP/parallel_codegen.cpp: Allow multiple result attributes
On many targets the matched line is `define dso_local i32 @main` while
on ppc64 it is `define dso_local signext i32 @main`.
Sanjay Patel [Fri, 1 Jan 2021 17:09:02 +0000 (12:09 -0500)]
[Analysis] flatten enums for recurrence types
This is almost all mechanical search-and-replace and
no-functional-change-intended (NFC). Having a single
enum makes it easier to match/reason about the
reduction cases.
The goal is to remove `Opcode` from reduction matching
code in the vectorizers because that makes it harder to
adapt the code to handle intrinsics.
The code in RecurrenceDescriptor::AddReductionVar() is
the only place that required closer inspection. It uses
a RecurrenceDescriptor and a second InstDesc to sometimes
overwrite part of the struct. It seem like we should be
able to simplify that logic, but it's not clear exactly
which cmp+sel patterns that we are trying to handle/avoid.
Sanjay Patel [Fri, 1 Jan 2021 14:52:44 +0000 (09:52 -0500)]
[Analysis] fix typo in code comment; NFC
Alexey Bataev [Fri, 1 Jan 2021 16:27:23 +0000 (08:27 -0800)]
[SLP]Add a test for correct use of the reordered loads, NFC.
Nikita Popov [Fri, 1 Jan 2021 16:00:02 +0000 (17:00 +0100)]
[InstSimplify] Add tests for gep p, -p without inbounds (NFC)
This is additional test coverage for D93820.
Nikita Popov [Fri, 1 Jan 2021 15:32:19 +0000 (16:32 +0100)]
[LVI] Handle unions of conditions
LVI previously handled "if (L && R)" conditions, but not
"if (L || R)" conditions. The latter case can still produce
useful information if L and R both constrain the same variable.
This adds support for handling the "if (L || R)" case as well.
The only difference is that we take the union instead of the
intersection of the lattice values.
Nikita Popov [Fri, 1 Jan 2021 15:12:44 +0000 (16:12 +0100)]
[CVP] Add tests for union of conditions (NFC)
We currently handle intersected conditions, but not unioned
conditions.
Paul C. Anagnostopoulos [Fri, 25 Dec 2020 00:02:52 +0000 (19:02 -0500)]
[TableGen] Continue cleaning up .td files
This pass includes LLVM and MLIR files.
Differential Revision: https://reviews.llvm.org/D93864
Florian Hahn [Fri, 1 Jan 2021 13:31:59 +0000 (13:31 +0000)]
[LoopDistribute] Add tests with uncomputable BTCs.
Florian Hahn [Fri, 1 Jan 2021 13:31:23 +0000 (13:31 +0000)]
[LoopLoadElim] Add tests with uncomputable BTCs.
Florian Hahn [Thu, 31 Dec 2020 12:40:48 +0000 (12:40 +0000)]
[LAA] Add tests with uncomputable BTCs.
Florian Hahn [Wed, 30 Dec 2020 16:14:40 +0000 (16:14 +0000)]
[LV] Fix crash when generating remarks with multi-exit loops.
If DoExtraAnalysis is true (e.g. because remarks are enabled), we
continue with the analysis rather than exiting. Update code to
conditionally check if the ExitBB has phis or not a single predecessor.
Otherwise a nullptr is dereferenced with DoExtraAnalysis.
Juneyoung Lee [Fri, 1 Jan 2021 13:35:57 +0000 (22:35 +0900)]
Precommit a test for D92015 (NFC)
Yang Fan [Fri, 1 Jan 2021 06:16:12 +0000 (14:16 +0800)]
[clang-tidy][NFC] Fix a build warning due to an extra semicolon
Differential Revision: https://reviews.llvm.org/D93961
Yang Fan [Fri, 1 Jan 2021 05:30:36 +0000 (13:30 +0800)]
[Sema] Fix deleted function problem in implicitly movable test
In implicitly movable test, a two-stage overload resolution is performed.
If the first overload resolution selects a deleted function, Clang directly
performs the second overload resolution, without checking whether the
deleted function matches the additional criteria.
This patch fixes the above problem.
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D92936
Andrew Litteken [Tue, 8 Sep 2020 18:42:56 +0000 (13:42 -0500)]
[IRSim][IROutliner] Allowing call instructions to be outlined.
We add an extra check to make sure that we do not outline calls to
indirect functions, but outline whatever the IRSimilarityIdentifier
finds with respect to calls.
Tests:
Removing test/Transforms/IROutliner/illegal-calls.ll
Adding test/Transforms/IROutliner/outlining-calls.ll
Adding test/Transforms/IROutliner/illegal-indirect-calls.ll
Excluding DebugInfo this is the last patch for the initial
implementation of the IROutliner!
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87314
Andrew Litteken [Wed, 16 Sep 2020 03:25:05 +0000 (22:25 -0500)]
[IRSim] Letting call instructions be legal for similarity identification.
Here we let non-intrinsic calls be considered legal and valid for
similarity only if the call is not indirect, and has a name.
For two calls to be considered similar, they must have the same name,
the same function types, and the same set of parameters, including tail
calls and calling conventions.
Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87312
Roman Lebedev [Fri, 1 Jan 2021 00:19:17 +0000 (03:19 +0300)]
[SimplifyCFG] SUCCESS! Teach createUnreachableSwitchDefault() to preserve DomTree
This pretty much concludes patch series for updating SimplifyCFG
to preserve DomTree. All 318 dedicated `-simplifycfg` tests now pass
with `-simplifycfg-require-and-preserve-domtree=1`.
There are a few leftovers that apparently don't have good test coverage.
I do not yet know what gaps in test coverage will the wider-scale testing
reveal, but the default flip might be close.
Roman Lebedev [Thu, 31 Dec 2020 23:44:17 +0000 (02:44 +0300)]
[SimplifyCFG] Teach tryToSimplifyUncondBranchWithICmpInIt() to preserve DomTree
Roman Lebedev [Thu, 31 Dec 2020 23:21:53 +0000 (02:21 +0300)]
[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 2
Roman Lebedev [Thu, 31 Dec 2020 22:02:06 +0000 (01:02 +0300)]
[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 1
Roman Lebedev [Thu, 31 Dec 2020 21:13:48 +0000 (00:13 +0300)]
[SimplifyCFG] Teach SimplifyEqualityComparisonWithOnlyPredecessor() to preserve DomTree, part 3
Roman Lebedev [Thu, 31 Dec 2020 19:46:42 +0000 (22:46 +0300)]
[SimplifyCFG] Teach simplifyIndirectBr() to preserve DomTree
Roman Lebedev [Thu, 31 Dec 2020 19:23:23 +0000 (22:23 +0300)]
[SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 2
Roman Lebedev [Thu, 31 Dec 2020 17:13:30 +0000 (20:13 +0300)]
[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 1
Andrew Litteken [Tue, 8 Sep 2020 01:19:54 +0000 (20:19 -0500)]
[IRSim][IROutliner] Allowing GEP instructions to be outlined.
We outline what the IRSimilarityIdentifier deems GEP Instructions to be
similar. In this case, the types must be the same, and the operand
values after the first indexing operand must be the exact same.
Tests:
Removing test/Transforms/IROutliner/illegal-gep.ll
Adding test/Transforms/IROutliner/outlining-gep.ll
Reviewers: jroelofs, paquette
Differential Revision: https://reviews.llvm.org/D87317
Jacques Pienaar [Thu, 31 Dec 2020 22:46:08 +0000 (14:46 -0800)]
[mlir][shape] Add shape.lib attribute
Enable querying shape function library ops from the module. Currently
supports singular or array of them (as long as array has all unique ops
in mappings). The preferred canonical form would have one library, but
given the invariant on the mapping, this can easily be achieved by a
simple merging pass.
Preferred the attribute approach vs naming convention as these could be
added in multiple different ways.
Sanjay Patel [Thu, 31 Dec 2020 21:45:33 +0000 (16:45 -0500)]
[Analysis] reduce code for matching min/max; NFC
This might also make it easier to adapt if we want
to match min/max intrinsics rather than cmp+sel idioms.
The 'const' part is to potentially avoid confusion
in calling code. There's some surprising and possibly
wrong behavior related to matching min/max reductions
differently than other reductions.
Fangrui Song [Thu, 31 Dec 2020 21:59:45 +0000 (13:59 -0800)]
Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions
The idea is that the CC1 default for ELF should set dso_local on default
visibility external linkage definitions in the default -mrelocation-model pic
mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar.
The refactoring is made available by
2820a2ca3a0e69c3f301845420e0067ffff2251b.
Currently only x86 supports local aliases. We move the decision to the driver.
There are three CC1 states:
* -fsemantic-interposition: make some linkages interposable and make default visibility external linkage definitions dso_preemptable.
* (default): selected if the target supports .Lfoo$local: make default visibility external linkage definitions dso_local
* -fhalf-no-semantic-interposition: if neither option is set or the target does not support .Lfoo$local: like -fno-semantic-interposition but local aliases are not used. So references can be interposed if not optimized out.
Add -fhalf-no-semantic-interposition to a few tests using the half-based semantic interposition behavior.
Fangrui Song [Thu, 31 Dec 2020 21:37:35 +0000 (13:37 -0800)]
[test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences
ELF -cc1 -mrelocation-model pic will default to no semantic interposition plus
setting dso_local on default visibility external linkage definitions, so that
COFF, Mach-O and ELF output will be similar.
This patch makes tests immune to the differences.
Andrew Litteken [Thu, 31 Dec 2020 21:13:46 +0000 (15:13 -0600)]
Revert "remove pessimizing moves (reported by gcc 10)"
Causing multiple different buildbots to fail with similar errors to:
http://lab.llvm.org:8011/#/builders/84/builds/3719/
http://lab.llvm.org:8011/#/builders/21/builds/5863/
This reverts commit
a2513cb8655e0aea4baffb4391e946ad3e56d883.
Juneyoung Lee [Thu, 31 Dec 2020 20:59:26 +0000 (05:59 +0900)]
Add tests for D93943 (NFC)
Andrew Litteken [Tue, 8 Sep 2020 01:12:52 +0000 (20:12 -0500)]
[IRSim] Letting gep instructions be legal for similarity identification.
GetElementPtr instructions require the extra check that all operands
after the first must only be constants and be exactly the same to be
considered similar.
Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.
Nuno Lopes [Thu, 31 Dec 2020 20:35:56 +0000 (20:35 +0000)]
remove pessimizing moves (reported by gcc 10)
Juneyoung Lee [Thu, 31 Dec 2020 19:46:10 +0000 (04:46 +0900)]
[CodeGen] recognize select form of and/ors when splitting branch conditions
Recently a few patches are made to move towards using select i1 instead of and/or i1 to represent "a && b"/"a || b" in C/C++.
"a && b" in C/C++ does not evaluate b if a is false whereas 'and a, b' in IR evaluates b and uses its result regardless of the result of a.
This is problematic because it can cause miscompilation if b was an erroneous operation (https://llvm.org/pr48353).
In C/C++, the result is simply false because b is not evaluated, but in IR the result is poison.
The discussion at D93065 has more context about this.
This patch makes two branch-splitting optimizations (one in SelectionDAGBuilder, one in CodeGenPrepare) recognize
select form of and/or as well using m_LogicalAnd/Or.
Since it is CodeGen, I think this is semantically ok (at least as safe as what codegen already did).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93853
Juneyoung Lee [Thu, 31 Dec 2020 19:33:18 +0000 (04:33 +0900)]
[SCEV] recognize logical and/or pattern
This patch makes SCEV recognize 'select A, B, false' and 'select A, true, B'.
This is a performance improvement that will be helpful after unsound select -> and/or transformation is removed, as discussed in D93065.
SCEV's answers for the select form should be a bit more conservative than the equivalent `and A, B` / `or A, B`.
Take this example: https://alive2.llvm.org/ce/z/NsP9ue .
To check whether it is valid for SCEV's computeExitLimit to return min(n, m) as ExactNotTaken value, I put llvm.assume at tgt.
It fails because the exit limit becomes poison if n is zero and m is poison. This is problematic if e.g. the exit value of i is replaced with min(n, m).
If either n or m is constant, we can revive the analysis again. I added relevant tests and put alive2 links there.
If and is used instead, this is okay: https://alive2.llvm.org/ce/z/K9rbJk . Hence the existing analysis is sound.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93882
Atmn [Thu, 31 Dec 2020 17:50:17 +0000 (12:50 -0500)]
[Clang][Misc] Change run line in fragile test
This test has %clang in the run line when it should have %clang_cc1.
This should prevent future release test failures.
Differential Revision: https://reviews.llvm.org/D93952
Andrew Litteken [Mon, 24 Aug 2020 08:24:59 +0000 (03:24 -0500)]
[IROutliner] Adding consistent function attribute merging
When combining extracted functions, they may have different function
attributes. We want to make sure that we do not make any assumptions,
or lose any information. This attempts to make sure that we consolidate
function attributes to their most general case.
Tests:
llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll
llvm/test/Transforms/IROutliner/outlining-compatible-or-attribute-transfer.ll
Reviewers: jdoefert, paquette
Differential Revision: https://reviews.llvm.org/D87301
Fangrui Song [Thu, 31 Dec 2020 18:04:21 +0000 (10:04 -0800)]
[ThinLTO] Default -enable-import-metadata to false
The default value is dependent on `-DLLVM_ENABLE_ASSERTIONS={off,on}` (D22167), which is
error-prone. The few tests checking `!thinlto_src_module` can specify -enable-import-metadata explicitly.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D93959
Kazu Hirata [Thu, 31 Dec 2020 17:39:12 +0000 (09:39 -0800)]
[MemorySSA, BPF] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Thu, 31 Dec 2020 17:39:11 +0000 (09:39 -0800)]
[CodeGen] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Thu, 31 Dec 2020 17:39:09 +0000 (09:39 -0800)]
[llvm-objcopy] Use llvm::erase_if (NFC)
Fangrui Song [Thu, 31 Dec 2020 17:31:53 +0000 (09:31 -0800)]
[ThinLTO][test] Specify -enable-import-metadata to make !thinlto_src_module available in -DLLVM_ENABLE_ASSERTIONS=off mode
Fangrui Song [Thu, 31 Dec 2020 17:16:35 +0000 (09:16 -0800)]
[ThinLTO][test] Add visibility related tests
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D92899
Dávid Bolvanský [Thu, 31 Dec 2020 14:04:32 +0000 (15:04 +0100)]
[InstCombine] Transform (A + B) - (A & B) to A | B (PR48604)
define i32 @src(i32 %x, i32 %y) {
%0:
%a = add i32 %x, %y
%o = and i32 %x, %y
%r = sub i32 %a, %o
ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
%b = or i32 %x, %y
ret i32 %b
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/2fhW6r
Dávid Bolvanský [Thu, 31 Dec 2020 13:59:15 +0000 (14:59 +0100)]
[NFC] Added/adjusted tests for PR48604; second pattern
Dávid Bolvanský [Thu, 31 Dec 2020 13:02:44 +0000 (14:02 +0100)]
[InstCombine] Transform (A + B) - (A | B) to A & B (PR48604)
define i32 @src(i32 %x, i32 %y) {
%0:
%a = add i32 %x, %y
%o = or i32 %x, %y
%r = sub i32 %a, %o
ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
%b = and i32 %x, %y
ret i32 %b
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/aQRh2j