platform/upstream/llvm.git
3 years ago[mlir] NFC: small improvement to how we print a gpu.launch op.
Christian Sigg [Thu, 8 Oct 2020 11:17:22 +0000 (13:17 +0200)]
[mlir] NFC: small improvement to how we print a gpu.launch op.

Reviewed By: mehdi_amini

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

3 years ago[NFC] Fix banner
Luís Marques [Fri, 9 Oct 2020 09:00:11 +0000 (10:00 +0100)]
[NFC] Fix banner

3 years ago[DAGCombiner] Add decomposition patterns for Mul-by-Imm.
Esme-Yi [Fri, 9 Oct 2020 08:51:40 +0000 (08:51 +0000)]
[DAGCombiner] Add decomposition patterns for Mul-by-Imm.

Summary: This patch is derived from D87384.
In this patch we expand the existing decomposition of mul-by-constant to be more general by implementing 2 patterns:
```
  mul x, (2^N + 2^M) --> (add (shl x, N), (shl x, M))
  mul x, (2^N - 2^M) --> (sub (shl x, N), (shl x, M))
```
The conversion will be trigged if the multiplier is a big constant that the target can't use a single multiplication instruction to handle. This is controlled by the hook `decomposeMulByConstant`.
More over, the conversion benefits from an ILP improvement since the instructions are independent. A case with the sequence like following also gets benefit since a shift instruction is saved.

```
*res1 = a * 0x8800;
*res2 = a * 0x8080;
```

Reviewed By: spatel

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

3 years ago[llvm-readelf/obj][test] - Stop using precompiled binary in mips-plt.test
Georgii Rymar [Fri, 9 Oct 2020 07:13:56 +0000 (10:13 +0300)]
[llvm-readelf/obj][test] - Stop using precompiled binary in mips-plt.test

This removes the precompiled binary and rewrites test to use YAML.

After this change we'll have no more precompiled inputs in `llvm-readobj/ELF/Inputs`.

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

3 years ago[lldb] Delete copy operations on PluginInterface class
Pavel Labath [Fri, 9 Oct 2020 08:35:02 +0000 (10:35 +0200)]
[lldb] Delete copy operations on PluginInterface class

This is a polymorphic class, copying it is a bad idea.

This was not a problem because most classes inheriting from it were
deleting their copy operations themselves. However, this enables us to
delete those explicit deletions, and ensure noone forgets to add them in
the future.

3 years ago[Fixed Point] Add floating point methods to APFixedPoint.
Bevin Hansson [Fri, 14 Aug 2020 09:47:25 +0000 (11:47 +0200)]
[Fixed Point] Add floating point methods to APFixedPoint.

This adds methods to APFixedPoint for converting to and from
floating point values.

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

3 years agoRefactor fixed point conversion test.
Bevin Hansson [Tue, 25 Aug 2020 13:59:12 +0000 (15:59 +0200)]
Refactor fixed point conversion test.

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

3 years ago[IR] Add Type::getFloatingPointTy.
Bevin Hansson [Fri, 11 Sep 2020 11:59:22 +0000 (13:59 +0200)]
[IR] Add Type::getFloatingPointTy.

It is possible to get a fltSemantics of a particular Type,
but there is no way to produce a Type based on a
fltSemantics.

This adds the function Type::getFloatingPointTy, which
will return the appropriate floating point Type for a given
fltSemantics.

ConstantFP is modified to use this function instead of
implementing it itself. Also some minor refactors to use
Type::getFltSemantics instead of a hand-rolled version.

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

3 years ago[clangd] Fix dead variable, typo. NFC
Sam McCall [Fri, 9 Oct 2020 08:21:25 +0000 (10:21 +0200)]
[clangd] Fix dead variable, typo. NFC

3 years ago[clangd] Enable partial namespace matches for workspace symbols
Kadir Cetinkaya [Mon, 5 Oct 2020 09:52:58 +0000 (11:52 +0200)]
[clangd] Enable partial namespace matches for workspace symbols

This will enable queries like "clangd::" to find symbols under clangd
namespace, without requiring full "clang::clangd::" qualification.

Since Fuzzyfind performs the search under all scopes and only boosts the symbols
from relevant namespaces, we might get symbols from non-matching namespaces.
This patch chooses to drop those as they clearly do not match the query.

Fixes https://github.com/clangd/clangd/issues/550.

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

3 years ago[clangd] Reduce availability of extract function
Kadir Cetinkaya [Wed, 5 Aug 2020 20:18:39 +0000 (22:18 +0200)]
[clangd] Reduce availability of extract function

This patch introduces hoisting detection logic into prepare state with
a partial AST traversal of the enclosing function.

We had some complaints from the users about this code action being almost always
available but failing most of the time. Hopefully this should reduce that noise.

The latency/correctness tradeoff is a bunch of hand-waving, but at least today
we don't have any other actions that are available on selection of statements,
so when we get to do the traversal it is quite likely that all the other checks
will bail out early. But this is still up for discussion, I am happy to abandon
the patch if you believe this is not practical.

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

3 years ago[clangd] Add more incomplete_type diagnostics that could be fixed by include-fixer.
Haojian Wu [Fri, 9 Oct 2020 06:51:17 +0000 (08:51 +0200)]
[clangd] Add more incomplete_type diagnostics that could be fixed by include-fixer.

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

3 years agoRemove -gen-pass-doc from Flang CMake configuration: the documentation generation...
Mehdi Amini [Fri, 9 Oct 2020 06:17:53 +0000 (06:17 +0000)]
Remove -gen-pass-doc from Flang CMake configuration: the documentation generation is broken

`ninja mlir-doc` fails when Flang is configured with this.

3 years agoRevert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and...
Mehdi Amini [Fri, 9 Oct 2020 06:16:42 +0000 (06:16 +0000)]
Revert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait"

This reverts commit 1ceaffd95a6bdc4b7d2193e049bcd6b40ee9ff50.

The build is broken with  -DBUILD_SHARED_LIBS=ON ; seems like a possible
layering issue to investigate:

tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Operation.cpp.o: In function `mlir::MemoryEffectOpInterface::hasNoEffect(mlir::Operation*)':
Operation.cpp:(.text._ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE[_ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE]+0x9c): undefined reference to `mlir::MemoryEffectOpInterface::getEffects(llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect> >&)'

3 years agoGive attributes C++ namespaces.
Federico Lebrón [Fri, 9 Oct 2020 03:58:42 +0000 (03:58 +0000)]
Give attributes C++ namespaces.

Reviewed By: mehdi_amini, jpienaar

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

3 years ago[mlir] Improve LLVM shlib support
Serge Guelton [Mon, 5 Oct 2020 19:35:18 +0000 (15:35 -0400)]
[mlir] Improve LLVM shlib support

mlir-tblgen was incompatible with libLLVM, due to explicit linkage with
libLLVMSupport etc.
As it cannot link with libLLVM, make sure all lib it uses are not using libLLVM
either.

As a side effect, also remove some explicit references to LLVM libs and use
components instead.

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

3 years ago[MCRegister] Simplify isStackSlot & isPhysicalRegister and delete isPhysical. NFC
Fangrui Song [Fri, 9 Oct 2020 05:08:13 +0000 (22:08 -0700)]
[MCRegister] Simplify isStackSlot & isPhysicalRegister and delete isPhysical. NFC

3 years ago[lldb] Format remaining signal table (NFC)
Jonas Devlieghere [Fri, 9 Oct 2020 03:01:21 +0000 (20:01 -0700)]
[lldb] Format remaining signal table (NFC)

Restore the signal tables to its original glory and mark it as not to be
clang-formatted.

3 years agoFix incorect Register -> MCRegister conversion
Fangrui Song [Fri, 9 Oct 2020 04:38:17 +0000 (21:38 -0700)]
Fix incorect Register -> MCRegister conversion

getReg returns a Register which may represent a virtual register.

3 years ago[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it...
ahmedsabie [Fri, 9 Oct 2020 02:58:10 +0000 (02:58 +0000)]
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait

This change allows folds to be done on a newly introduced involution trait rather than having to manually rewrite this optimization for every instance of an involution

Reviewed By: rriddle, andyly, stephenneuendorffer

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

3 years ago[X86] Passing union type through register
Liu, Chen3 [Fri, 9 Oct 2020 03:20:29 +0000 (11:20 +0800)]
[X86] Passing union type through register

For example:

  union M256 {
    double d;
    __m256 m;
  };
  extern void foo1(union M256 A);
  union M256 m1;
  void test() {
    foo1(m1);
  }

clang will pass m1 through stack which does not follow the ABI.

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

3 years ago[llvm-dwarfdump][test] Rewrite verify_die_ranges.s in YAML. NFC.
Xing GUO [Fri, 9 Oct 2020 03:13:05 +0000 (11:13 +0800)]
[llvm-dwarfdump][test] Rewrite verify_die_ranges.s in YAML. NFC.

This patch rewrites test case verify_die_ranges.s in YAML which helps
simplify the test.

Reviewed By: jhenderson, JDevlieghere, dblaikie

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

3 years ago[DWARFYAML] Make the opcode_base and the standard_opcode_lengths fields optional.
Xing GUO [Fri, 9 Oct 2020 03:09:29 +0000 (11:09 +0800)]
[DWARFYAML] Make the opcode_base and the standard_opcode_lengths fields optional.

This patch makes the opcode_base and the standard_opcode_lengths fields
of the line table optional. When both of them are not specified,
yaml2obj emits them according to the line table's version.

Reviewed By: jhenderson

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

3 years ago[VE] Add new MVT types for NEC SX Aurora VE vector
Kazushi (Jam) Marukawa [Sat, 3 Oct 2020 05:27:51 +0000 (14:27 +0900)]
[VE] Add new MVT types for NEC SX Aurora VE vector

This patch adds entries for:
    v64i64
    v128i64
    v256i64
    v64f64
    v128f64
    v256f64

Reviewed By: simoll

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

3 years ago[AST] Fix crashes caused by redeclarations in hidden prototypes
Ben Barham [Fri, 9 Oct 2020 02:48:33 +0000 (19:48 -0700)]
[AST] Fix crashes caused by redeclarations in hidden prototypes

ObjCContainerDecl.getMethod returns a nullptr by default when the
container is a hidden prototype. Callsites where the method is being
looked up on the redeclaration's own container should skip this check
since they (rightly) expect a valid method to be found.

Resolves rdar://69444243

Reviewed By: akyrtzi

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

3 years ago[TwoAddressInstruction][PowerPC] Call `regOverlapsSet` to find out real clobbers...
Kai Luo [Fri, 9 Oct 2020 02:28:22 +0000 (02:28 +0000)]
[TwoAddressInstruction][PowerPC] Call `regOverlapsSet` to find out real clobbers and uses

In `rescheduleKillAboveMI`, current implementation uses `SmallSet` to track reg's defs and uses. When comparing, use `SmallSet.count` to find out if it's clobbered or used. It's not correct if involving subregisters. This patch uses `regOverlapsSet` already used by `rescheduleMIBelowKill` to fix the issue.

Fixed https://bugs.llvm.org/show_bug.cgi?id=47707.

Reviewed By: #powerpc, nemanjai

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

3 years ago[NFC][PowerPC] Supplement test cases for D88274.
Esme-Yi [Fri, 9 Oct 2020 02:32:05 +0000 (02:32 +0000)]
[NFC][PowerPC] Supplement test cases for D88274.

3 years ago[NFC][Test] Update the test with update_llc_test_checks.py
QingShan Zhang [Fri, 9 Oct 2020 02:26:03 +0000 (02:26 +0000)]
[NFC][Test] Update the test with update_llc_test_checks.py

3 years ago[mlir][CAPI] Remove the exclusion of the MLIR C-API from libMLIR.so.
Stella Laurenzo [Thu, 8 Oct 2020 23:41:11 +0000 (16:41 -0700)]
[mlir][CAPI] Remove the exclusion of the MLIR C-API from libMLIR.so.

* I believe this was done early on due to it being experimental/etc.
* Needed for dynamic linking in npcomp.

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

3 years ago[libc++] Add caching for feature-detection Lit tests
Louis Dionne [Wed, 7 Oct 2020 20:30:32 +0000 (16:30 -0400)]
[libc++] Add caching for feature-detection Lit tests

This significantly speeds up the configuration of libc++'s test suite
by making sure that we don't perform the same operations over and over
again.

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

3 years agoRe-land [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them...
Alexandre Ganea [Fri, 9 Oct 2020 00:48:50 +0000 (20:48 -0400)]
Re-land [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them as artificial

Previously, when clang was compiled with -DLLVM_ENABLE_ASSERTIONS=ON, the added tests were displaying:

inlinable function call in a function with debug info must have a !dbg location
  call void @"??1?$c@UB@@@@QEAA@XZ"(%struct.c* @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A")
fatal error: error in backend: Broken module found, compilation aborted!
Stack dump:
0.      Program arguments: <f:\svn\buildninja\bin\clang -cc1 -emit-llvm debug-info-no-location.cpp> -gcodeview -debug-info-kind=limited
1.      <eof> parser at end of file
2.      Per-function optimization

Fixes PR43012

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

3 years ago[PowerPC] Add RUN line for powerpc 32-bit. NFC.
Kai Luo [Fri, 9 Oct 2020 00:29:01 +0000 (00:29 +0000)]
[PowerPC] Add RUN line for powerpc 32-bit. NFC.

3 years ago[AMDGPU] Fix mai hazard VALU to LD/ST
Austin Kerbow [Thu, 8 Oct 2020 20:19:34 +0000 (13:19 -0700)]
[AMDGPU] Fix mai hazard VALU to LD/ST

Fixes: SWDEV-251863

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

3 years agoPR47175: Ensure type-dependent function-style casts have dependent
Richard Smith [Fri, 9 Oct 2020 00:00:22 +0000 (17:00 -0700)]
PR47175: Ensure type-dependent function-style casts have dependent
types.

Previously, a type-dependent cast to a deduced class template
specialization type would end up with a non-dependent class template
specialization type, leading to confusion downstream.

3 years ago[NFC] Fix a comment in MachinePassManager.h
Yuanfang Chen [Thu, 8 Oct 2020 22:38:57 +0000 (15:38 -0700)]
[NFC] Fix a comment in MachinePassManager.h

Fix "warning: '\returns' command used in a comment that is not attached
to a function or method declaration [-Wdocumentation]
1 warning generated."

3 years ago[X86] Fix some clang-tidy bugprone-argument-comment issues
Fangrui Song [Thu, 8 Oct 2020 22:22:32 +0000 (15:22 -0700)]
[X86] Fix some clang-tidy bugprone-argument-comment issues

3 years agoChange the default handling of SIGCONT to nosuppress/nostop/notify
Jim Ingham [Thu, 8 Oct 2020 22:21:51 +0000 (15:21 -0700)]
Change the default handling of SIGCONT to nosuppress/nostop/notify

Except for the few people actually debugging shells, stopping on a
SIGCONT doesn't add any value.  And for people trying to run tests
under the debugger, stopping here is actively inconvenient.  So this
patch switches the default behavior to not stop.

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

3 years ago[NFC][MC] MCRegister API typing.
Mircea Trofin [Wed, 7 Oct 2020 23:11:50 +0000 (16:11 -0700)]
[NFC][MC] MCRegister API typing.

Mostly LiveIntervals, with their effects (users).

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

3 years ago[mlir][vector] Add integration test for vector distribute transformation
Thomas Raoux [Thu, 8 Oct 2020 21:45:56 +0000 (14:45 -0700)]
[mlir][vector] Add integration test for vector distribute transformation

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

3 years ago[mlir][vector] Add unit test for vector distribute by block
Thomas Raoux [Thu, 8 Oct 2020 21:41:57 +0000 (14:41 -0700)]
[mlir][vector] Add unit test for vector distribute by block

When distributing a vector larger than the given multiplicity, we can
distribute it by block where each id gets a chunk of consecutive element
along the dimension distributed. This adds a test for this case and adds extra
checks to make sure we don't distribute for cases not multiple of multiplicity.

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

3 years ago[HWAsan][NewPM] Handle hwasan like other sanitizers
Arthur Eubanks [Tue, 6 Oct 2020 23:13:50 +0000 (16:13 -0700)]
[HWAsan][NewPM] Handle hwasan like other sanitizers

Move it as an EP callback (-O[123]) or in addSanitizersAtO0.

This makes it not run in ThinLTO pre-link (like the other sanitizers),
so don't check LTO runs in hwasan-new-pm.c. Changing its position also
seems to change the generated IR. I think we just need to make sure the
pass runs.

Reviewed By: leonardchan

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

3 years ago[LLDB] More Windows non-English locales fixes
Alexandre Ganea [Thu, 8 Oct 2020 21:20:40 +0000 (17:20 -0400)]
[LLDB] More Windows non-English locales fixes

This is a follow-up for https://reviews.llvm.org/D88975

3 years ago[InstCombine] visitTrunc - trunc(shl(X, C)) --> shl(trunc(X),trunc(C)) vector support
Simon Pilgrim [Thu, 8 Oct 2020 21:07:36 +0000 (22:07 +0100)]
[InstCombine] visitTrunc - trunc(shl(X, C)) --> shl(trunc(X),trunc(C)) vector support

Annoyingly vectors aren't supported by shouldChangeType(), but we have precedents for always performing this on vector types (e.g. narrowBinOp).

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

3 years ago[GlobalISel] Add missing pass dependencies for IRTranslator
Quentin Colombet [Thu, 8 Oct 2020 20:54:24 +0000 (13:54 -0700)]
[GlobalISel] Add missing pass dependencies for IRTranslator

The IRTranslator depends on the branch probability info pass when the
optimization level is different than None and it depends all the time on
the StackProtector pass.

We have to explicitly call out pass dependencies otherwise the pass manager
may not be able to schedule the IRTranslator.

Before this patch, we were lucky because previous passes depend on the branch
probability info pass (like the Global Variable Optimization) and the stack
protector pass is initialized in initializeCodeGen.
However, if the target has a custom pipeline without any passes like Global
Variable Optimization, the pipeline creation will fail, at least because of
the branch probability info pass dependency (it is unlikely that
initializeCodeGen is not called).

This patch adds the missing dependencies to the IRTranslator.

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

3 years ago[libc] Update buildbot worker version to 2.8.4.
Paula Toth [Thu, 8 Oct 2020 20:43:47 +0000 (13:43 -0700)]
[libc] Update buildbot worker version to 2.8.4.

Tested locally by connecting to LLVM master. (:
http://lab.llvm.org:8011/#/builders/78/builds/1

Reviewed By: sivachandra

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

3 years ago[InstCombine] Add additional trunc(shl(x,c)) -> shl(trunc(x),trunc(c)) vector tests
Simon Pilgrim [Thu, 8 Oct 2020 19:47:07 +0000 (20:47 +0100)]
[InstCombine] Add additional trunc(shl(x,c)) -> shl(trunc(x),trunc(c)) vector tests

3 years ago[InstCombine] allow vector splats for add+xor with low-mask
Sanjay Patel [Thu, 8 Oct 2020 19:49:55 +0000 (15:49 -0400)]
[InstCombine] allow vector splats for add+xor with low-mask

This can be allowed with undef elements too, but that can be another step:
https://alive2.llvm.org/ce/z/hnC4Z-

3 years agoFix typo `DenseElementAttr`-> `DenseElementsAttr` in some comments (NFC)
Mehdi Amini [Thu, 8 Oct 2020 19:40:48 +0000 (19:40 +0000)]
Fix typo `DenseElementAttr`-> `DenseElementsAttr` in some comments (NFC)

3 years ago[Transforms] visitCmpBlock - don't dereference a dyn_cast<>. NFCI.
Simon Pilgrim [Thu, 8 Oct 2020 19:18:18 +0000 (20:18 +0100)]
[Transforms] visitCmpBlock - don't dereference a dyn_cast<>. NFCI.

Use cast<> as we immediately dereference the pointer afterwards - cast<> will assert if we fail.

Prevents clang static analyzer warning that we could deference a null pointer.

3 years ago[InstCombine] remove unnecessary one-use check from add-xor transform
Sanjay Patel [Thu, 8 Oct 2020 18:21:16 +0000 (14:21 -0400)]
[InstCombine] remove unnecessary one-use check from add-xor transform

Pre-conditions seem to be optimal, but we don't need a use check
because we are only replacing an add with a sub.

https://rise4fun.com/Alive/hzN

  Pre: (~C1 | C2 == -1) && isPowerOf2(C2+1)
  %m = and i8 %x, C1
  %f = xor i8 %m, C2
  %r = add i8 %f, C3
  =>
  %r = sub i8 C2 + C3, %m

3 years ago[InstCombine] add tests for add-xor; NFC
Sanjay Patel [Thu, 8 Oct 2020 18:08:06 +0000 (14:08 -0400)]
[InstCombine] add tests for add-xor; NFC

3 years agoFix Wparentheses warning. NFCI.
Simon Pilgrim [Thu, 8 Oct 2020 19:02:04 +0000 (20:02 +0100)]
Fix Wparentheses warning. NFCI.

Wrap the containErrors() calls together - assert we have any containErrors cases in the conditional operator.

3 years ago[SLP] optimizeGatherSequence - assert every Instruction in the worklist is non-null.
Simon Pilgrim [Thu, 8 Oct 2020 18:23:32 +0000 (19:23 +0100)]
[SLP] optimizeGatherSequence - assert every Instruction in the worklist is non-null.

Fixes clang static analyzer warning.

3 years ago[WebAssembly] Handle indirect uses of longjmp
Heejin Ahn [Thu, 8 Oct 2020 09:44:16 +0000 (02:44 -0700)]
[WebAssembly] Handle indirect uses of longjmp

In LowerEmscriptenEHSjLj, `longjmp` used to be replaced with
`emscripten_longjmp_jmpbuf(jmp_buf*, i32)`, which will eventually be
lowered to `emscripten_longjmp(i32, i32)`. The reason we used two
different names was because they had different signatures in the IR
pass.

D88697 fixed this by only using `emscripten_longjmp(i32, i32)` and
adding a `ptrtoint` cast to its first argument, so
```
longjmp(buf, 0)
```
becomes
```
emscripten_longjmp((i32)buf, 0)
```

But this assumed all uses of `longjmp` was a direct call to it, which
was not the case. This patch handles indirect uses of `longjmp` by
replacing
```
longjmp
```
with
```
(i32(*)(jmp_buf*, i32))emscripten_longjmp
```

Reviewed By: tlively

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

3 years ago[KnownBits] Add a sextOrTrunc method
Quentin Colombet [Tue, 6 Oct 2020 23:27:28 +0000 (16:27 -0700)]
[KnownBits] Add a sextOrTrunc method

We already offer zextOrTrunc and it seems natural to offer the
same capability for sign extension.

This patch is a preparatory addition useful for future computeKnownBits
developments.

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

3 years ago[KnownBits] Add a computeForMul method
Quentin Colombet [Tue, 6 Oct 2020 21:41:31 +0000 (14:41 -0700)]
[KnownBits] Add a computeForMul method

This patch refactors the logic in ValueTracking.cpp so that
computeKnownBitsForMul now uses a helper function from KnownBits.

NFC

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

3 years ago[unittests] Add a few tests for computeKnownBits with ranges
Quentin Colombet [Tue, 6 Oct 2020 21:34:47 +0000 (14:34 -0700)]
[unittests] Add a few tests for computeKnownBits with ranges

These tests make sure that the range information is properly
understood during computeKnownBits analysis.

NFC

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

3 years ago[runtimes] Use int main(int, char**) consistently in tests
Louis Dionne [Thu, 8 Oct 2020 17:36:33 +0000 (13:36 -0400)]
[runtimes] Use int main(int, char**) consistently in tests

This is needed when running the tests in Freestanding mode, where main()
isn't treated specially. In Freestanding, main() doesn't get mangled as
extern "C", so whatever runtime we're using fails to find the entry point.

One way to solve this problem is to define a symbol alias from __Z4mainiPPc
to _main, however this requires all definitions of main() to have the same
mangling. Hence this commit.

3 years agoIntroduce and use a new section type for the bb_addr_map section.
Rahman Lavaee [Thu, 8 Oct 2020 18:12:40 +0000 (11:12 -0700)]
Introduce and use a new section type for the bb_addr_map section.

This patch lets the bb_addr_map (renamed to __llvm_bb_addr_map) section use a special section type (SHT_LLVM_BB_ADDR_MAP) instead of SHT_PROGBITS. This would help parsers, dumpers and other tools to use the sh_type ELF field to identify this section rather than relying on string comparison on the section name.

Reviewed By: jhenderson

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

3 years ago[Transforms] CodeExtractor::verifyAssumptionCache - don't dereference a dyn_cast...
Simon Pilgrim [Thu, 8 Oct 2020 18:03:32 +0000 (19:03 +0100)]
[Transforms] CodeExtractor::verifyAssumptionCache - don't dereference a dyn_cast<>. NFCI.

Use cast<> as we immediately dereference the pointer afterwards - cast<> will assert if we fail.

Prevents clang static analyzer warning that we could deference a null pointer.

3 years ago[Analysis] ScalarEvolution::getUMinFromMismatchedTypes - assert we've found the max...
Simon Pilgrim [Thu, 8 Oct 2020 17:41:55 +0000 (18:41 +0100)]
[Analysis] ScalarEvolution::getUMinFromMismatchedTypes - assert we've found the max type. NFCI.

Found by clang static analyzer.

3 years ago[AVR] Fix null dereference warning. NFCI.
Simon Pilgrim [Thu, 8 Oct 2020 17:05:09 +0000 (18:05 +0100)]
[AVR] Fix null dereference warning. NFCI.

We were checking if the ConstantSDNode was null but then immediately dereferencing it afterward - fold these both into a single check. Use the APInt::ult() helper as well.

Found by clang static analyzer.

3 years ago[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def
Joseph Huber [Thu, 8 Oct 2020 16:03:11 +0000 (12:03 -0400)]
[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

Summary:
Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU
for OpenMP device code generation with ones in OMPKinds.def and use
OMPIRBuilder for generating runtime calls. This allows us to
consolidate more OpenMP code generation into the OMPIRBuilder. Future
additions to the GPU runtime functions should now go in OMPKinds.def

Reviewers: jdoerfert

Subscribers: aaron.ballman cfe-commits guansong llvm-commits sstefan1 yaxunl

Tags: #OpenMP #LLVM #clang

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

3 years ago[lit] Try to remove the flakeyness of `shtest-timeout.py` and `googletest-timeout...
Dan Liew [Wed, 7 Oct 2020 23:52:19 +0000 (16:52 -0700)]
[lit] Try to remove the flakeyness of `shtest-timeout.py` and `googletest-timeout.py`.

The tests previously relied on the `short.py` and `FirstTest.subTestA`
script being executed on a machine within a short time window (1 or 2
seconds). While this "seems to work" it can fail on resource constrained
machines. We could bump the timeout a little bit (bumping it too
much would mean the test would take a long time to execute) but it wouldn't
really solve the problem of the test being prone to failures.

This patch tries to remove this flakeyness by separating testing into
two separate parts:

1. Testing if a test can hit a timeout.
2. Testing if a test can run to completion in the presence of a
timeout.

This way we can give (1.) a really short timeout (to make the test run
as fast as possible) and (2.) a really long timeout. This means for (2.)
we are no longer trying to rely on the "short" test executing within
some short time window. Instead the window is now 3600 seconds which
should be long enough even for a heavily resource constrained machine to
execute the "short" test.

Thanks to Julian Lettner for suggesting this approach. This superseeds
my original approach in https://reviews.llvm.org/D88807.

This patch also changes the command line override test to run the quick
test rather than the slow one to make the test run faster.

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

3 years ago[sanitizer] Fix Fuchsia bot failure
Teresa Johnson [Thu, 8 Oct 2020 17:43:06 +0000 (10:43 -0700)]
[sanitizer] Fix Fuchsia bot failure

Fixes bot failure from 4d5b1de40eccc7ffcfb859cef407e5f30bee77f8:
https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-linux-x64/b8867057367989385504

Updates the version of RenderFrame used by Fuchsia and adds a version of
the new RenderNeedsSymbolization.

3 years ago[AIX] Add REQUIRES for powerpc test. NFC
David Green [Thu, 8 Oct 2020 17:40:09 +0000 (18:40 +0100)]
[AIX] Add REQUIRES for powerpc test. NFC

3 years ago[GlobalISel] Add G_VECREDUCE_* opcodes for vector reductions.
Amara Emerson [Fri, 2 Oct 2020 18:56:53 +0000 (11:56 -0700)]
[GlobalISel] Add G_VECREDUCE_* opcodes for vector reductions.

These mirror the IR and SelectionDAG intrinsics & nodes.

Opcodes added:
G_VECREDUCE_SEQ_FADD
G_VECREDUCE_SEQ_FMUL
G_VECREDUCE_FADD
G_VECREDUCE_FMUL
G_VECREDUCE_FMAX
G_VECREDUCE_FMIN
G_VECREDUCE_ADD
G_VECREDUCE_MUL
G_VECREDUCE_AND
G_VECREDUCE_OR
G_VECREDUCE_XOR
G_VECREDUCE_SMAX
G_VECREDUCE_SMIN
G_VECREDUCE_UMAX
G_VECREDUCE_UMIN

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

3 years ago[clang][feature] Add cxx_abi_relative_vtable feature
Leonard Chan [Thu, 8 Oct 2020 17:27:47 +0000 (10:27 -0700)]
[clang][feature] Add cxx_abi_relative_vtable feature

This will be enabled if relative vtables is enabled.

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

3 years ago[mlir][Linalg] Add some depedence query methods to LinalgDependenceGraph.
MaheshRavishankar [Thu, 8 Oct 2020 17:01:33 +0000 (10:01 -0700)]
[mlir][Linalg] Add some depedence query methods to LinalgDependenceGraph.

The methods allow to check
- if an operation has dependencies,
- if there is a dependence from one operation to another.

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

3 years ago[flang] Allow "name: value" in compiler directives
peter klausler [Wed, 7 Oct 2020 23:07:10 +0000 (16:07 -0700)]
[flang] Allow "name: value" in compiler directives

Some legacy compiler directives use colons rather than
equals signs.

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

3 years ago[lldb] Fix "frame var" for large bitfields
Pavel Labath [Wed, 7 Oct 2020 15:57:16 +0000 (17:57 +0200)]
[lldb] Fix "frame var" for large bitfields

The problem here is in the "sliding" code in
ValueObjectChild::UpdateValue. It modifies m_bitfield_bit_offset and
m_value to ensure the bitfield value fits the window given by the
underlying type.

However, this is broken next time UpdateValue is called, because it
updates the m_value value from the parent. However, the value cannot be
slid again because the m_bitfield_bit_offset is already modified.

It seems this can happen only under specific circumstances. One way to
trigger is is to run an expression which can be interpreted (jitting it
causes a new StackFrame and ValueObject variables to be created).

I fix this bug by modifying m_byte_offset instead of m_scalar, and
ensuring the changes are folded into m_scalar regardless of how many
times UpdateValue is called.

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

3 years ago[lldb] Add a cmake warning about the python/swig incompatibility
Pavel Labath [Wed, 7 Oct 2020 14:36:32 +0000 (16:36 +0200)]
[lldb] Add a cmake warning about the python/swig incompatibility

Raise awareness of the fact that some versions of swig and python (and
build types) just don't mix.

One day this will be a reason to require swig>=4.0, but this version is
too hot off the press right now..

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

3 years ago[libcxx] Fix the thousands_sep test failure
Petr Hosek [Thu, 8 Oct 2020 16:12:57 +0000 (09:12 -0700)]
[libcxx] Fix the thousands_sep test failure

This fixes the issue introduced in 80ef4126b.

3 years ago[OpenMP] Change CMake Configuration to Build for Highest CUDA Architecture by Default
Joseph Huber [Wed, 7 Oct 2020 20:40:47 +0000 (16:40 -0400)]
[OpenMP] Change CMake Configuration to Build for Highest CUDA Architecture by Default

Summary:
This patch changes the CMake files for Clang and Libomptarget to query the
system for its supported CUDA architecture. This makes it much easier for the
user to build optimal code without needing to set the flags manually. This
relies on the now deprecated FindCUDA method in CMake, but full support for
architecture detection is only availible in CMake >3.18

Reviewers: jdoerfert ye-luo

Subscribers: cfe-commits guansong mgorny openmp-commits sstefan1 yaxunl

Tags: #clang #OpenMP

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

3 years ago[LLDB] On Windows, fix tests
Alexandre Ganea [Thu, 8 Oct 2020 15:46:04 +0000 (11:46 -0400)]
[LLDB] On Windows, fix tests

This patch fixes a few issues seen when running `ninja check-lldb` in a Release build with VS2017:

- Some binaries couldn't be found (such as lldb-vscode.exe), because .exe wasn't appended to the file name.
- Many tests used to fail since our installed locale is in French - the OS error messages are not emitted in English.
- Our codepage being Windows-1252, python failed to decode some error messages with accentuations.

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

3 years agoDeferredDiagnosticsEmitter crashes
Geoff Levner [Thu, 8 Oct 2020 14:59:30 +0000 (10:59 -0400)]
DeferredDiagnosticsEmitter crashes

Patch VisitCXXDeleteExpr() in clang::UsedDeclVisitor to avoid it crashing
when the expression's destroyed type is null. According to the comments
in CXXDeleteExpr::getDestroyedType(), this can happen when the type to
delete is a dependent type.

Patch by Geoff Levner.

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

3 years ago[ELF] Don't change binding to STB_WEAK for an undefined specified by -u
Fangrui Song [Wed, 7 Oct 2020 15:45:24 +0000 (08:45 -0700)]
[ELF] Don't change binding to STB_WEAK for an undefined specified by -u

Similar to D66992.
In GNU ld, a -u specified symbol is a STB_DEFAULT undefined.
It cannot be changed to STB_WEAK by a later STB_WEAK undefined in a regular object file.

The behavior is consistent with our model because -u means "we need to fetch a lazy definition".
It should not be altered just because there is also a STB_WEAK undefined.

Note, our -u semantics are still different from GNU ld (https://github.com/ClangBuiltLinux/linux/issues/515):
we don't force the specified symbol to appear in .symtab This is a deliberate decision.

Reviewed By: grimar

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

3 years ago[InstCombine] allow vector splats for add+xor with signmask
Sanjay Patel [Thu, 8 Oct 2020 14:45:42 +0000 (10:45 -0400)]
[InstCombine] allow vector splats for add+xor with signmask

3 years ago[InstCombine] add vector splat tests for add of signmask; NFC
Sanjay Patel [Thu, 8 Oct 2020 13:35:25 +0000 (09:35 -0400)]
[InstCombine] add vector splat tests for add of signmask; NFC

3 years ago[AMDGPU] Add patterns for mad/mac legacy f32 instructions
Jay Foad [Tue, 6 Oct 2020 08:03:53 +0000 (09:03 +0100)]
[AMDGPU] Add patterns for mad/mac legacy f32 instructions

Note that all subtargets up to GFX10.1 have v_mad_legacy_f32, but GFX8/9
lack v_mac_legacy_f32. GFX10.3 has no mad/mac f32 instructions at all.

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

3 years ago[gn build] (manually) port 9b58b0c06e6 better
Nico Weber [Thu, 8 Oct 2020 14:13:54 +0000 (10:13 -0400)]
[gn build] (manually) port 9b58b0c06e6 better

3 years ago[gn build] (manually) port 9b58b0c06e6
Nico Weber [Thu, 8 Oct 2020 14:08:38 +0000 (10:08 -0400)]
[gn build] (manually) port 9b58b0c06e6

3 years ago[lldb] Initial version of FreeBSD remote process plugin
Michał Górny [Thu, 10 Sep 2020 06:24:15 +0000 (08:24 +0200)]
[lldb] Initial version of FreeBSD remote process plugin

Add a new FreeBSD Process plugin using client/server model.  This plugin
is based on the one used by NetBSD.  It currently supports a subset
of functionality for amd64.  It is automatically used when spawning
lldb-server.  It can also be used by lldb client by setting
FREEBSD_REMOTE_PLUGIN environment variable (to any value).

The code is capable of debugging simple single-threaded programs.  It
supports general purpose, debug and FPU registers (up to XMM) of amd64,
basic signalling, software breakpoints.

Adding the support for the plugin involves removing some dead code
from FreeBSDPlatform plugin (that was not ever used because
CanDebugProcess() returned false), and replacing it with appropriate
code from NetBSD platform support.

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

3 years ago[mlir] Rank reducing subview conversion to LLVM
Jakub Lichman [Thu, 8 Oct 2020 13:28:55 +0000 (13:28 +0000)]
[mlir] Rank reducing subview conversion to LLVM

This commit adjusts SubViewOp lowering to take rank reduction into account.

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

3 years ago[AIX] add new option -mignore-xcoff-visibility
diggerlin [Thu, 8 Oct 2020 13:34:58 +0000 (09:34 -0400)]
[AIX] add new option -mignore-xcoff-visibility

SUMMARY:

In IBM compiler xlclang , there is an option -fnovisibility which suppresses visibility. For more details see: https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/compiler_ref/opt_visibility.html.

We need to add the option -mignore-xcoff-visibility for compatibility with the IBM AIX OS (as the option is enabled by default in AIX). With this option llvm does not emit any visibility attribute to ASM or XCOFF object file.

The option only work on the AIX OS, for other non-AIX OS using the option will report an unsupported options error.

In AIX OS:

1.1  the option -mignore-xcoff-visibility is enabled by default , if there is not -fvisibility=* and -mignore-xcoff-visibility explicitly in the clang command .

1.2 if there is -fvisibility=* explicitly but not -mignore-xcoff-visibility  explicitly in the clang command.  it will generate visibility attributes.

1.3 if there are  both  -fvisibility=* and  -mignore-xcoff-visibility  explicitly in the clang command. The option  "-mignore-xcoff-visibility" wins , it do not emit the visibility attribute.

The option -mignore-xcoff-visibility has no effect on visibility attribute when compile with -emit-llvm option to generated LLVM IR.

Reviewer: daltenty,Jason Liu

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

3 years ago[clangd] New CC Ranking Model to fix bad inference due to overflow.
Utkarsh Saxena [Thu, 8 Oct 2020 11:13:40 +0000 (13:13 +0200)]
[clangd] New CC Ranking Model to fix bad inference due to overflow.

Unreachable file distances are represented as
`std::numeric_limits<unsigned>::max()`.
The previous dataset recorded the signals as `signed int` capturing this default
value as `-1`.

A new dataset was regenerated and a new model is trained that
interprets this unreachable as the intended value.

Distribution of `SymbolScopeDistance`:
Value         Normalised Frequency
0             46.6184
4294967295    29.5342
6             14.5666
4              6.4433
2              1.4534
8              0.5760
10             0.3581
....

Distribution of `FileProximityDistance`:
Value         Normalised Frequency
4294967295    39.9378
12             5.1997
14             4.9828
15             4.4221
16             4.3820
13             4.2765
17             3.8957
11             3.6387
19             3.4799
18             3.4076
....

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

3 years ago[llvm-readobj] - Fix possible crashes related to dumping gnu hash symbols.
Georgii Rymar [Wed, 30 Sep 2020 12:12:41 +0000 (15:12 +0300)]
[llvm-readobj] - Fix possible crashes related to dumping gnu hash symbols.

It fixes possible scenarios when we crash/assert with `--hash-symbols` when
dumping an invalid GNU hash table which has a broken value in the buckets array.

This fixes a crash reported in comments for
https://bugs.llvm.org/show_bug.cgi?id=47681

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

3 years ago[mlir][Linalg] Add TensorsToBuffers support for Constant ops.
Nicolas Vasilache [Thu, 8 Oct 2020 12:47:41 +0000 (12:47 +0000)]
[mlir][Linalg] Add TensorsToBuffers support for Constant ops.

This revision also inserts an end-to-end test that lowers tensors to buffers all the way to executable code on CPU.

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

3 years ago[mlir][spirv] Add OpenCL extended ops: exp, fabs, s_abs
Konrad Dobros [Thu, 1 Oct 2020 00:28:13 +0000 (02:28 +0200)]
[mlir][spirv] Add OpenCL extended ops: exp, fabs, s_abs

Reviewed By: mravishankar

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

3 years ago[AMDGPU] Use isLegalMUBUFImmOffset more
Sebastian Neubauer [Wed, 7 Oct 2020 12:47:36 +0000 (14:47 +0200)]
[AMDGPU] Use isLegalMUBUFImmOffset more

Instead of hardcoding isUInt<12>.

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

3 years ago[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload
Joseph Huber [Wed, 7 Oct 2020 18:13:14 +0000 (14:13 -0400)]
[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

Summary:
This patch adds an error to Clang that detects if OpenMP offloading is used
between two architectures with incompatible pointer sizes. This ensures that
the data mapping can be done correctly and solves an issue in code generation
generating the wrong size pointer.

Reviewer: jdoerfert

Subscribers: cfe-commits delcypher guansong llvm-commits sstefan1 yaxunl

Tags: #OpenMP #Clang

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

3 years ago[InstCombine] matchFunnelShift - support non-uniform constant vector shift amounts...
Simon Pilgrim [Thu, 8 Oct 2020 11:56:27 +0000 (12:56 +0100)]
[InstCombine] matchFunnelShift - support non-uniform constant vector shift amounts (PR46895)

Complete basic PR46895 fixes by refactoring D87452/D88402 to allow us to match non-uniform constant values.

We still don't handle non-uniform vectors that contain undef elements, but that can wait until we have a decent generic mechanism for this.

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

3 years ago[clangd] Add a missing include-fixer test for incomplete_type, NFC.
Haojian Wu [Thu, 8 Oct 2020 11:33:07 +0000 (13:33 +0200)]
[clangd] Add a missing include-fixer test for incomplete_type, NFC.

Also sort the list to make it easier to verify with the implementation
code.

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

3 years ago[Driver] Add output file to properties of Command
Serge Pavlov [Thu, 23 Apr 2020 17:27:14 +0000 (00:27 +0700)]
[Driver] Add output file to properties of Command

Object of class `Command` contains various properties of a command to
execute, but output file was missed from them. This change adds this
property. It is required for reporting consumed time and memory implemented
in D78903 and may be used in other cases too.

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

3 years ago[DebugInfo] Improve dbg preservation in LSR.
Markus Lavin [Thu, 8 Oct 2020 10:49:51 +0000 (12:49 +0200)]
[DebugInfo] Improve dbg preservation in LSR.

Use SCEV to salvage additional @llvm.dbg.value that have turned into
referencing undef after transformation (and traditional
salvageDebugInfo). Before transformation compute SCEV for each
@llvm.dbg.value in the loop body and store it (along side its current
DIExpression). After transformation update those @llvm.dbg.value now
referencing undef by comparing its stored SCEV to the SCEV of the
current loop-header PHI-nodes. Allow match with offset by inserting
compensation code in the DIExpression.

Includes fix for the nullptr deref that caused the original commit
to be reverted in 9d63029770.

Fixes : PR38815

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

3 years ago[AMDGPU][MC][GFX1030] Disabled v_mac_f32
Dmitry Preobrazhensky [Thu, 8 Oct 2020 10:34:52 +0000 (13:34 +0300)]
[AMDGPU][MC][GFX1030] Disabled v_mac_f32

See bug 47741 <https://bugs.llvm.org/show_bug.cgi?id=47741>

Reviewers: nhaehnle, rampitec

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

3 years agoAArch64: treat MC expressions as 2s complement arithmetic.
Tim Northover [Tue, 22 Sep 2020 10:42:37 +0000 (11:42 +0100)]
AArch64: treat MC expressions as 2s complement arithmetic.

We had a couple of over-zealous diagnostics that meant IR with a reasonable and
valid interpretation was rejected.

3 years ago[llvm-objdump] Ensure we consistently use the llvm::stable_sort wrappers.
Simon Pilgrim [Thu, 8 Oct 2020 10:43:34 +0000 (11:43 +0100)]
[llvm-objdump] Ensure we consistently use the llvm::stable_sort wrappers.

We use this everywhere else in this file, these were just missed.

3 years ago[InstCombine] matchRotate - add support for matching general funnel shifts with const...
Simon Pilgrim [Thu, 8 Oct 2020 10:04:54 +0000 (11:04 +0100)]
[InstCombine] matchRotate - add support for matching general funnel shifts with constant shift amounts (PR46896)

First step towards extending the existing rotation support to full funnel shift handling now that the backend legalization support has improved.

This enables us to match the shift by constant cases, which are pretty trivial to expand again if necessary.

D88420 will add non-uniform support for funnel shifts as well once its been finalized.

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

3 years ago[mlir] Add basic support for dynamic tensor results in TensorToBuffers.cpp.
Alexander Belyaev [Thu, 8 Oct 2020 09:07:36 +0000 (11:07 +0200)]
[mlir] Add basic support for dynamic tensor results in TensorToBuffers.cpp.

The simplest case is when the indexing maps are DimIds in every component. This covers cwise ops.

Also:
* Expose populateConvertLinalgOnTensorsToBuffersPatterns in Transforms.h
* Expose emitLoopRanges in Transforms.h

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