[llvm-branch-commits] [llvm] 8fbc143 - [AArch64] Merge [US]MULL with half adds and subs into [US]ML[AS]L

2021-01-25 Thread Andre Vieira via llvm-branch-commits

Author: Andre Vieira
Date: 2021-01-25T07:58:12Z
New Revision: 8fbc1437c605fe92c0fa286757e3b287d6b02f05

URL: 
https://github.com/llvm/llvm-project/commit/8fbc1437c605fe92c0fa286757e3b287d6b02f05
DIFF: 
https://github.com/llvm/llvm-project/commit/8fbc1437c605fe92c0fa286757e3b287d6b02f05.diff

LOG: [AArch64] Merge [US]MULL with half adds and subs into [US]ML[AS]L

This patch adds patterns to teach the AArch64 backend to merge [US]MULL
instructions and adds/subs of half the size into [US]ML[AS]L where we don't use
the top half of the result.

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

Added: 
llvm/test/CodeGen/AArch64/mla_mls_merge.ll

Modified: 
llvm/lib/Target/AArch64/AArch64InstrInfo.td

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td 
b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 00665bfe7c90..171d3dbaa814 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -4792,6 +4792,44 @@ defm USUBL   : SIMDLongThreeVectorBHS<1, 0b0010, "usubl",
 defm USUBW   : SIMDWideThreeVectorBHS<   1, 0b0011, "usubw",
  BinOpFrag<(sub node:$LHS, (zanyext node:$RHS))>>;
 
+// Additional patterns for [SU]ML[AS]L
+multiclass Neon_mul_acc_widen_patterns {
+  def : Pat<(v4i16 (opnode
+V64:$Ra,
+(v4i16 (extract_subvector
+(vecopnode (v8i8 V64:$Rn),(v8i8 V64:$Rm)),
+(i64 0),
+ (EXTRACT_SUBREG (v8i16 (INST8B
+ (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), 
V64:$Ra, dsub),
+ V64:$Rn, V64:$Rm)), dsub)>;
+  def : Pat<(v2i32 (opnode
+V64:$Ra,
+(v2i32 (extract_subvector
+(vecopnode (v4i16 V64:$Rn),(v4i16 V64:$Rm)),
+(i64 0),
+ (EXTRACT_SUBREG (v4i32 (INST4H
+ (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)), 
V64:$Ra, dsub),
+ V64:$Rn, V64:$Rm)), dsub)>;
+  def : Pat<(v1i64 (opnode
+V64:$Ra,
+(v1i64 (extract_subvector
+(vecopnode (v2i32 V64:$Rn),(v2i32 V64:$Rm)),
+(i64 0),
+ (EXTRACT_SUBREG (v2i64 (INST2S
+ (INSERT_SUBREG (v2i64 (IMPLICIT_DEF)), 
V64:$Ra, dsub),
+ V64:$Rn, V64:$Rm)), dsub)>;
+}
+
+defm : Neon_mul_acc_widen_patterns;
+defm : Neon_mul_acc_widen_patterns;
+defm : Neon_mul_acc_widen_patterns;
+defm : Neon_mul_acc_widen_patterns;
+
 // Additional patterns for SMULL and UMULL
 multiclass Neon_mul_widen_patterns {

diff  --git a/llvm/test/CodeGen/AArch64/mla_mls_merge.ll 
b/llvm/test/CodeGen/AArch64/mla_mls_merge.ll
new file mode 100644
index ..d3aa9673d8b3
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/mla_mls_merge.ll
@@ -0,0 +1,205 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-unknown-linux-gnu | 
FileCheck %s
+
+define <4 x i16> @test_mla0(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> 
%d) {
+; CHECK-LABEL: test_mla0:
+; CHECK:   // %bb.0: // %entry
+; CHECK-NEXT:umull v2.8h, v2.8b, v3.8b
+; CHECK-NEXT:umlal v2.8h, v0.8b, v1.8b
+; CHECK-NEXT:mov v0.16b, v2.16b
+; CHECK-NEXT:ret
+entry:
+  %vmull.i = tail call <8 x i16> @llvm.aarch64.neon.umull.v8i16(<8 x i8> %a, 
<8 x i8> %b)
+  %vmull.i.i = tail call <8 x i16> @llvm.aarch64.neon.umull.v8i16(<8 x i8> %c, 
<8 x i8> %d)
+  %add.i = add <8 x i16> %vmull.i.i, %vmull.i
+  %shuffle.i = shufflevector <8 x i16> %add.i, <8 x i16> undef, <4 x i32> 
+  ret <4 x i16> %shuffle.i
+}
+
+
+define <4 x i16> @test_mla1(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> 
%d) {
+; CHECK-LABEL: test_mla1:
+; CHECK:   // %bb.0: // %entry
+; CHECK-NEXT:smull v2.8h, v2.8b, v3.8b
+; CHECK-NEXT:smlal v2.8h, v0.8b, v1.8b
+; CHECK-NEXT:mov v0.16b, v2.16b
+; CHECK-NEXT:ret
+entry:
+  %vmull.i = tail call <8 x i16> @llvm.aarch64.neon.smull.v8i16(<8 x i8> %a, 
<8 x i8> %b)
+  %vmull.i.i = tail call <8 x i16> @llvm.aarch64.neon.smull.v8i16(<8 x i8> %c, 
<8 x i8> %d)
+  %add.i = add <8 x i16> %vmull.i.i, %vmull.i
+  %shuffle.i = shufflevector <8 x i16> %add.i, <8 x i16> undef, <4 x i32> 
+  ret <4 x i16> %shuffle.i
+}
+
+
+define <2 x i32> @test_mla2(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c, <4 x 
i16> %d) {
+; CHECK-LABEL: test_mla2:
+; CHECK:   // %bb.0: // %entry
+; CHECK-NEXT:umull v2.4s, v2.4h, v3.4h
+; CHECK-NEXT:umlal v2.4s, v0.4h, v1.4h
+; CHECK-NEXT:mov v0.16b, v2.16b
+; CHECK-NEXT:ret
+entry:
+  %vmull2.i = tail call <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16> %a, 
<4 x i16> %b)
+  %vmull2.i.i = tail call

[llvm-branch-commits] [clang] 46ec025 - [clang][cli] NFC: Move prefix to the front of BoolOption

2021-01-25 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2021-01-25T09:15:33+01:00
New Revision: 46ec0254a97dcf35a0f9f023ea7632e7ee72a1ee

URL: 
https://github.com/llvm/llvm-project/commit/46ec0254a97dcf35a0f9f023ea7632e7ee72a1ee
DIFF: 
https://github.com/llvm/llvm-project/commit/46ec0254a97dcf35a0f9f023ea7632e7ee72a1ee.diff

LOG: [clang][cli] NFC: Move prefix to the front of BoolOption

The prefix used to be the last (optional) argument to BoolOption. This decision 
was made with the expectation that only few command line options would need to 
pass it explicitly instead of using Bool{F,G}Option. It turns out that a 
considerable number of options don't conform to Bool{F,G}Option and need to 
provide the prefix anyways. This sometimes requires to explicitly pass 
`BothFlags<[]>`.

This patch makes prefix the first parameter, so it now directly precedes the 
spelling base string. Now 8 options dropped `BothFlags<[]>` and only two 
options (`pthread` and `emit_llvm_uselists`) need to pass an empty prefix.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7685d343ab96..2747ee27cb8d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -375,10 +375,10 @@ class BoolOptionFlag,
-  string prefix = ""> {
+  FlagDefSuffix flags_suffix = FlagDefSuffix<[], "">> {
   defvar flag1 = FlagDefExpanded.Result,
  prefix, NAME, spelling_base>;
 
@@ -436,29 +436,28 @@ class BothFlags option_flags = [], 
string help = ""> {
 /// Creates two command line flags that control the same boolean keypath.
 ///
 /// Example:
-///   defm my_boolean_option : BoolOption<"my-boolean-option",
+///   defm my_boolean_option : BoolOption<"f", "my-boolean-option",
 /// CodeGenOpts<"MyBooleanOption">, DefaultsToFalse,
 /// ChangedBy,
 /// ResetBy,
 /// BothFlags<[CoreOption], " my boolean option.">;
 ///
 ///   The Clang driver now knows two new command line flags: the "positive"
-///   -my-boolean-option and the "negative" -no-my-boolean-option. The positive
-///   flag is also available on the CC1 command line.
+///   -fmy-boolean-option and the "negative" -fno-my-boolean-option. The
+///   positive flag is also available on the CC1 command line.
 ///
 ///   * When the command line contains neither of the flags, the keypath value
 /// defaults to false.
 ///   * When the command line contains the positive -my-boolean-option, the
 /// keypath value changes to true.
-///   * When the command line contains the negative -no-my-bool-option, the
+///   * When the command line contains the negative -fno-my-bool-option, the
 /// keypath value resets to false.
 ///
 ///   The help text for -my-boolean-option is "Enable my boolean option." and
-///   "Disable my boolean option." for -no-my-boolean-option.
-multiclass BoolOption,
-  string name_prefix = ""> {
+  ResetBy reset_by, BothFlags both = BothFlags<[], "">> {
   defvar default = Default;
 
   defvar changed_by_flag = FlagDef;
 
-  defm NAME : BoolOptionBase;
+  defm NAME : BoolOptionBase;
 }
 
 /// Creates a BoolOption with the changing available on the CC1 command line.
-multiclass BoolCC1Option,
- string name_prefix = ""> {
+ ResetBy reset_by, BothFlags both = BothFlags<[], "">> 
{
   defvar changed_by_cc1
 = ChangedBy;
 
-  defm NAME : BoolOption;
+  defm NAME : BoolOption;
 }
 
 /// Creates a BoolOption where both of the flags are prefixed with "f", are in
@@ -494,8 +492,8 @@ multiclass BoolCC1Option> {
-  defm NAME : BoolCC1Option,
+  defm NAME : BoolCC1Option<"f", flag_base, kpm, defaults_to, changed_by,
+reset_by, both>,
   Group;
 }
 
@@ -505,8 +503,8 @@ multiclass BoolFOption> {
-  defm NAME : BoolCC1Option,
+  defm NAME : BoolCC1Option<"g", flag_base, kpm, defaults_to, changed_by,
+reset_by, both>,
   Group;
 }
 
@@ -1269,11 +1267,11 @@ def fcommon : Flag<["-"], "fcommon">, Group,
   Flags<[CoreOption, CC1Option]>, HelpText<"Place uninitialized global 
variables in a common block">,
   MarshallingInfoNegativeFlag>;
 def fcompile_resource_EQ : Joined<["-"], "fcompile-resource=">, Group;
-defm complete_member_pointers : BoolOption<"complete-member-pointers",
+defm complete_member_pointers : BoolOption<"f", "complete-member-pointers",
   LangOpts<"CompleteMemberPointers">, DefaultsToFalse,
   ChangedBy, ResetBy,
   BothFlags<[CoreOption], " member pointer base types to be complete if they"
-" would be significant under the Microsoft ABI">, "f">,
+" would be significant under the Micros

[llvm-branch-commits] [clang] 209f461 - [clang][cli] NFC: Pass CC1Option explicitly to BoolOption

2021-01-25 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2021-01-25T09:15:33+01:00
New Revision: 209f4618891365f5f655214581ab4edd27cacde4

URL: 
https://github.com/llvm/llvm-project/commit/209f4618891365f5f655214581ab4edd27cacde4
DIFF: 
https://github.com/llvm/llvm-project/commit/209f4618891365f5f655214581ab4edd27cacde4.diff

LOG: [clang][cli] NFC: Pass CC1Option explicitly to BoolOption

When `Bool{F,G}Option` were introduced, they were designed after the existing 
`Opt{In,Out}FFlag` in that they implied `CC1Option` for the `ChangedBy` flag.

This means less typing, but can be misleading in situations when the `ResetBy` 
has explicit `CC1Option` and `ChangedBy` doesn't.

This patch stops implicitly putting `CC1Option` to `ChangedBy` flag.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 2747ee27cb8d..dd7978435ff1 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -473,38 +473,23 @@ multiclass BoolOption;
 }
 
-/// Creates a BoolOption with the changing available on the CC1 command line.
-multiclass BoolCC1Option> 
{
-  defvar changed_by_cc1
-= ChangedBy;
-
-  defm NAME : BoolOption;
-}
-
-/// Creates a BoolOption where both of the flags are prefixed with "f", are in
-/// the Group, and the changing flag is also available on the CC1
-/// command line.
+/// Creates a BoolOption where both of the flags are prefixed with "f" and have
+/// the Group.
 multiclass BoolFOption> {
-  defm NAME : BoolCC1Option<"f", flag_base, kpm, defaults_to, changed_by,
-reset_by, both>,
+  defm NAME : BoolOption<"f", flag_base, kpm, defaults_to, changed_by, 
reset_by,
+ both>,
   Group;
 }
 
-// Creates a BoolOption where both of the flags are prefixed with "g", are in
-// the Group, and the changing flag is also available on the CC1
-// command line.
+// Creates a BoolOption where both of the flags are prefixed with "g" and have
+// the Group.
 multiclass BoolGOption> {
-  defm NAME : BoolCC1Option<"g", flag_base, kpm, defaults_to, changed_by,
-reset_by, both>,
+  defm NAME : BoolOption<"g", flag_base, kpm, defaults_to, changed_by, 
reset_by,
+ both>,
   Group;
 }
 
@@ -951,7 +936,7 @@ defm cuda_approx_transcendentals : 
OptInFFlag<"cuda-approx-transcendentals", "Us
   " approximate transcendental functions">;
 defm gpu_rdc : BoolFOption<"gpu-rdc",
   LangOpts<"GPURelocatableDeviceCode">, DefaultsToFalse,
-  ChangedBy,
+  ChangedBy,
   ResetBy>;
 def : Flag<["-"], "fcuda-rdc">, Alias;
 def : Flag<["-"], "fno-cuda-rdc">, Alias;
@@ -971,17 +956,17 @@ def fhip_dump_offload_linker_script : Flag<["-"], 
"fhip-dump-offload-linker-scri
   Group, Flags<[NoArgumentUnused, HelpHidden]>;
 defm hip_new_launch_api : BoolFOption<"hip-new-launch-api",
   LangOpts<"HIPUseNewLaunchAPI">, DefaultsToFalse,
-  ChangedBy, ResetBy,
+  ChangedBy, ResetBy,
   BothFlags<[], " new kernel launching API for HIP">>;
 defm gpu_allow_device_init : OptInFFlag<"gpu-allow-device-init",
   "Allow", "Don't allow", " device side init function in HIP">;
 defm gpu_defer_diag : BoolFOption<"gpu-defer-diag",
   LangOpts<"GPUDeferDiag">, DefaultsToFalse,
-  ChangedBy, ResetBy,
+  ChangedBy, ResetBy,
   BothFlags<[], " host/device related diagnostic messages for CUDA/HIP">>;
 defm gpu_exclude_wrong_side_overloads : 
BoolFOption<"gpu-exclude-wrong-side-overloads",
   LangOpts<"GPUExcludeWrongSideOverloads">, DefaultsToFalse,
-  ChangedBy,
+  ChangedBy,
   ResetBy,
   BothFlags<[HelpHidden], " in overloading resolution for CUDA/HIP">>;
 def gpu_max_threads_per_block_EQ : Joined<["--"], 
"gpu-max-threads-per-block=">,
@@ -1043,14 +1028,14 @@ def fPIE : Flag<["-"], "fPIE">, Group;
 def fno_PIE : Flag<["-"], "fno-PIE">, Group;
 defm access_control : BoolFOption<"access-control",
   LangOpts<"AccessControl">, DefaultsToTrue,
-  ChangedBy,
+  ChangedBy,
   ResetBy>;
 def falign_functions : Flag<["-"], "falign-functions">, Group;
 def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group;
 def fno_align_functions: Flag<["-"], "fno-align-functions">, Group;
 defm allow_editor_placeholders : BoolFOption<"allow-editor-placeholders",
   LangOpts<"AllowEditorPlaceholders">, DefaultsToFalse,
-  ChangedBy,
+  ChangedBy,
   ResetBy>;
 def fallow_unsupported : Flag<["-"], "fallow-unsupported">, Group;
 def fapple_kext : Flag<["-"], "fapple-kext">, Group, 
Flags<[CC1Option]>,
@@ -1058,7 +1043,7 @@ def fapple_kext : Flag<["-"], "fapple-kext">, 
Group, Flags<[CC1Option]>
   MarshallingInfoFlag>;
 defm apple_pragma_pack : BoolFOption<"apple-pragma-pack",
   LangOpts<"ApplePragmaPack">, DefaultsToFalse,
-  ChangedBy,
+  ChangedBy,
   ResetBy>;

[llvm-branch-commits] [clang] 01d9f13 - Revert "[clang][AVR] Improve avr-ld command line options"

2021-01-25 Thread Ben Shi via llvm-branch-commits

Author: Ben Shi
Date: 2021-01-25T16:33:58+08:00
New Revision: 01d9f13c3a5914baf9739348ef666e348a7b2a2f

URL: 
https://github.com/llvm/llvm-project/commit/01d9f13c3a5914baf9739348ef666e348a7b2a2f
DIFF: 
https://github.com/llvm/llvm-project/commit/01d9f13c3a5914baf9739348ef666e348a7b2a2f.diff

LOG: Revert "[clang][AVR] Improve avr-ld command line options"

This reverts commit 89a5147e5a0c2e886cdf7ffa34799c069d825940.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AVR.cpp

Removed: 
clang/test/Driver/Inputs/basic_avr_tree/bin/avr-ld
clang/test/Driver/Inputs/basic_avr_tree/lib/avr/lib/libavr.a
clang/test/Driver/Inputs/basic_avr_tree/lib/gcc/avr/5.4.0/libgcc.a
clang/test/Driver/avr-ld.c



diff  --git a/clang/lib/Driver/ToolChains/AVR.cpp 
b/clang/lib/Driver/ToolChains/AVR.cpp
index c999c3b87f84..ae56b7b5249e 100644
--- a/clang/lib/Driver/ToolChains/AVR.cpp
+++ b/clang/lib/Driver/ToolChains/AVR.cpp
@@ -32,248 +32,247 @@ const struct {
   StringRef Name;
   std::string SubPath;
   StringRef Family;
-  unsigned DataAddr;
 } MCUInfo[] = {
-{"at90s1200", "", "avr1", 0},
-{"attiny11", "", "avr1", 0},
-{"attiny12", "", "avr1", 0},
-{"attiny15", "", "avr1", 0},
-{"attiny28", "", "avr1", 0},
-{"at90s2313", "tiny-stack", "avr2", 0x800060},
-{"at90s2323", "tiny-stack", "avr2", 0x800060},
-{"at90s2333", "tiny-stack", "avr2", 0x800060},
-{"at90s2343", "tiny-stack", "avr2", 0x800060},
-{"at90s4433", "tiny-stack", "avr2, 0x800060"},
-{"attiny22", "tiny-stack", "avr2", 0x800060},
-{"attiny26", "tiny-stack", "avr2", 0x800060},
-{"at90s4414", "", "avr2", 0x800060},
-{"at90s4434", "", "avr2", 0x800060},
-{"at90s8515", "", "avr2", 0x800060},
-{"at90c8534", "", "avr2", 0x800060},
-{"at90s8535", "", "avr2", 0x800060},
-{"attiny13", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny13a", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny2313", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny2313a", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny24", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny24a", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny25", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny261", "avr25/tiny-stack", "avr25", 0x800060},
-{"attiny261a", "avr25/tiny-stack", "avr25", 0x800060},
-{"at86rf401", "avr25", "avr25", 0x800060},
-{"ata5272", "avr25", "avr25", 0x800100},
-{"attiny4313", "avr25", "avr25", 0x800060},
-{"attiny44", "avr25", "avr25", 0x800060},
-{"attiny44a", "avr25", "avr25", 0x800060},
-{"attiny84", "avr25", "avr25", 0x800060},
-{"attiny84a", "avr25", "avr25", 0x800060},
-{"attiny45", "avr25", "avr25", 0x800060},
-{"attiny85", "avr25", "avr25", 0x800060},
-{"attiny441", "avr25", "avr25", 0x800100},
-{"attiny461", "avr25", "avr25", 0x800060},
-{"attiny461a", "avr25", "avr25", 0x800060},
-{"attiny841", "avr25", "avr25", 0x800100},
-{"attiny861", "avr25", "avr25", 0x800060},
-{"attiny861a", "avr25", "avr25", 0x800060},
-{"attiny87", "avr25", "avr25", 0x800100},
-{"attiny43u", "avr25", "avr25", 0x800060},
-{"attiny48", "avr25", "avr25", 0x800100},
-{"attiny88", "avr25", "avr25", 0x800100},
-{"attiny828", "avr25", "avr25", 0x800100},
-{"at43usb355", "avr3", "avr3", 0x800100},
-{"at76c711", "avr3", "avr3", 0x800060},
-{"atmega103", "avr31", "avr31", 0x800060},
-{"at43usb320", "avr31", "avr31", 0x800060},
-{"attiny167", "avr35", "avr35", 0x800100},
-{"at90usb82", "avr35", "avr35", 0x800100},
-{"at90usb162", "avr35", "avr35", 0x800100},
-{"ata5505", "avr35", "avr35", 0x800100},
-{"atmega8u2", "avr35", "avr35", 0x800100},
-{"atmega16u2", "avr35", "avr35", 0x800100},
-{"atmega32u2", "avr35", "avr35", 0x800100},
-{"attiny1634", "avr35", "avr35", 0x800100},
-{"atmega8", "avr4", "avr4", 0x800060},
-{"ata6289", "avr4", "avr4", 0x800100},
-{"atmega8a", "avr4", "avr4", 0x800060},
-{"ata6285", "avr4", "avr4", 0x800100},
-{"ata6286", "avr4", "avr4", 0x800100},
-{"atmega48", "avr4", "avr4", 0x800100},
-{"atmega48a", "avr4", "avr4", 0x800100},
-{"atmega48pa", "avr4", "avr4", 0x800100},
-{"atmega48pb", "avr4", "avr4", 0x800100},
-{"atmega48p", "avr4", "avr4", 0x800100},
-{"atmega88", "avr4", "avr4", 0x800100},
-{"atmega88a", "avr4", "avr4", 0x800100},
-{"atmega88p", "avr4", "avr4", 0x800100},
-{"atmega88pa", "avr4", "avr4", 0x800100},
-{"atmega88pb", "avr4", "avr4", 0x800100},
-{"atmega8515", "avr4", "avr4", 0x800060},
-{"atmega8535", "avr4", "avr4", 0x800060},
-{"atmega8hva", "avr4", "avr4", 0x800100},
-{"at90pwm1", "avr4", "avr4", 0x800100},
-{"at90pwm2", "avr4", "avr4", 0x800100},
-{"at90pwm2b", "avr4", "avr4", 0x800100},
-{"at90pwm3", "avr4", "avr4", 0x800100},
-{"at90pwm3b", "avr4", "avr4", 

[llvm-branch-commits] [clang] f00a20e - [clang-format] Add the possibility to align assignments spanning empty lines or comments

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2021-01-25T09:36:55+01:00
New Revision: f00a20e51c1d186e72844939aad10416e1cc99de

URL: 
https://github.com/llvm/llvm-project/commit/f00a20e51c1d186e72844939aad10416e1cc99de
DIFF: 
https://github.com/llvm/llvm-project/commit/f00a20e51c1d186e72844939aad10416e1cc99de.diff

LOG: [clang-format] Add the possibility to align assignments spanning empty 
lines or comments

Currently, empty lines and comments break alignment of assignments on 
consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows 
controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/docs/tools/dump_format_style.py
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 27dcee83a538..6877cac28278 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -195,23 +195,84 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**AlignConsecutiveAssignments** (``bool``)
-  If ``true``, aligns consecutive assignments.
+**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``)
+  Style of aligning consecutive assignments.
 
-  This will align the assignment operators of consecutive lines. This
-  will result in formattings like
+  ``Consecutive`` will result in formattings like:
 
   .. code-block:: c++
 
-int  = 12;
-int b= 23;
-int ccc  = 23;
+int a= 1;
+int somelongname = 2;
+double c = 3;
 
-**AlignConsecutiveBitFields** (``bool``)
-  If ``true``, aligns consecutive bitfield members.
+  Possible values:
+
+  * ``ACS_None`` (in configuration: ``None``)
+ Do not align assignments on consecutive lines.
+
+  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
+ Align assignments on consecutive lines. This will result in
+ formattings like:
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d = 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
+ Same as ACS_Consecutive, but also spans over empty lines, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
+ Same as ACS_Consecutive, but also spans over lines only containing
+ comments, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossEmptyLinesAndComments``
+(in configuration: ``AcrossEmptyLinesAndComments``)
+
+ Same as ACS_Consecutive, but also spans over lines only containing
+ comments and empty lines, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``)
+  Style of aligning consecutive bit field.
 
-  This will align the bitfield separators of consecutive lines. This
-  will result in formattings like
+  ``Consecutive`` will align the bitfield separators of consecutive lines.
+  This will result in formattings like:
 
   .. code-block:: c++
 
@@ -219,23 +280,146 @@ the configuration (without a prefix: ``Auto``).
 int b: 12;
 int ccc  : 8;
 
-**AlignConsecutiveDeclarations** (``bool``)
-  If ``true``, aligns consecutive declarations.
+  Possible values:
+
+  * ``ACS_None`` (in configuration: ``None``)
+ Do not align bit fields on consecutive lines.
+
+  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
+ Align bit fields on consecutive lines. This will result in
+ formattings like:
+
+ .. code-block:: c++
+
+   int  : 1;
+   int b: 12;
+   int ccc  : 8;
+
+   int d : 2;
+   /* A comment. */
+   int ee : 3;
+
+  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
+ Same as ACS_Consecutive, but also spans over empty lines, e.g.
+
+ .. code-block:: c++
+
+   int  : 1;
+   int b: 12;
+   int ccc  : 8;
+
+   int d: 2;
+   /* A comment. */
+   int ee : 3;
+
+  * ``ACS_Acro

[llvm-branch-commits] [clang] 7b9d88a - Revert "[clang-format] Add the possibility to align assignments spanning empty lines or comments"

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2021-01-25T09:40:46+01:00
New Revision: 7b9d88ab389e19d26432b1c1a6d57f554feb9a20

URL: 
https://github.com/llvm/llvm-project/commit/7b9d88ab389e19d26432b1c1a6d57f554feb9a20
DIFF: 
https://github.com/llvm/llvm-project/commit/7b9d88ab389e19d26432b1c1a6d57f554feb9a20.diff

LOG: Revert "[clang-format] Add the possibility to align assignments spanning 
empty lines or comments"

This reverts commit f00a20e51c1d186e72844939aad10416e1cc99de.

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/docs/tools/dump_format_style.py
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 6877cac28278..27dcee83a538 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -195,84 +195,23 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``)
-  Style of aligning consecutive assignments.
+**AlignConsecutiveAssignments** (``bool``)
+  If ``true``, aligns consecutive assignments.
 
-  ``Consecutive`` will result in formattings like:
+  This will align the assignment operators of consecutive lines. This
+  will result in formattings like
 
   .. code-block:: c++
 
-int a= 1;
-int somelongname = 2;
-double c = 3;
+int  = 12;
+int b= 23;
+int ccc  = 23;
 
-  Possible values:
-
-  * ``ACS_None`` (in configuration: ``None``)
- Do not align assignments on consecutive lines.
-
-  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
- Align assignments on consecutive lines. This will result in
- formattings like:
-
- .. code-block:: c++
-
-   int a= 1;
-   int somelongname = 2;
-   double c = 3;
-
-   int d = 3;
-   /* A comment. */
-   double e = 4;
-
-  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
- Same as ACS_Consecutive, but also spans over empty lines, e.g.
-
- .. code-block:: c++
-
-   int a= 1;
-   int somelongname = 2;
-   double c = 3;
-
-   int d= 3;
-   /* A comment. */
-   double e = 4;
-
-  * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
- Same as ACS_Consecutive, but also spans over lines only containing
- comments, e.g.
-
- .. code-block:: c++
-
-   int a= 1;
-   int somelongname = 2;
-   double c = 3;
-
-   int d= 3;
-   /* A comment. */
-   double e = 4;
-
-  * ``ACS_AcrossEmptyLinesAndComments``
-(in configuration: ``AcrossEmptyLinesAndComments``)
-
- Same as ACS_Consecutive, but also spans over lines only containing
- comments and empty lines, e.g.
-
- .. code-block:: c++
-
-   int a= 1;
-   int somelongname = 2;
-   double c = 3;
-
-   int d= 3;
-   /* A comment. */
-   double e = 4;
-
-**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``)
-  Style of aligning consecutive bit field.
+**AlignConsecutiveBitFields** (``bool``)
+  If ``true``, aligns consecutive bitfield members.
 
-  ``Consecutive`` will align the bitfield separators of consecutive lines.
-  This will result in formattings like:
+  This will align the bitfield separators of consecutive lines. This
+  will result in formattings like
 
   .. code-block:: c++
 
@@ -280,146 +219,23 @@ the configuration (without a prefix: ``Auto``).
 int b: 12;
 int ccc  : 8;
 
-  Possible values:
-
-  * ``ACS_None`` (in configuration: ``None``)
- Do not align bit fields on consecutive lines.
-
-  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
- Align bit fields on consecutive lines. This will result in
- formattings like:
-
- .. code-block:: c++
-
-   int  : 1;
-   int b: 12;
-   int ccc  : 8;
-
-   int d : 2;
-   /* A comment. */
-   int ee : 3;
-
-  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
- Same as ACS_Consecutive, but also spans over empty lines, e.g.
-
- .. code-block:: c++
-
-   int  : 1;
-   int b: 12;
-   int ccc  : 8;
-
-   int d: 2;
-   /* A comment. */
-   int ee : 3;
-
-  * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
- Same as ACS_Consecutive, but also spans over lines only containing
- comments, e.g.
-
- .. code-block:: c++
-
-   int  : 1;
-   int b: 12;
-   int ccc  : 8;
-
-   int d  : 2;
-   /* A comment. */
-   int ee : 3;
-
-  * ``ACS_AcrossEmptyLinesAndComments``
-  (in configuration: ``AcrossEmptyLinesAndComment

[llvm-branch-commits] [clang] 2563147 - [clang-format] Add the possibility to align assignments spanning empty lines or comments

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Lukas Barth
Date: 2021-01-25T09:41:50+01:00
New Revision: 256314711f3fa724bff1bb2d8b93c5252265b5c7

URL: 
https://github.com/llvm/llvm-project/commit/256314711f3fa724bff1bb2d8b93c5252265b5c7
DIFF: 
https://github.com/llvm/llvm-project/commit/256314711f3fa724bff1bb2d8b93c5252265b5c7.diff

LOG: [clang-format] Add the possibility to align assignments spanning empty 
lines or comments

Currently, empty lines and comments break alignment of assignments on 
consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows 
controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/docs/tools/dump_format_style.py
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 27dcee83a538..6877cac28278 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -195,23 +195,84 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**AlignConsecutiveAssignments** (``bool``)
-  If ``true``, aligns consecutive assignments.
+**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``)
+  Style of aligning consecutive assignments.
 
-  This will align the assignment operators of consecutive lines. This
-  will result in formattings like
+  ``Consecutive`` will result in formattings like:
 
   .. code-block:: c++
 
-int  = 12;
-int b= 23;
-int ccc  = 23;
+int a= 1;
+int somelongname = 2;
+double c = 3;
 
-**AlignConsecutiveBitFields** (``bool``)
-  If ``true``, aligns consecutive bitfield members.
+  Possible values:
+
+  * ``ACS_None`` (in configuration: ``None``)
+ Do not align assignments on consecutive lines.
+
+  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
+ Align assignments on consecutive lines. This will result in
+ formattings like:
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d = 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
+ Same as ACS_Consecutive, but also spans over empty lines, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
+ Same as ACS_Consecutive, but also spans over lines only containing
+ comments, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+  * ``ACS_AcrossEmptyLinesAndComments``
+(in configuration: ``AcrossEmptyLinesAndComments``)
+
+ Same as ACS_Consecutive, but also spans over lines only containing
+ comments and empty lines, e.g.
+
+ .. code-block:: c++
+
+   int a= 1;
+   int somelongname = 2;
+   double c = 3;
+
+   int d= 3;
+   /* A comment. */
+   double e = 4;
+
+**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``)
+  Style of aligning consecutive bit field.
 
-  This will align the bitfield separators of consecutive lines. This
-  will result in formattings like
+  ``Consecutive`` will align the bitfield separators of consecutive lines.
+  This will result in formattings like:
 
   .. code-block:: c++
 
@@ -219,23 +280,146 @@ the configuration (without a prefix: ``Auto``).
 int b: 12;
 int ccc  : 8;
 
-**AlignConsecutiveDeclarations** (``bool``)
-  If ``true``, aligns consecutive declarations.
+  Possible values:
+
+  * ``ACS_None`` (in configuration: ``None``)
+ Do not align bit fields on consecutive lines.
+
+  * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
+ Align bit fields on consecutive lines. This will result in
+ formattings like:
+
+ .. code-block:: c++
+
+   int  : 1;
+   int b: 12;
+   int ccc  : 8;
+
+   int d : 2;
+   /* A comment. */
+   int ee : 3;
+
+  * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
+ Same as ACS_Consecutive, but also spans over empty lines, e.g.
+
+ .. code-block:: c++
+
+   int  : 1;
+   int b: 12;
+   int ccc  : 8;
+
+   int d: 2;
+   /* A comment. */
+   int ee : 3;
+
+  * ``ACS_Acros

[llvm-branch-commits] [clang] c6bd660 - Fix a build-bot failure.

2021-01-25 Thread Haojian Wu via llvm-branch-commits

Author: Haojian Wu
Date: 2021-01-25T09:46:29+01:00
New Revision: c6bd6607bf8abfe259fef6a41e695581a88c88f0

URL: 
https://github.com/llvm/llvm-project/commit/c6bd6607bf8abfe259fef6a41e695581a88c88f0
DIFF: 
https://github.com/llvm/llvm-project/commit/c6bd6607bf8abfe259fef6a41e695581a88c88f0.diff

LOG: Fix a build-bot failure.

The test ms-lookup-template-base-classes.cpp added in 
d972d4c749048531953a16b815e07c67e8455a3b
is failing on some builtbot that don't include x86.

This patch should fix that (following the patterns in the test directory).

Added: 


Modified: 
clang/test/CodeGenCXX/ms-lookup-template-base-classes.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/ms-lookup-template-base-classes.cpp 
b/clang/test/CodeGenCXX/ms-lookup-template-base-classes.cpp
index fbc211aca17a..41a4ee8b5bb8 100644
--- a/clang/test/CodeGenCXX/ms-lookup-template-base-classes.cpp
+++ b/clang/test/CodeGenCXX/ms-lookup-template-base-classes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-obj -fms-compatibility %s 
-o -
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -fms-compatibility 
%s -o -
 // CHECK that we don't crash.
 
 struct Base {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] d5bbaaa - [XRay] Make __xray_customevent support non-Linux

2021-01-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2021-01-25T00:48:21-08:00
New Revision: d5bbaaaf957138cb2de9c91320e589934d0ab2f0

URL: 
https://github.com/llvm/llvm-project/commit/d5bbaaaf957138cb2de9c91320e589934d0ab2f0
DIFF: 
https://github.com/llvm/llvm-project/commit/d5bbaaaf957138cb2de9c91320e589934d0ab2f0.diff

LOG: [XRay] Make __xray_customevent support non-Linux

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/xray-custom-log.ll

Removed: 
llvm/test/CodeGen/X86/xray-typed-event-log.ll



diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 
b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index b9439a48d4b2..6638ff6a6358 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6785,7 +6785,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const 
CallInst &I,
 // specific calling convention, and only for x86_64.
 // FIXME: Support other platforms later.
 const auto &Triple = DAG.getTarget().getTargetTriple();
-if (Triple.getArch() != Triple::x86_64 || !Triple.isOSLinux())
+if (Triple.getArch() != Triple::x86_64)
   return;
 
 SDLoc DL = getCurSDLoc();
@@ -6816,7 +6816,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const 
CallInst &I,
 // specific calling convention, and only for x86_64.
 // FIXME: Support other platforms later.
 const auto &Triple = DAG.getTarget().getTargetTriple();
-if (Triple.getArch() != Triple::x86_64 || !Triple.isOSLinux())
+if (Triple.getArch() != Triple::x86_64)
   return;
 
 SDLoc DL = getCurSDLoc();

diff  --git a/llvm/test/CodeGen/X86/xray-custom-log.ll 
b/llvm/test/CodeGen/X86/xray-custom-log.ll
index f53e6c676c3b..ee293112249b 100644
--- a/llvm/test/CodeGen/X86/xray-custom-log.ll
+++ b/llvm/test/CodeGen/X86/xray-custom-log.ll
@@ -1,8 +1,7 @@
-; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - 
-mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - \
-; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | 
FileCheck %s -check-prefix=PIC
+; RUN: llc -verify-machineinstrs -mtriple=x86_64 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=x86_64 -relocation-model=pic < %s | 
FileCheck %s --check-prefix=PIC
 
-define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" 
{
+define i32 @customevent() nounwind "function-instrument"="xray-always" {
 %eventptr = alloca i8
 %eventsize = alloca i32
 store i32 3, i32* %eventsize
@@ -33,4 +32,45 @@ define i32 @fn() nounwind noinline uwtable 
"function-instrument"="xray-always" {
 ; CHECK-LABEL: Lxray_sleds_start0:
 ; CHECK:   .quad {{.*}}xray_event_sled_0
 
+define i32 @typedevent() nounwind "function-instrument"="xray-always" {
+%eventptr = alloca i8
+%eventsize = alloca i32
+%eventtype = alloca i16
+store i16 6, i16* %eventtype
+%type = load i16, i16* %eventtype
+store i32 3, i32* %eventsize
+%val = load i32, i32* %eventsize
+call void @llvm.xray.typedevent(i16 %type, i8* %eventptr, i32 %val)
+; CHECK-LABEL: Lxray_typed_event_sled_0:
+; CHECK:   .byte 0xeb, 0x14
+; CHECK-NEXT:  pushq %rdi
+; CHECK-NEXT:  pushq %rsi
+; CHECK-NEXT:  pushq %rdx
+; CHECK-NEXT:  movq %rdx, %rdi
+; CHECK-NEXT:  movq %rcx, %rsi
+; CHECK-NEXT:  movq %rax, %rdx
+; CHECK-NEXT:  callq __xray_TypedEvent
+; CHECK-NEXT:  popq %rdx
+; CHECK-NEXT:  popq %rsi
+; CHECK-NEXT:  popq %rdi
+
+; PIC-LABEL: Lxray_typed_event_sled_0:
+; PIC:   .byte 0xeb, 0x14
+; PIC-NEXT:  pushq %rdi
+; PIC-NEXT:  pushq %rsi
+; PIC-NEXT:  pushq %rdx
+; PIC-NEXT:  movq %rdx, %rdi
+; PIC-NEXT:  movq %rcx, %rsi
+; PIC-NEXT:  movq %rax, %rdx
+; PIC-NEXT:  callq __xray_TypedEvent@PLT
+; PIC-NEXT:  popq %rdx
+; PIC-NEXT:  popq %rsi
+; PIC-NEXT:  popq %rdi
+ret i32 0
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start1:
+; CHECK:   .quad {{.*}}xray_typed_event_sled_0
+
 declare void @llvm.xray.customevent(i8*, i32)
+declare void @llvm.xray.typedevent(i16, i8*, i32)

diff  --git a/llvm/test/CodeGen/X86/xray-typed-event-log.ll 
b/llvm/test/CodeGen/X86/xray-typed-event-log.ll
deleted file mode 100644
index aa7e19947f95..
--- a/llvm/test/CodeGen/X86/xray-typed-event-log.ll
+++ /dev/null
@@ -1,45 +0,0 @@
-; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - 
-mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - 
-mtriple=x86_64-unknown-linux-gnu \
-; RUN:-relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
-
-define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" 
{
-%even

[llvm-branch-commits] [llvm] d745b82 - [XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering

2021-01-25 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2021-01-25T00:49:18-08:00
New Revision: d745b82de1d2def7e68ca836f8db5bb1edbb39cb

URL: 
https://github.com/llvm/llvm-project/commit/d745b82de1d2def7e68ca836f8db5bb1edbb39cb
DIFF: 
https://github.com/llvm/llvm-project/commit/d745b82de1d2def7e68ca836f8db5bb1edbb39cb.diff

LOG: [XRay] Support DW_TAG_call_site and delete unneeded 
PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering

Added: 


Modified: 
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/xray-custom-log.ll

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/TargetLowering.h 
b/llvm/include/llvm/CodeGen/TargetLowering.h
index 1bc5377e6863..c3221aac8eea 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -3117,16 +3117,6 @@ class TargetLoweringBase {
   MachineBasicBlock *emitPatchPoint(MachineInstr &MI,
 MachineBasicBlock *MBB) const;
 
-  /// Replace/modify the XRay custom event operands with target-dependent
-  /// details.
-  MachineBasicBlock *emitXRayCustomEvent(MachineInstr &MI,
- MachineBasicBlock *MBB) const;
-
-  /// Replace/modify the XRay typed event operands with target-dependent
-  /// details.
-  MachineBasicBlock *emitXRayTypedEvent(MachineInstr &MI,
-MachineBasicBlock *MBB) const;
-
   bool IsStrictFPEnabled;
 };
 

diff  --git a/llvm/lib/CodeGen/MachineInstr.cpp 
b/llvm/lib/CodeGen/MachineInstr.cpp
index c1c7849fbe30..59d98054e3a2 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -708,8 +708,6 @@ bool MachineInstr::isCandidateForCallSiteEntry(QueryType 
Type) const {
   if (!isCall(Type))
 return false;
   switch (getOpcode()) {
-  case TargetOpcode::PATCHABLE_EVENT_CALL:
-  case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
   case TargetOpcode::PATCHPOINT:
   case TargetOpcode::STACKMAP:
   case TargetOpcode::STATEPOINT:

diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp 
b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 7aa569147da4..28c8bd0a7ded 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1227,36 +1227,6 @@ TargetLoweringBase::emitPatchPoint(MachineInstr 
&InitialMI,
   return MBB;
 }
 
-MachineBasicBlock *
-TargetLoweringBase::emitXRayCustomEvent(MachineInstr &MI,
-MachineBasicBlock *MBB) const {
-  assert(MI.getOpcode() == TargetOpcode::PATCHABLE_EVENT_CALL &&
- "Called emitXRayCustomEvent on the wrong MI!");
-  auto &MF = *MI.getMF();
-  auto MIB = BuildMI(MF, MI.getDebugLoc(), MI.getDesc());
-  for (unsigned OpIdx = 0; OpIdx != MI.getNumOperands(); ++OpIdx)
-MIB.add(MI.getOperand(OpIdx));
-
-  MBB->insert(MachineBasicBlock::iterator(MI), MIB);
-  MI.eraseFromParent();
-  return MBB;
-}
-
-MachineBasicBlock *
-TargetLoweringBase::emitXRayTypedEvent(MachineInstr &MI,
-   MachineBasicBlock *MBB) const {
-  assert(MI.getOpcode() == TargetOpcode::PATCHABLE_TYPED_EVENT_CALL &&
- "Called emitXRayTypedEvent on the wrong MI!");
-  auto &MF = *MI.getMF();
-  auto MIB = BuildMI(MF, MI.getDebugLoc(), MI.getDesc());
-  for (unsigned OpIdx = 0; OpIdx != MI.getNumOperands(); ++OpIdx)
-MIB.add(MI.getOperand(OpIdx));
-
-  MBB->insert(MachineBasicBlock::iterator(MI), MIB);
-  MI.eraseFromParent();
-  return MBB;
-}
-
 /// findRepresentativeClass - Return the largest legal super-reg register class
 /// of the register class for the specified type and its associated "cost".
 // This function is in TargetLowering because it uses RegClassForVT which would

diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 70203dacef09..0edc40683ea8 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -33981,10 +33981,8 @@ 
X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
 return emitPatchPoint(MI, BB);
 
   case TargetOpcode::PATCHABLE_EVENT_CALL:
-return emitXRayCustomEvent(MI, BB);
-
   case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
-return emitXRayTypedEvent(MI, BB);
+return BB;
 
   case X86::LCMPXCHG8B: {
 const X86RegisterInfo *TRI = Subtarget.getRegisterInfo();

diff  --git a/llvm/test/CodeGen/X86/xray-custom-log.ll 
b/llvm/test/CodeGen/X86/xray-custom-log.ll
index ee293112249b..f0d882ddbac6 100644
--- a/llvm/test/CodeGen/X86/xray-custom-log.ll
+++ b/llvm/test/CodeGen/X86/xray-custom-log.ll
@@ -1,12 +1,15 @@
 ; RUN: llc -verify-machineinstrs -mtriple=x86_64 < %s | FileCheck %s
 ; RUN: llc -verify-machineinstrs -mtriple=x86_64 -relocation-model=pic < %s | 
FileCheck %s --check-prefix=P

[llvm-branch-commits] [libcxxabi] 5e7a93a - [libc++] Set CMAKE_FOLDER. NFC.

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2021-01-25T09:51:16+01:00
New Revision: 5e7a93a954e68b002edd2cd7fb1b2a61186c7124

URL: 
https://github.com/llvm/llvm-project/commit/5e7a93a954e68b002edd2cd7fb1b2a61186c7124
DIFF: 
https://github.com/llvm/llvm-project/commit/5e7a93a954e68b002edd2cd7fb1b2a61186c7124.diff

LOG: [libc++] Set CMAKE_FOLDER. NFC.

* This variable populates the default value of FOLDER target property. It is 
used in some IDE's (e.g. MSVC) to group different targets together.

Added: 


Modified: 
libcxx/CMakeLists.txt
libcxx/benchmarks/CMakeLists.txt
libcxxabi/CMakeLists.txt

Removed: 




diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 6a55245ab87a..4e7e8f978546 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -19,6 +19,8 @@ set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   )
 
+set(CMAKE_FOLDER "libc++")
+
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")

diff  --git a/libcxx/benchmarks/CMakeLists.txt 
b/libcxx/benchmarks/CMakeLists.txt
index 42d25c20c811..0327f05ccfa6 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/benchmarks/CMakeLists.txt
@@ -5,6 +5,8 @@ include(CheckCXXCompilerFlag)
 # Build Google Benchmark for libc++
 #==
 
+set(CMAKE_FOLDER "${CMAKE_FOLDER}/Benchmarks")
+
 set(BENCHMARK_LIBCXX_COMPILE_FLAGS
 -Wno-unused-command-line-argument
 -nostdinc++

diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index ede8bd71da4c..b803347c2a8e 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   )
 
+set(CMAKE_FOLDER "libc++")
+
 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 815dd4b - [AArch64] Add Cortex CPU subtarget features for instruction fusion.

2021-01-25 Thread Sjoerd Meijer via llvm-branch-commits

Author: Sjoerd Meijer
Date: 2021-01-25T09:11:29Z
New Revision: 815dd4b2920887741f905c5922e5bbf935348cce

URL: 
https://github.com/llvm/llvm-project/commit/815dd4b2920887741f905c5922e5bbf935348cce
DIFF: 
https://github.com/llvm/llvm-project/commit/815dd4b2920887741f905c5922e5bbf935348cce.diff

LOG: [AArch64] Add Cortex CPU subtarget features for instruction fusion.

This adds subtarget features for AES, literal, and compare and branch
instruction fusion for different Cortex CPUs.

Patch by: Cassie Jones.

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

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64MacroFusion.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/test/CodeGen/AArch64/misched-fusion-addr.ll
llvm/test/CodeGen/AArch64/misched-fusion-aes.ll
llvm/test/CodeGen/AArch64/misched-fusion-lit.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index 15c7130b24f3..762855207d2b 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -218,6 +218,10 @@ def FeatureArithmeticCbzFusion : SubtargetFeature<
 "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
 "CPU fuses arithmetic + cbz/cbnz operations">;
 
+def FeatureCmpBccFusion : SubtargetFeature<
+"cmp-bcc-fusion", "HasCmpBccFusion", "true",
+"CPU fuses cmp+bcc operations">;
+
 def FeatureFuseAddress : SubtargetFeature<
 "fuse-address", "HasFuseAddress", "true",
 "CPU fuses address generation and memory operations">;
@@ -615,6 +619,9 @@ def ProcA65 : SubtargetFeature<"a65", "ARMProcFamily", 
"CortexA65",
FeatureDotProd,
FeatureFPARMv8,
FeatureFullFP16,
+   FeatureFuseAddress,
+   FeatureFuseAES,
+   FeatureFuseLiterals,
FeatureNEON,
FeatureRAS,
FeatureRCPC,
@@ -627,6 +634,7 @@ def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", 
"CortexA72",
FeatureCrypto,
FeatureFPARMv8,
FeatureFuseAES,
+   FeatureFuseLiterals,
FeatureNEON,
FeaturePerfMon
]>;
@@ -658,6 +666,7 @@ def ProcA76 : SubtargetFeature<"a76", "ARMProcFamily", 
"CortexA76",
"Cortex-A76 ARM processors", [
 HasV8_2aOps,
 FeatureFPARMv8,
+FeatureFuseAES,
 FeatureNEON,
 FeatureRCPC,
 FeatureCrypto,
@@ -669,7 +678,9 @@ def ProcA76 : SubtargetFeature<"a76", "ARMProcFamily", 
"CortexA76",
 def ProcA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
"Cortex-A77 ARM processors", [
 HasV8_2aOps,
+FeatureCmpBccFusion,
 FeatureFPARMv8,
+FeatureFuseAES,
 FeatureNEON, FeatureRCPC,
 FeatureCrypto,
 FeatureFullFP16,
@@ -680,6 +691,7 @@ def ProcA78 : SubtargetFeature<"cortex-a78", 
"ARMProcFamily",
"CortexA78",
"Cortex-A78 ARM processors", [
HasV8_2aOps,
+   FeatureCmpBccFusion,
FeatureCrypto,
FeatureFPARMv8,
FeatureFuseAES,
@@ -696,6 +708,7 @@ def ProcA78C : SubtargetFeature<"cortex-a78c", 
"ARMProcFamily",
 "CortexA78C",
 "Cortex-A78C ARM processors", [
 HasV8_2aOps,
+FeatureCmpBccFusion,
 FeatureCrypto,
 FeatureDotProd,
 FeatureFlagM,
@@ -723,6 +736,7 @@ def ProcR82 : SubtargetFeature<"cortex-r82", 
"ARMProcFamily",
 def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
   "Cortex-X1 ARM processors", [
   HasV8_2aOps,
+  FeatureCmpBccFusion,
   FeatureCryp

[llvm-branch-commits] [mlir] 3747eb9 - [mlir][Linalg] Add a padding option to Linalg tiling

2021-01-25 Thread Nicolas Vasilache via llvm-branch-commits

Author: Nicolas Vasilache
Date: 2021-01-25T09:17:30Z
New Revision: 3747eb9c85b3393aa00ad12e9e7ef31ffec8bd4c

URL: 
https://github.com/llvm/llvm-project/commit/3747eb9c85b3393aa00ad12e9e7ef31ffec8bd4c
DIFF: 
https://github.com/llvm/llvm-project/commit/3747eb9c85b3393aa00ad12e9e7ef31ffec8bd4c.diff

LOG: [mlir][Linalg] Add a padding option to Linalg tiling

This revision allows the base Linalg tiling pattern to optionally require 
padding to
a constant bounding shape.
When requested, a simple analysis is performed, similar to buffer promotion.
A temporary `linalg.simple_pad` op is added to model padding for the purpose of
connecting the dots. This will be replaced by a more fleshed out 
`linalg.pad_tensor`
op when it is available.
In the meantime, this temporary op serves the purpose of exhibiting the 
necessary
properties required from a more fleshed out pad op, to compose with 
transformations
properly.

Reviewed By: ftynse

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

Added: 
mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir

Modified: 
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/Interfaces/ViewLikeInterface.h
mlir/include/mlir/Interfaces/ViewLikeInterface.td
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Dialect/Linalg/roundtrip.mlir
mlir/test/lib/Transforms/TestLinalgTransforms.cpp

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td 
b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
index ae9f81d043f5..9ea1bc5a3587 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
@@ -475,6 +475,38 @@ def Linalg_SliceOp : Linalg_Op<"slice", [
   let hasFolder = 1;
 }
 
+def Linalg_SimplePadOp : Linalg_Op<"simple_pad", [NoSideEffect]> {
+  let summary = "TODO: replace with pad_tensors when ready.";
+
+  let description = [{
+`linalg.simple_pad` is a tmp placeholder for padding and packing on 
tensors.
+Its semantics are to pad a partially dynamic tensor to a fully static 
tensor
+where the static sizes are assumed to be greater than the dynamic sizes. 
The
+op perforrms "high" padding (i.e. it adds trailing padding values until 
the 
+desired size is met).
+  }];
+
+  let arguments = (ins AnyRankedTensor:$tensor, AnyType:$padding);
+  let results = (outs AnyRankedTensor:$result);
+
+  // TODO: verify all static result, some dynamic input, static shapes match,
+  // element types match, ranks match etc. Use pad_tensors when ready but for
+  // now just let it ne fully specified by traits.
+  let verifier = ?;
+
+  let extraClassDeclaration = [{
+RankedTensorType getSourceType() {
+  return tensor().getType().cast(); }
+RankedTensorType getResultType() {
+  return getResult().getType().cast(); }
+   }];
+
+  let assemblyFormat = [{
+$tensor `pad` $padding attr-dict `:`
+  type($tensor) `to` type($result) `pad` type($padding)
+  }];
+}
+
 def Linalg_YieldOp : Linalg_Op<"yield", [NoSideEffect, ReturnLike, 
Terminator]>,
 Arguments<(ins Variadic:$values)> {
   let summary = "Linalg yield operation";

diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h 
b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 611ab6867372..f359992e5ff1 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -345,6 +345,9 @@ enum class LinalgTilingLoopType {
 using TileSizeComputationFunction =
 std::function(OpBuilder &, Operation *)>;
 
+using PaddingValueComputationFunction =
+std::function;
+
 struct LinalgTilingOptions {
   /// Computation function that returns the tile sizes for each operation.
   /// Delayed construction of constant tile sizes should occur to interoperate
@@ -393,6 +396,18 @@ struct LinalgTilingOptions {
 distribution = std::move(distributionOptions);
 return *this;
   }
+
+  /// Computation function that returns a padding value to use when padding to
+  /// force static sizes. When `paddingValueComputationFunction` is set, 
padding
+  /// operations are introduced, that guarantee the underlying op is statically
+  /// shaped and can thus be vectorized.
+  PaddingValueComputationFunction paddingValueComputationFunction = nullptr;
+
+  LinalgTilingOptions &
+  setPaddingValueComputationFunction(PaddingValueComputationFunction fun) {
+paddingValueComputationFunction = std::move(fun);
+return *this;
+  }
 };
 
 /// Canonicalization patterns relevant to apply after tiling patterns. These 
are
@@ -403,6 +418,11 @@ getLinalgTilingCanonicalizationPatterns(MLIRContext *ctx);
 void populateLinalgTilingCanonicalizationPatterns(
 OwningRewritePatternList &patterns, MLIRContext *ctx);
 
+/// Base patt

[llvm-branch-commits] [clang] 7e5d41a - [clang] NFC: Remove else if after return

2021-01-25 Thread Kirill Bobyrev via llvm-branch-commits

Author: Kirill Bobyrev
Date: 2021-01-25T10:58:22+01:00
New Revision: 7e5d41a68255d2a890977047be339091cc113e25

URL: 
https://github.com/llvm/llvm-project/commit/7e5d41a68255d2a890977047be339091cc113e25
DIFF: 
https://github.com/llvm/llvm-project/commit/7e5d41a68255d2a890977047be339091cc113e25.diff

LOG: [clang] NFC: Remove else if after return

Update the code to be compatible with LLVM Coding Guidelines.

Reviewed By: sammccall

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

Added: 


Modified: 
clang/lib/AST/DeclBase.cpp

Removed: 




diff  --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index dc59f3dd1f15..1b59f217e3c1 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1171,10 +1171,8 @@ bool DeclContext::isDependentContext() const {
 bool DeclContext::isTransparentContext() const {
   if (getDeclKind() == Decl::Enum)
 return !cast(this)->isScoped();
-  else if (getDeclKind() == Decl::LinkageSpec || getDeclKind() == Decl::Export)
-return true;
 
-  return false;
+  return getDeclKind() == Decl::LinkageSpec || getDeclKind() == Decl::Export;
 }
 
 static bool isLinkageSpecContext(const DeclContext *DC,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] b37a349 - [lld][ELF][test] Add testing for IE/LD TLS weak undef references

2021-01-25 Thread James Henderson via llvm-branch-commits

Author: James Henderson
Date: 2021-01-25T09:58:56Z
New Revision: b37a349ff2442e73ceafeee982afb430359e08b1

URL: 
https://github.com/llvm/llvm-project/commit/b37a349ff2442e73ceafeee982afb430359e08b1
DIFF: 
https://github.com/llvm/llvm-project/commit/b37a349ff2442e73ceafeee982afb430359e08b1.diff

LOG: [lld][ELF][test] Add testing for IE/LD TLS weak undef references

Whilst migrating/retiring some downstream testing, I came across a test
for weak undef IE and LD TLS references, but was unable to find any
equivalent in LLD's upstream testing. There does seem to be some slight
subtle differences that could be worth testing compared to LE TLS
references, in particular that IE can be relaxed to LE in this case,
hence this change.

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

Reviewed by: grimar, MaskRay

Added: 
lld/test/ELF/tls-weak-undef.s

Modified: 


Removed: 
lld/test/ELF/tls-le-weak-undef.s



diff  --git a/lld/test/ELF/tls-le-weak-undef.s 
b/lld/test/ELF/tls-le-weak-undef.s
deleted file mode 100644
index fefda9da9816..
--- a/lld/test/ELF/tls-le-weak-undef.s
+++ /dev/null
@@ -1,18 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
-# RUN: echo '.tbss; .globl tls; tls:' | llvm-mc -filetype=obj -triple=x86_64 - 
-o %tdef.o
-# RUN: ld.lld %t.o -o - | llvm-objdump -d - | FileCheck %s
-
-## A weak symbol does not fetch a lazy definition.
-# RUN: ld.lld %t.o --start-lib %tdef.o --end-lib -o - | llvm-objdump -d - | 
FileCheck %s
-
-## Undefined TLS symbols arbitrarily resolve to 0.
-# CHECK:  leaq 16(%rax), %rdx
-
-# RUN: ld.lld -shared %tdef.o -o %tdef.so
-# RUN: not ld.lld %t.o %tdef.so -o /dev/null 2>&1 | FileCheck 
--check-prefix=COPYRELOC %s
-
-# COPYRELOC: symbol 'tls' has no type
-
-.weak tls
-leaq tls@tpoff+16(%rax), %rdx

diff  --git a/lld/test/ELF/tls-weak-undef.s b/lld/test/ELF/tls-weak-undef.s
new file mode 100644
index ..19d1337c9fc8
--- /dev/null
+++ b/lld/test/ELF/tls-weak-undef.s
@@ -0,0 +1,42 @@
+# REQUIRES: x86
+
+# RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/exec.s -o %texec.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/shared.s -o %tshared.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/ledef.s -o %tdef.o
+# RUN: ld.lld %texec.o -o %t.exec
+# RUN: ld.lld %tshared.o -o %t.shared --shared
+# RUN: llvm-objdump -d %t.exec | FileCheck %s --check-prefix=EXEC
+# RUN: llvm-objdump -d %t.shared | FileCheck %s --check-prefix=SHARED
+
+## An undefined weak TLS symbol does not fetch a lazy definition.
+# RUN: ld.lld %texec.o --start-lib %tdef.o --end-lib -o %tlazy
+# RUN: llvm-objdump -d %tlazy | FileCheck %s --check-prefix=EXEC
+
+## Undefined TLS symbols arbitrarily resolve to 0.
+# EXEC:   leaq 16(%rax), %rdx
+## Initial-exec references to undefined weak symbols can be relaxed to LE
+## references.
+# EXEC:   leaq 32(%rax), %rax
+# SHARED: leaq 48(%rax), %rcx
+
+# RUN: ld.lld -shared %tdef.o -o %tdef.so
+# RUN: not ld.lld %texec.o %tdef.so -o /dev/null 2>&1 | FileCheck 
--check-prefix=ERROR %s
+
+# ERROR: symbol 'le' has no type
+
+#--- ledef.s
+.tbss
+.globl le
+le:
+
+#--- exec.s
+.weak le
+leaq le@tpoff+16(%rax), %rdx
+
+.weak ie
+addq ie@gottpoff+32(%rip), %rax
+
+#--- shared.s
+.weak ld
+leaq ld@dtpoff+48(%rax), %rcx



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 33a63a3 - [clang-format] [docs] Fix RST indentation.

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2021-01-25T11:00:46+01:00
New Revision: 33a63a36d3cb0a59ef80054a02babe7a28a9842a

URL: 
https://github.com/llvm/llvm-project/commit/33a63a36d3cb0a59ef80054a02babe7a28a9842a
DIFF: 
https://github.com/llvm/llvm-project/commit/33a63a36d3cb0a59ef80054a02babe7a28a9842a.diff

LOG: [clang-format] [docs] Fix RST indentation.

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 6877cac28278..3141dd5510fc 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -327,7 +327,7 @@ the configuration (without a prefix: ``Auto``).
int ee : 3;
 
   * ``ACS_AcrossEmptyLinesAndComments``
-  (in configuration: ``AcrossEmptyLinesAndComments``)
+(in configuration: ``AcrossEmptyLinesAndComments``)
 
  Same as ACS_Consecutive, but also spans over lines only containing
  comments and empty lines, e.g.
@@ -401,7 +401,7 @@ the configuration (without a prefix: ``Auto``).
bool c = false;
 
   * ``ACS_AcrossEmptyLinesAndComments``
-  (in configuration: ``AcrossEmptyLinesAndComments``)
+(in configuration: ``AcrossEmptyLinesAndComments``)
 
  Same as ACS_Consecutive, but also spans over lines only containing
  comments and empty lines, e.g.
@@ -476,7 +476,7 @@ the configuration (without a prefix: ``Auto``).
#define bar(y, z) (y + z)
 
   * ``ACS_AcrossEmptyLinesAndComments``
-  (in configuration: ``AcrossEmptyLinesAndComments``)
+(in configuration: ``AcrossEmptyLinesAndComments``)
 
  Same as ACS_Consecutive, but also spans over lines only containing
  comments and empty lines, e.g.

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index a95689097b00..fcc38e25542f 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -153,7 +153,7 @@ struct FormatStyle {
   ///\endcode
   ///
   /// * ``ACS_AcrossEmptyLinesAndComments``
-  /// (in configuration: ``AcrossEmptyLinesAndComments``)
+  ///   (in configuration: ``AcrossEmptyLinesAndComments``)
   ///
   ///Same as ACS_Consecutive, but also spans over lines only containing
   ///comments and empty lines, e.g.
@@ -290,7 +290,7 @@ struct FormatStyle {
   ///\endcode
   ///
   /// * ``ACS_AcrossEmptyLinesAndComments``
-  /// (in configuration: ``AcrossEmptyLinesAndComments``)
+  ///   (in configuration: ``AcrossEmptyLinesAndComments``)
   ///
   ///Same as ACS_Consecutive, but also spans over lines only containing
   ///comments and empty lines, e.g.
@@ -359,7 +359,7 @@ struct FormatStyle {
   ///\endcode
   ///
   /// * ``ACS_AcrossEmptyLinesAndComments``
-  /// (in configuration: ``AcrossEmptyLinesAndComments``)
+  ///   (in configuration: ``AcrossEmptyLinesAndComments``)
   ///
   ///Same as ACS_Consecutive, but also spans over lines only containing
   ///comments and empty lines, e.g.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9c89dcf - [yaml2obj, obj2yaml] - Implement section header table as a special Chunk.

2021-01-25 Thread Georgii Rymar via llvm-branch-commits

Author: Georgii Rymar
Date: 2021-01-25T13:08:08+03:00
New Revision: 9c89dcf80736a7c0710dc4c237ec35f0687e1efd

URL: 
https://github.com/llvm/llvm-project/commit/9c89dcf80736a7c0710dc4c237ec35f0687e1efd
DIFF: 
https://github.com/llvm/llvm-project/commit/9c89dcf80736a7c0710dc4c237ec35f0687e1efd.diff

LOG: [yaml2obj, obj2yaml] - Implement section header table as a special Chunk.

This was discussed in D93678 thread.
Currently we have one special chunk - Fill.

This patch re implements the "SectionHeaderTable" key to become a special chunk 
too.
With that we are able to place the section header table at any location,
just like we place sections.

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

Added: 


Modified: 
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/Object/obj2yaml.test
llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
llvm/test/tools/llvm-readobj/ELF/dynamic-reloc-no-section-headers.test
llvm/test/tools/llvm-readobj/ELF/file-headers.test
llvm/test/tools/llvm-readobj/ELF/hash-table.test
llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test
llvm/test/tools/llvm-readobj/ELF/symtab-shndx.test
llvm/test/tools/obj2yaml/ELF/offset.yaml
llvm/test/tools/yaml2obj/ELF/section-headers-exclude.yaml
llvm/test/tools/yaml2obj/ELF/section-headers.yaml
llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
llvm/test/tools/yaml2obj/ELF/verneed-section.yaml
llvm/test/tools/yaml2obj/ELF/versym-section.yaml
llvm/tools/obj2yaml/elf2yaml.cpp

Removed: 




diff  --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h 
b/llvm/include/llvm/ObjectYAML/ELFYAML.h
index 98ba8cda372b..cae3b435f3b0 100644
--- a/llvm/include/llvm/ObjectYAML/ELFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h
@@ -128,12 +128,6 @@ struct SectionHeader {
   StringRef Name;
 };
 
-struct SectionHeaderTable {
-  Optional> Sections;
-  Optional> Excluded;
-  Optional NoHeaders;
-};
-
 struct Symbol {
   StringRef Name;
   ELF_STT Type;
@@ -196,18 +190,26 @@ struct Chunk {
 ARMIndexTable,
 MipsABIFlags,
 Addrsig,
-Fill,
 LinkerOptions,
 DependentLibraries,
 CallGraphProfile,
-BBAddrMap
+BBAddrMap,
+
+// Special chunks.
+SpecialChunksStart,
+Fill = SpecialChunksStart,
+SectionHeaderTable,
   };
 
   ChunkKind Kind;
   StringRef Name;
   Optional Offset;
 
-  Chunk(ChunkKind K) : Kind(K) {}
+  // Usually chunks are not created implicitly, but rather loaded from YAML.
+  // This flag is used to signal whether this is the case or not.
+  bool IsImplicit;
+
+  Chunk(ChunkKind K, bool Implicit) : Kind(K), IsImplicit(Implicit) {}
   virtual ~Chunk();
 };
 
@@ -222,17 +224,14 @@ struct Section : public Chunk {
   Optional Content;
   Optional Size;
 
-  // Usually sections are not created implicitly, but loaded from YAML.
-  // When they are, this flag is used to signal about that.
-  bool IsImplicit;
-
   // Holds the original section index.
   unsigned OriginalSecNdx;
 
-  Section(ChunkKind Kind, bool IsImplicit = false)
-  : Chunk(Kind), IsImplicit(IsImplicit) {}
+  Section(ChunkKind Kind, bool IsImplicit = false) : Chunk(Kind, IsImplicit) {}
 
-  static bool classof(const Chunk *S) { return S->Kind != ChunkKind::Fill; }
+  static bool classof(const Chunk *S) {
+return S->Kind < ChunkKind::SpecialChunksStart;
+  }
 
   // Some derived sections might have their own special entries. This method
   // returns a vector of  pairs. It is used for section
@@ -276,11 +275,34 @@ struct Fill : Chunk {
   Optional Pattern;
   llvm::yaml::Hex64 Size;
 
-  Fill() : Chunk(ChunkKind::Fill) {}
+  Fill() : Chunk(ChunkKind::Fill, /*Implicit=*/false) {}
 
   static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Fill; }
 };
 
+struct SectionHeaderTable : Chunk {
+  SectionHeaderTable(bool IsImplicit)
+  : Chunk(ChunkKind::SectionHeaderTable, IsImplicit) {}
+
+  static bool classof(const Chunk *S) {
+return S->Kind == ChunkKind::SectionHeaderTable;
+  }
+
+  Optional> Sections;
+  Optional> Excluded;
+  Optional NoHeaders;
+
+  size_t getNumHeaders(size_t SectionsNum) const {
+if (IsImplicit)
+  return SectionsNum;
+if (NoHeaders)
+  return (*NoHeaders) ? 0 : SectionsNum;
+return (Sections ? Sections->size() : 0) + /*Null section*/ 1;
+  }
+
+  static constexpr StringRef TypeStr = "SectionHeaderTable";
+};
+
 struct BBAddrMapSection : Section {
   Optional> Entries;
 
@@ -665,7 +687,6 @@ struct ProgramHeader {
 
 struct Object {
   FileHeader Header;
-  Optional SectionHeaders;
   std::vector ProgramHeaders;
 
   // An object might contain output section descriptions as well as
@@ -688,6 +709,13 @@ struct Object {
 return Ret;
   }
 
+  const SectionHeaderTable &getSectionHeaderTable() const {
+for (const std::unique_ptr &C : Chunks)
+  i

[llvm-branch-commits] [clang] c8d2ae5 - [clang] NFC: Remove else-after-return pattern from some files

2021-01-25 Thread Kirill Bobyrev via llvm-branch-commits

Author: Kirill Bobyrev
Date: 2021-01-25T11:14:17+01:00
New Revision: c8d2ae52c15b4c886e70587cbc3f61aaa7bd6692

URL: 
https://github.com/llvm/llvm-project/commit/c8d2ae52c15b4c886e70587cbc3f61aaa7bd6692
DIFF: 
https://github.com/llvm/llvm-project/commit/c8d2ae52c15b4c886e70587cbc3f61aaa7bd6692.diff

LOG: [clang] NFC: Remove else-after-return pattern from some files

Follow-up on D95336. A bunch of these cases were found manually, the
rest made sense to be included to eliminate llvm-else-after-return
Clang-Tidy warnings.

Added: 


Modified: 
clang/include/clang/AST/ASTContext.h
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclBase.cpp
clang/lib/AST/Expr.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 0c5d82b3e9aa..bc86022d3743 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -2401,12 +2401,10 @@ class ASTContext : public RefCountedBase {
 return (*SuperTnullability == NullabilityKind::NonNull &&
 *SubTnullability == NullabilityKind::Nullable);
   }
-  else {
-// For the return type, it's okay for the superclass method to specify
-// "nullable" and the subclass method specify "nonnull"
-return (*SuperTnullability == NullabilityKind::Nullable &&
-*SubTnullability == NullabilityKind::NonNull);
-  }
+  // For the return type, it's okay for the superclass method to specify
+  // "nullable" and the subclass method specify "nonnull"
+  return (*SuperTnullability == NullabilityKind::Nullable &&
+  *SubTnullability == NullabilityKind::NonNull);
 }
 return true;
   }

diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 3cea3c23b527..feb9b0645ebc 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1823,8 +1823,7 @@ template 
 static SourceLocation getTemplateOrInnerLocStart(const DeclT *decl) {
   if (decl->getNumTemplateParameterLists() > 0)
 return decl->getTemplateParameterList(0)->getTemplateLoc();
-  else
-return decl->getInnerLocStart();
+  return decl->getInnerLocStart();
 }
 
 SourceLocation DeclaratorDecl::getTypeSpecStartLoc() const {
@@ -2132,10 +2131,9 @@ VarDecl::isThisDeclarationADefinition(ASTContext &C) 
const {
 TSK_ExplicitSpecialization) ||
  isa(this)))
   return Definition;
-else if (!isOutOfLine() && isInline())
+if (!isOutOfLine() && isInline())
   return Definition;
-else
-  return DeclarationOnly;
+return DeclarationOnly;
   }
   // C99 6.7p5:
   //   A definition of an identifier is a declaration for that identifier that
@@ -2198,7 +2196,7 @@ VarDecl *VarDecl::getActingDefinition() {
 Kind = I->isThisDeclarationADefinition();
 if (Kind == Definition)
   return nullptr;
-else if (Kind == TentativeDefinition)
+if (Kind == TentativeDefinition)
   LastTentative = I;
   }
   return LastTentative;
@@ -2270,8 +2268,7 @@ VarDecl *VarDecl::getInitializingDeclaration() {
 if (I->isThisDeclarationADefinition()) {
   if (isStaticDataMember())
 return I;
-  else
-Def = I;
+  Def = I;
 }
   }
   return Def;
@@ -3595,8 +3592,7 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() 
const {
 OverloadedOperatorKind FunctionDecl::getOverloadedOperator() const {
   if (getDeclName().getNameKind() == DeclarationName::CXXOperatorName)
 return getDeclName().getCXXOverloadedOperator();
-  else
-return OO_None;
+  return OO_None;
 }
 
 /// getLiteralIdentifier - The literal suffix identifier this function
@@ -3604,8 +3600,7 @@ OverloadedOperatorKind 
FunctionDecl::getOverloadedOperator() const {
 const IdentifierInfo *FunctionDecl::getLiteralIdentifier() const {
   if (getDeclName().getNameKind() == DeclarationName::CXXLiteralOperatorName)
 return getDeclName().getCXXLiteralIdentifier();
-  else
-return nullptr;
+  return nullptr;
 }
 
 FunctionDecl::TemplatedKind FunctionDecl::getTemplatedKind() const {
@@ -3938,8 +3933,8 @@ SourceLocation FunctionDecl::getPointOfInstantiation() 
const {
 = TemplateOrSpecialization.dyn_cast<
 FunctionTemplateSpecializationInfo*>())
 return FTSInfo->getPointOfInstantiation();
-  else if (MemberSpecializationInfo *MSInfo
- = TemplateOrSpecialization.dyn_cast())
+  if (MemberSpecializationInfo *MSInfo =
+  TemplateOrSpecialization.dyn_cast())
 return MSInfo->getPointOfInstantiation();
 
   return SourceLocation();
@@ -4053,29 +4048,29 @@ unsigned FunctionDecl::getMemoryFunctionKind() const {
 if (isExternC()) {
   if (FnInfo->isStr("memset"))
 return Builtin::BImemset;
-  else if (FnInfo->isStr("memcpy"))
+  if (FnInfo->isStr("memcpy"))
 return Builtin::BImemcpy;
-  else if (FnInfo->isS

[llvm-branch-commits] [llvm] 19245b7 - [ObjectYAML] - An attempt to fix BB after commit of D95140.

2021-01-25 Thread Georgii Rymar via llvm-branch-commits

Author: Georgii Rymar
Date: 2021-01-25T13:26:06+03:00
New Revision: 19245b781576f36b85201b94a7c4a54c8f5dead3

URL: 
https://github.com/llvm/llvm-project/commit/19245b781576f36b85201b94a7c4a54c8f5dead3
DIFF: 
https://github.com/llvm/llvm-project/commit/19245b781576f36b85201b94a7c4a54c8f5dead3.diff

LOG: [ObjectYAML] - An attempt to fix BB after commit of D95140.

D95140 introduced `static constexpr StringRef TypeStr = "SectionHeaderTable";` 
member
of `SectionHeaderTable` with in-class initialized. BB reports the link error:

/usr/bin/ld: lib/libLLVMObjectYAML.a(ELFYAML.cpp.o): in function
`llvm::yaml::MappingTraits > >::mapping(llvm::yaml::IO&, 
std::unique_ptr 
>&)':
ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x58):
 undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: 
ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x353):undefined
 reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: 
ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x6e5):
 undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'

This patch adds a definition to cpp file, I guess it should fix the issue.

Added: 


Modified: 
llvm/lib/ObjectYAML/ELFYAML.cpp

Removed: 




diff  --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index b81d9a81758a..05d30577812b 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -33,6 +33,8 @@ unsigned Object::getMachine() const {
 return *Header.Machine;
   return llvm::ELF::EM_NONE;
 }
+
+constexpr StringRef SectionHeaderTable::TypeStr;
 } // namespace ELFYAML
 
 namespace yaml {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] 6367306 - [mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder

2021-01-25 Thread Benjamin Kramer via llvm-branch-commits

Author: Benjamin Kramer
Date: 2021-01-25T11:48:58+01:00
New Revision: 6367306a1be3adf7125c0b8b8f87209b8fc836f7

URL: 
https://github.com/llvm/llvm-project/commit/6367306a1be3adf7125c0b8b8f87209b8fc836f7
DIFF: 
https://github.com/llvm/llvm-project/commit/6367306a1be3adf7125c0b8b8f87209b8fc836f7.diff

LOG: [mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder

This is both cleaner and less prone to creating a mess out of overload
resolution.

Added: 


Modified: 
mlir/include/mlir/IR/ImplicitLocOpBuilder.h

Removed: 




diff  --git a/mlir/include/mlir/IR/ImplicitLocOpBuilder.h 
b/mlir/include/mlir/IR/ImplicitLocOpBuilder.h
index ff85f2b5a382..862be32e6208 100644
--- a/mlir/include/mlir/IR/ImplicitLocOpBuilder.h
+++ b/mlir/include/mlir/IR/ImplicitLocOpBuilder.h
@@ -22,20 +22,11 @@ namespace mlir {
 /// as OpBuilder.
 class ImplicitLocOpBuilder : public mlir::OpBuilder {
 public:
-  /// Create an ImplicitLocOpBuilder using the insertion point and listener 
from
-  /// an existing OpBuilder.
-  ImplicitLocOpBuilder(Location loc, const OpBuilder &builder)
-  : OpBuilder(builder), curLoc(loc) {}
-
   /// OpBuilder has a bunch of convenience constructors - we support them all
   /// with the additional Location.
-  template 
-  ImplicitLocOpBuilder(Location loc, T &&operand, Listener *listener = nullptr)
-  : OpBuilder(std::forward(operand), listener), curLoc(loc) {}
-
-  ImplicitLocOpBuilder(Location loc, Block *block, Block::iterator insertPoint,
-   Listener *listener = nullptr)
-  : OpBuilder(block, insertPoint, listener), curLoc(loc) {}
+  template 
+  ImplicitLocOpBuilder(Location loc, T &&...operands)
+  : OpBuilder(std::forward(operands)...), curLoc(loc) {}
 
   /// Create a builder and set the insertion point to before the first 
operation
   /// in the block but still inside the block.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] da48994 - [llvm-dwp] Automatically set the target triple

2021-01-25 Thread Philip Pfaffe via llvm-branch-commits

Author: Philip Pfaffe
Date: 2021-01-25T11:58:54+01:00
New Revision: da489946a9d8385826defa91441c7e8e6e1ee8e4

URL: 
https://github.com/llvm/llvm-project/commit/da489946a9d8385826defa91441c7e8e6e1ee8e4
DIFF: 
https://github.com/llvm/llvm-project/commit/da489946a9d8385826defa91441c7e8e6e1ee8e4.diff

LOG: [llvm-dwp] Automatically set the target triple

The llvm-dwp tool hard-codes the target triple to x86. Instead, deduce the
target triple from the object files being read.

Reviewed By: dblaikie

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

Added: 
llvm/test/tools/llvm-dwp/WebAssembly/lit.local.cfg
llvm/test/tools/llvm-dwp/WebAssembly/simple_dwo.s

Modified: 
llvm/tools/llvm-dwp/llvm-dwp.cpp

Removed: 




diff  --git a/llvm/test/tools/llvm-dwp/WebAssembly/lit.local.cfg 
b/llvm/test/tools/llvm-dwp/WebAssembly/lit.local.cfg
new file mode 100644
index ..5ea762c84049
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/WebAssembly/lit.local.cfg
@@ -0,0 +1,4 @@
+if not 'WebAssembly' in config.root.targets:
+config.unsupported = True
+
+config.suffixes = ['.s']

diff  --git a/llvm/test/tools/llvm-dwp/WebAssembly/simple_dwo.s 
b/llvm/test/tools/llvm-dwp/WebAssembly/simple_dwo.s
new file mode 100644
index ..f3e88c97d581
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/WebAssembly/simple_dwo.s
@@ -0,0 +1,11 @@
+# RUN: llvm-mc %s -filetype obj -triple wasm32-unknown-unknown -o %t.o \
+# RUN: -split-dwarf-file=%t.dwo -dwarf-version=5
+# RUN: llvm-dwp %t.dwo -o %t.dwp
+# RUN: llvm-dwarfdump -v %t.dwp | FileCheck %s
+
+# This test checks whether llvm-dwp is able to emit object files of the same
+# triple as its inputs.
+
+# CHECK: file format WASM
+
+# Empty file, we just care about the file type.

diff  --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp 
b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 7bd7575dab41..9aed3526b0aa 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -696,6 +696,14 @@ static int error(const Twine &Error, const Twine &Context) 
{
   return 1;
 }
 
+static Expected readTargetTriple(StringRef FileName) {
+  auto ErrOrObj = object::ObjectFile::createObjectFile(FileName);
+  if (!ErrOrObj)
+return ErrOrObj.takeError();
+
+  return ErrOrObj->getBinary()->makeTriple();
+}
+
 int main(int argc, char **argv) {
   InitLLVM X(argc, argv);
 
@@ -706,17 +714,36 @@ int main(int argc, char **argv) {
   llvm::InitializeAllTargets();
   llvm::InitializeAllAsmPrinters();
 
+  std::vector DWOFilenames = InputFiles;
+  for (const auto &ExecFilename : ExecFilenames) {
+auto DWOs = getDWOFilenames(ExecFilename);
+if (!DWOs) {
+  logAllUnhandledErrors(DWOs.takeError(), WithColor::error());
+  return 1;
+}
+DWOFilenames.insert(DWOFilenames.end(),
+std::make_move_iterator(DWOs->begin()),
+std::make_move_iterator(DWOs->end()));
+  }
+
+  if (DWOFilenames.empty())
+return 0;
+
   std::string ErrorStr;
   StringRef Context = "dwarf streamer init";
 
-  Triple TheTriple("x86_64-linux-gnu");
+  auto ErrOrTriple = readTargetTriple(DWOFilenames.front());
+  if (!ErrOrTriple) {
+logAllUnhandledErrors(ErrOrTriple.takeError(), WithColor::error());
+return 1;
+  }
 
   // Get the target.
   const Target *TheTarget =
-  TargetRegistry::lookupTarget("", TheTriple, ErrorStr);
+  TargetRegistry::lookupTarget("", *ErrOrTriple, ErrorStr);
   if (!TheTarget)
 return error(ErrorStr, Context);
-  std::string TripleName = TheTriple.getTriple();
+  std::string TripleName = ErrOrTriple->getTriple();
 
   // Create all the MC Objects.
   std::unique_ptr MRI(TheTarget->createMCRegInfo(TripleName));
@@ -731,7 +758,7 @@ int main(int argc, char **argv) {
 
   MCObjectFileInfo MOFI;
   MCContext MC(MAI.get(), MRI.get(), &MOFI);
-  MOFI.InitMCObjectFileInfo(TheTriple, /*PIC*/ false, MC);
+  MOFI.InitMCObjectFileInfo(*ErrOrTriple, /*PIC*/ false, MC);
 
   std::unique_ptr MSTI(
   TheTarget->createMCSubtargetInfo(TripleName, "", ""));
@@ -766,25 +793,13 @@ int main(int argc, char **argv) {
   }
 
   std::unique_ptr MS(TheTarget->createMCObjectStreamer(
-  TheTriple, MC, std::unique_ptr(MAB),
+  *ErrOrTriple, MC, std::unique_ptr(MAB),
   MAB->createObjectWriter(*OS), std::unique_ptr(MCE), *MSTI,
   MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible,
   /*DWARFMustBeAtTheEnd*/ false));
   if (!MS)
 return error("no object streamer for target " + TripleName, Context);
 
-  std::vector DWOFilenames = InputFiles;
-  for (const auto &ExecFilename : ExecFilenames) {
-auto DWOs = getDWOFilenames(ExecFilename);
-if (!DWOs) {
-  logAllUnhandledErrors(DWOs.takeError(), WithColor::error());
-  return 1;
-}
-DWOFilenames.insert(DWOFilenames.end(),
-std::make_move_iterator(DWOs->begin()),
-std::make_move_i

[llvm-branch-commits] [clang] 8fdd578 - [OpenCL][Docs] Describe tablegen BIFs declarations.

2021-01-25 Thread Anastasia Stulova via llvm-branch-commits

Author: Anastasia Stulova
Date: 2021-01-25T11:17:03Z
New Revision: 8fdd5784f0d30b165602343a96a34611779b007b

URL: 
https://github.com/llvm/llvm-project/commit/8fdd5784f0d30b165602343a96a34611779b007b
DIFF: 
https://github.com/llvm/llvm-project/commit/8fdd5784f0d30b165602343a96a34611779b007b.diff

LOG: [OpenCL][Docs] Describe tablegen BIFs declarations.

Added documentation for the fast builtin
function declarations with -fdeclare-opencl-builtins.

Tags: #clang

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

Added: 


Modified: 
clang/docs/OpenCLSupport.rst
clang/docs/UsersManual.rst

Removed: 




diff  --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index 5be7e91adcaf..0eaf0f300ee4 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -112,6 +112,28 @@ Feel free to contact us on `cfe-dev
 `_ or via `Bugzilla
 `__.
 
+Fast builtin function declarations
+--
+
+In addition to regular header includes with builtin types and functions using
+``-finclude-default-header`` explained in :doc:`UsersManual`, clang
+supports a fast mechanism to declare builtin functions with
+``-fdeclare-opencl-builtins``. This does not declare the builtin types and
+therefore it has to be used in combination with ``-finclude-default-header``
+if full functionality is required.
+
+**Example of Use**:
+
+.. code-block:: console
+ 
+  $ clang -Xclang -finclude-default-header test.cl
+
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend, e.g. ``-cc1`` or ``-Xclang``.
+
+As this feature is still in experimental phase some changes might still occur
+on the command line interface side.
+
 C++ libraries for OpenCL
 
 

diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index a7b698d77c47..fe944a0166b8 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3021,6 +3021,11 @@ To enable modules for OpenCL:
 
  $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path= test.cl
 
+Another way to circumvent long parsing latency for the OpenCL builtin
+declarations is to use mechanism enabled by ``-fdeclare-opencl-builtins`` flag
+that is available as an experimental feature (see more information in
+:doc:`OpenCLSupport`).
+
 OpenCL Extensions
 -
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] d196f9e - [InstructionCost] Prevent InstructionCost being created with CostState.

2021-01-25 Thread Sander de Smalen via llvm-branch-commits

Author: Sander de Smalen
Date: 2021-01-25T11:26:56Z
New Revision: d196f9e2fca3ff767aa7d2dcaf4654724a79e18c

URL: 
https://github.com/llvm/llvm-project/commit/d196f9e2fca3ff767aa7d2dcaf4654724a79e18c
DIFF: 
https://github.com/llvm/llvm-project/commit/d196f9e2fca3ff767aa7d2dcaf4654724a79e18c.diff

LOG: [InstructionCost] Prevent InstructionCost being created with CostState.

For a function that returns InstructionCost, it is very tempting to write:

  return InstructionCost::Invalid;

But that actually returns InstructionCost(1 /* int value of Invalid */))
which has a totally different meaning. By marking this constructor as
`delete`, this can no longer happen.

Added: 


Modified: 
llvm/include/llvm/Support/InstructionCost.h

Removed: 




diff  --git a/llvm/include/llvm/Support/InstructionCost.h 
b/llvm/include/llvm/Support/InstructionCost.h
index 725f8495ac09..fbc898b878bb 100644
--- a/llvm/include/llvm/Support/InstructionCost.h
+++ b/llvm/include/llvm/Support/InstructionCost.h
@@ -47,6 +47,7 @@ class InstructionCost {
 public:
   InstructionCost() = default;
 
+  InstructionCost(CostState) = delete;
   InstructionCost(CostType Val) : Value(Val), State(Valid) {}
 
   static InstructionCost getInvalid(CostType Val = 0) {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9641bd0 - [TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. NFCI.

2021-01-25 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-25T11:35:44Z
New Revision: 9641bd0f87dda34c09c606358bb0cb08a641a4f6

URL: 
https://github.com/llvm/llvm-project/commit/9641bd0f87dda34c09c606358bb0cb08a641a4f6
DIFF: 
https://github.com/llvm/llvm-project/commit/9641bd0f87dda34c09c606358bb0cb08a641a4f6.diff

LOG: [TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. 
NFCI.

Use const reference to avoid std::string copy - accordingly to the style guide 
we shouldn't be using auto anyway.

Fixes MSVC analyzer warning.

Added: 


Modified: 
llvm/utils/TableGen/GlobalISelEmitter.cpp

Removed: 




diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp 
b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 8026a3a102be..cd97733ce984 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -933,7 +933,8 @@ class RuleMatcher : public Matcher {
 StringRef ParentSymbolicName) {
 std::string ParentName(ParentSymbolicName);
 if (ComplexSubOperands.count(SymbolicName)) {
-  auto RecordedParentName = ComplexSubOperandsParentName[SymbolicName];
+  const std::string &RecordedParentName =
+  ComplexSubOperandsParentName[SymbolicName];
   if (RecordedParentName != ParentName)
 return failedImport("Error: Complex suboperand " + SymbolicName +
 " referenced by 
diff erent operands: " +



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] f461e35 - [X86][AVX] combineX86ShuffleChain - avoid bitcasts around insert_subvector() shuffle patterns.

2021-01-25 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-25T11:35:45Z
New Revision: f461e35cbafed593e637305e2a76822dfb7ca6c7

URL: 
https://github.com/llvm/llvm-project/commit/f461e35cbafed593e637305e2a76822dfb7ca6c7
DIFF: 
https://github.com/llvm/llvm-project/commit/f461e35cbafed593e637305e2a76822dfb7ca6c7.diff

LOG: [X86][AVX] combineX86ShuffleChain - avoid bitcasts around 
insert_subvector() shuffle patterns.

We allow insert_subvector lowering of all legal types, so don't always cast to 
the vXi64/vXf64 shuffle types - this is only necessary for 
X86ISD::SHUF128/X86ISD::VPERM2X128 patterns later.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 0edc40683ea8..2a86e12dd53c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -35357,8 +35357,6 @@ static SDValue combineX86ShuffleChain(ArrayRef 
Inputs, SDValue Root,
   // Handle 128/256-bit lane shuffles of 512-bit vectors.
   if (RootVT.is512BitVector() &&
   (NumBaseMaskElts == 2 || NumBaseMaskElts == 4)) {
-MVT ShuffleVT = (FloatDomain ? MVT::v8f64 : MVT::v8i64);
-
 // If the upper subvectors are zeroable, then an extract+insert is more
 // optimal than using X86ISD::SHUF128. The insertion is free, even if it 
has
 // to zero the upper subvectors.
@@ -35367,12 +35365,11 @@ static SDValue 
combineX86ShuffleChain(ArrayRef Inputs, SDValue Root,
 return SDValue(); // Nothing to do!
   assert(isInRange(BaseMask[0], 0, NumBaseMaskElts) &&
  "Unexpected lane shuffle");
-  Res = CanonicalizeShuffleInput(ShuffleVT, V1);
-  unsigned SubIdx = BaseMask[0] * (8 / NumBaseMaskElts);
+  Res = CanonicalizeShuffleInput(RootVT, V1);
+  unsigned SubIdx = BaseMask[0] * (NumRootElts / NumBaseMaskElts);
   bool UseZero = isAnyZero(BaseMask);
   Res = extractSubVector(Res, SubIdx, DAG, DL, BaseMaskEltSizeInBits);
-  Res = widenSubVector(Res, UseZero, Subtarget, DAG, DL, RootSizeInBits);
-  return DAG.getBitcast(RootVT, Res);
+  return widenSubVector(Res, UseZero, Subtarget, DAG, DL, RootSizeInBits);
 }
 
 // Narrow shuffle mask to v4x128.
@@ -35423,6 +35420,7 @@ static SDValue combineX86ShuffleChain(ArrayRef 
Inputs, SDValue Root,
 if (!isAnyZero(Mask) && !PreferPERMQ) {
   if (Depth == 0 && Root.getOpcode() == X86ISD::SHUF128)
 return SDValue(); // Nothing to do!
+  MVT ShuffleVT = (FloatDomain ? MVT::v8f64 : MVT::v8i64);
   if (SDValue V = MatchSHUF128(ShuffleVT, DL, Mask, V1, V2, DAG))
 return DAG.getBitcast(RootVT, V);
 }
@@ -35430,8 +35428,6 @@ static SDValue combineX86ShuffleChain(ArrayRef 
Inputs, SDValue Root,
 
   // Handle 128-bit lane shuffles of 256-bit vectors.
   if (RootVT.is256BitVector() && NumBaseMaskElts == 2) {
-MVT ShuffleVT = (FloatDomain ? MVT::v4f64 : MVT::v4i64);
-
 // If the upper half is zeroable, then an extract+insert is more optimal
 // than using X86ISD::VPERM2X128. The insertion is free, even if it has to
 // zero the upper half.
@@ -35439,13 +35435,13 @@ static SDValue 
combineX86ShuffleChain(ArrayRef Inputs, SDValue Root,
   if (Depth == 0 && Root.getOpcode() == ISD::INSERT_SUBVECTOR)
 return SDValue(); // Nothing to do!
   assert(isInRange(BaseMask[0], 0, 2) && "Unexpected lane shuffle");
-  Res = CanonicalizeShuffleInput(ShuffleVT, V1);
-  Res = extract128BitVector(Res, BaseMask[0] * 2, DAG, DL);
-  Res = widenSubVector(Res, BaseMask[1] == SM_SentinelZero, Subtarget, DAG,
-   DL, 256);
-  return DAG.getBitcast(RootVT, Res);
+  Res = CanonicalizeShuffleInput(RootVT, V1);
+  Res = extract128BitVector(Res, BaseMask[0] * (NumRootElts / 2), DAG, DL);
+  return widenSubVector(Res, BaseMask[1] == SM_SentinelZero, Subtarget, 
DAG,
+DL, 256);
 }
 
+MVT ShuffleVT = (FloatDomain ? MVT::v4f64 : MVT::v4i64);
 if (Depth == 0 && Root.getOpcode() == X86ISD::VPERM2X128)
   return SDValue(); // Nothing to do!
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] 8e3adda - [flang][driver] Remove newline in CompilerInvocation

2021-01-25 Thread Faris Rehman via llvm-branch-commits

Author: Faris Rehman
Date: 2021-01-25T11:58:52Z
New Revision: 8e3adda820e8cd06ca86a83c23cf6adf46b786fa

URL: 
https://github.com/llvm/llvm-project/commit/8e3adda820e8cd06ca86a83c23cf6adf46b786fa
DIFF: 
https://github.com/llvm/llvm-project/commit/8e3adda820e8cd06ca86a83c23cf6adf46b786fa.diff

LOG: [flang][driver] Remove newline in CompilerInvocation

Remove a new line in CompilerInvocation, to now follow the style when 
clang-format is applied.

Added: 


Modified: 
flang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/flang/lib/Frontend/CompilerInvocation.cpp 
b/flang/lib/Frontend/CompilerInvocation.cpp
index cd0faf215a5a..b34b47a18b85 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -191,8 +191,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation 
&res,
 
   // Parse the arguments
   const llvm::opt::OptTable &opts = clang::driver::getDriverOptTable();
-  const unsigned includedFlagsBitmask =
-  clang::driver::options::FC1Option;
+  const unsigned includedFlagsBitmask = clang::driver::options::FC1Option;
   unsigned missingArgIndex, missingArgCount;
   llvm::opt::InputArgList args = opts.ParseArgs(
   commandLineArgs, missingArgIndex, missingArgCount, includedFlagsBitmask);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] de6cd53 - [DebugInfo][NFC] add a new DIE type to represent label + offset.

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-14T07:03:38-05:00
New Revision: de6cd53343c4ed37926c18edbad04aeec06f6ec1

URL: 
https://github.com/llvm/llvm-project/commit/de6cd53343c4ed37926c18edbad04aeec06f6ec1
DIFF: 
https://github.com/llvm/llvm-project/commit/de6cd53343c4ed37926c18edbad04aeec06f6ec1.diff

LOG: [DebugInfo][NFC] add a new DIE type to represent label + offset.

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/include/llvm/CodeGen/DIE.h
llvm/include/llvm/CodeGen/DIEValue.def
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/DIE.cpp
llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 76486b0b48ce..a8a31b83d01c 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -580,7 +580,7 @@ class AsmPrinter : public MachineFunctionPass {
   /// Emit something like ".long Label+Offset" where the size in bytes of the
   /// directive is specified by Size and Label specifies the label.  This
   /// implicitly uses .set if it is available.
-  void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
+  void emitLabelPlusOffset(const MCSymbol *Label, int64_t Offset,
unsigned Size, bool IsSectionRelative = false) 
const;
 
   /// Emit something like ".long Label" where the size in bytes of the 
directive

diff  --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h
index 3efef6ec0acd..634ac2815926 100644
--- a/llvm/include/llvm/CodeGen/DIE.h
+++ b/llvm/include/llvm/CodeGen/DIE.h
@@ -266,6 +266,22 @@ class DIEDelta {
   void print(raw_ostream &O) const;
 };
 
+//======//
+/// A simple label plus offset DIE.
+///
+class DIELabelPlusOffset {
+  const MCSymbol *Label;
+  int64_t Offset;
+
+public:
+  DIELabelPlusOffset(const MCSymbol *L, int64_t O) : Label(L), Offset(O) {}
+
+  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
+
+  void print(raw_ostream &O) const;
+};
+
 //======//
 /// A container for string pool string values.
 ///
@@ -370,7 +386,8 @@ class DIEValue {
   /// should be stored by reference instead of by value.
   using ValTy = AlignedCharArrayUnion;
+  DIELoc *, DIELocList, DIEBaseTypeRef *,
+  DIELabelPlusOffset *>;
 
   static_assert(sizeof(ValTy) <= sizeof(uint64_t) ||
 sizeof(ValTy) <= sizeof(void *),

diff  --git a/llvm/include/llvm/CodeGen/DIEValue.def 
b/llvm/include/llvm/CodeGen/DIEValue.def
index 92afeb3868b4..9091f8d06c3b 100644
--- a/llvm/include/llvm/CodeGen/DIEValue.def
+++ b/llvm/include/llvm/CodeGen/DIEValue.def
@@ -41,6 +41,7 @@ HANDLE_DIEVALUE_LARGE(Block)
 HANDLE_DIEVALUE_LARGE(Loc)
 HANDLE_DIEVALUE_SMALL(LocList)
 HANDLE_DIEVALUE_LARGE(InlineString)
+HANDLE_DIEVALUE_LARGE(LabelPlusOffset)
 
 #undef HANDLE_DIEVALUE
 #undef HANDLE_DIEVALUE_SMALL

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 85754bf29d0c..89a01e4e1a57 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2319,7 +2319,7 @@ void AsmPrinter::emitLabelDifference(const MCSymbol *Hi, 
const MCSymbol *Lo,
 /// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
 /// where the size in bytes of the directive is specified by Size and Label
 /// specifies the label.  This implicitly uses .set if it is available.
-void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
+void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, int64_t Offset,
  unsigned Size,
  bool IsSectionRelative) const {
   if (MAI->needsDwarfSectionOffsetDirective() && IsSectionRelative) {

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 39b0b027c765..2ca586c713ab 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -564,6 +564,36 @@ void DIEDelta::print(raw_ostream &O) const {
   O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
 }
 
+//===--===//
+// DIELabelPlusOffset Implementation
+//===--===//
+
+/// EmitValue - Emit lable plus offset value.
+///
+void DIELabelPlusOffset::emitValue(const AsmPrinter *AP, dwarf::Form Form) 
const {
+  AP->emitLabelPlusOffset(Label, Offse

[llvm-branch-commits] [llvm] 6744490 - [debug-info] NFC - add isa<> support for MCStreamer

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-25T02:55:35-05:00
New Revision: 67444901ed2ae692dcf9971708362df2463be975

URL: 
https://github.com/llvm/llvm-project/commit/67444901ed2ae692dcf9971708362df2463be975
DIFF: 
https://github.com/llvm/llvm-project/commit/67444901ed2ae692dcf9971708362df2463be975.diff

LOG: [debug-info] NFC - add isa<> support for MCStreamer

Added: 
llvm/include/llvm/MC/MCAsmStreamer.h

Modified: 
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCNullStreamer.cpp
llvm/lib/Object/RecordStreamer.h

Removed: 




diff  --git a/llvm/include/llvm/MC/MCAsmStreamer.h 
b/llvm/include/llvm/MC/MCAsmStreamer.h
new file mode 100644
index ..5b2f407841e5
--- /dev/null
+++ b/llvm/include/llvm/MC/MCAsmStreamer.h
@@ -0,0 +1,374 @@
+//===- MCObjectStreamer.h - MCStreamer Object File Interface *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_MC_MCASMSTREAMER_H
+#define LLVM_MC_MCASMSTREAMER_H
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/MC/MCAsmBackend.h"
+#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCCodeEmitter.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCInstPrinter.h"
+#include "llvm/MC/MCObjectFileInfo.h"
+#include "llvm/MC/MCObjectWriter.h"
+#include "llvm/MC/MCRegister.h"
+#include "llvm/MC/MCStreamer.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/FormattedStream.h"
+
+using namespace llvm;
+
+namespace llvm {
+
+class MCAsmStreamer final : public MCStreamer {
+  std::unique_ptr OSOwner;
+  formatted_raw_ostream &OS;
+  const MCAsmInfo *MAI;
+  std::unique_ptr InstPrinter;
+  std::unique_ptr Assembler;
+
+  SmallString<128> ExplicitCommentToEmit;
+  SmallString<128> CommentToEmit;
+  raw_svector_ostream CommentStream;
+  raw_null_ostream NullStream;
+
+  unsigned IsVerboseAsm : 1;
+  unsigned ShowInst : 1;
+  unsigned UseDwarfDirectory : 1;
+
+  void EmitRegisterName(int64_t Register);
+  void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
+  void emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
+
+public:
+  MCAsmStreamer(MCContext &Context, std::unique_ptr os,
+bool isVerboseAsm, bool useDwarfDirectory,
+MCInstPrinter *printer, std::unique_ptr emitter,
+std::unique_ptr asmbackend, bool showInst)
+  : MCStreamer(Context), OSOwner(std::move(os)), OS(*OSOwner),
+MAI(Context.getAsmInfo()), InstPrinter(printer),
+Assembler(std::make_unique(
+Context, std::move(asmbackend), std::move(emitter),
+(asmbackend) ? asmbackend->createObjectWriter(NullStream)
+ : nullptr)),
+CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
+ShowInst(showInst), UseDwarfDirectory(useDwarfDirectory) {
+assert(InstPrinter);
+if (IsVerboseAsm)
+InstPrinter->setCommentStream(CommentStream);
+if (Assembler->getBackendPtr())
+  setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
+
+Context.setUseNamesOnTempLabels(true);
+  }
+
+  MCAssembler &getAssembler() { return *Assembler; }
+  MCAssembler *getAssemblerPtr() override { return nullptr; }
+
+  inline void EmitEOL() {
+// Dump Explicit Comments here.
+emitExplicitComments();
+// If we don't have any comments, just emit a \n.
+if (!IsVerboseAsm) {
+  OS << '\n';
+  return;
+}
+EmitCommentsAndEOL();
+  }
+
+  uint32_t getStreamerKind() const override { return StreamerKindAsm; }
+  static bool classof(const MCStreamer *S) {
+return S->getStreamerKind() == StreamerKindAsm;
+  }
+
+  void emitSyntaxDirective() override;
+
+  void EmitCommentsAndEOL();
+
+  /// Return true if this streamer supports verbose assembly at all.
+  bool isVerboseAsm() const override { return IsVerboseAsm; }
+
+  /// Do we support EmitRawText?
+  bool hasRawTextSupport() const override { return true; }
+
+  /// Add a comment that can be emitted to the generated .s file to make the
+  /// output of the compiler more readable. This only affects the MCAsmStreamer
+  /// and only when verbose assembly output is enabled.
+  void AddComment(const Twine &T, bool EOL = true) override;
+
+  /// Add a comment showing the encoding of an instruction.
+  void AddEncodingComment(const MCInst &Inst, const MCSubtargetInfo &);
+
+  /// Return a raw_ostream that comments can be written to.
+  

[llvm-branch-commits] [llvm] 4fda9ab - [AIX DWARF] support aix dwarf for 32-bit assembly.

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-25T07:01:54-05:00
New Revision: 4fda9ab7444d93fa12e830975230fc4a1fdfe094

URL: 
https://github.com/llvm/llvm-project/commit/4fda9ab7444d93fa12e830975230fc4a1fdfe094
DIFF: 
https://github.com/llvm/llvm-project/commit/4fda9ab7444d93fa12e830975230fc4a1fdfe094.diff

LOG: [AIX DWARF] support aix dwarf for 32-bit assembly.

Added: 


Modified: 
llvm/include/llvm/MC/MCAsmInfo.h
llvm/include/llvm/MC/MCAsmStreamer.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCDwarf.h
llvm/include/llvm/MC/MCSectionXCOFF.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/MC/MCAsmInfoXCOFF.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/MC/MCSectionXCOFF.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp

Removed: 




diff  --git a/llvm/include/llvm/MC/MCAsmInfo.h 
b/llvm/include/llvm/MC/MCAsmInfo.h
index 98e9c2fd3607..3c7d9420d963 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -388,6 +388,14 @@ class MCAsmInfo {
   /// absolute 
diff erence.
   bool DwarfFDESymbolsUseAbsDiff = false;
 
+  /// True if the target supports generating the DWARF line table through using
+  /// of the .loc/.file directives. Defaults to true.
+  bool UsesDwarfFileAndLocDirectives = true;
+
+  /// True if the target needs dwarf section size in the header of dwarf 
section
+  /// (if any) in assembly file. Defaults to true.
+  bool DwarfSectionSizeRequired = true;
+
   /// True if dwarf register numbers are printed instead of symbolic register
   /// names in .cfi_* directives.  Defaults to false.
   bool DwarfRegNumForCFI = false;
@@ -667,6 +675,14 @@ class MCAsmInfo {
 return SupportsExtendedDwarfLocDirective;
   }
 
+  bool usesDwarfFileAndLocDirectives() const {
+return UsesDwarfFileAndLocDirectives;
+  }
+
+  bool requiredDwarfSectionSize() const {
+return DwarfSectionSizeRequired;
+  }
+
   void addInitialFrameState(const MCCFIInstruction &Inst);
 
   const std::vector &getInitialFrameState() const {

diff  --git a/llvm/include/llvm/MC/MCAsmStreamer.h 
b/llvm/include/llvm/MC/MCAsmStreamer.h
index 5b2f407841e5..3bb845c40b43 100644
--- a/llvm/include/llvm/MC/MCAsmStreamer.h
+++ b/llvm/include/llvm/MC/MCAsmStreamer.h
@@ -367,6 +367,9 @@ class MCAsmStreamer final : public MCStreamer {
   void emitRawTextImpl(StringRef String) override;
 
   void finishImpl() override;
+  void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
+const MCSymbol *Label,
+unsigned PointerSize) override;
 };
 
 } // end anonymous namespace.

diff  --git a/llvm/include/llvm/MC/MCContext.h 
b/llvm/include/llvm/MC/MCContext.h
index 49ab0ce8d6fd..1c31fdfc4165 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -574,7 +574,8 @@ namespace llvm {
 XCOFF::StorageMappingClass MappingClass,
 XCOFF::SymbolType CSectType, SectionKind K,
 bool MultiSymbolsAllowed = false,
-const char *BeginSymName = nullptr);
+const char *BeginSymName = nullptr,
+unsigned SecFlags = 0);
 
 // Create and save a copy of STI and return a reference to the copy.
 MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);

diff  --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index 70da5f76e766..715035203cbc 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -172,7 +172,7 @@ class MCDwarfLineEntry : public MCDwarfLoc {
   // This is called when an instruction is assembled into the specified
   // section and if there is information from the last .loc directive that
   // has yet to have a line entry made for it is made.
-  static void Make(MCObjectStreamer *MCOS, MCSection *Section);
+  static void Make(MCStreamer *MCOS, MCSection *Section);
 };
 
 /// Instances of this class represent the line information for a compile
@@ -310,10 +310,10 @@ class MCDwarfLineTable {
 
 public:
   // This emits the Dwarf file and the line tables for all Compile Units.
-  static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params);
+  static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params);
 
   // This emits the Dwarf file and the line tables for a given Compile Unit.
-  void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params,
+  void EmitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
   Optional &LineStr) const;
 
   Expected tryGetFile(StringRef &Directory, StringRef &F

[llvm-branch-commits] [clang] 14947cd - [clang] Fix signedness in vector bitcast evaluation

2021-01-25 Thread Sven van Haastregt via llvm-branch-commits

Author: Sven van Haastregt
Date: 2021-01-25T12:01:42Z
New Revision: 14947cd04701d923a57a0161fd1967b81e00ff5e

URL: 
https://github.com/llvm/llvm-project/commit/14947cd04701d923a57a0161fd1967b81e00ff5e
DIFF: 
https://github.com/llvm/llvm-project/commit/14947cd04701d923a57a0161fd1967b81e00ff5e.diff

LOG: [clang] Fix signedness in vector bitcast evaluation

The included test case triggered a sign assertion on the result in
`Success()`.  This was caused by the APSInt created for a bitcast
having its signedness bit inverted.  The second APSInt constructor
argument is `isUnsigned`, so invert the result of
`isSignedIntegerType`.

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

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/test/CodeGenOpenCL/vector_literals.cl

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 56181bbe1166..c1973720e49a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10193,7 +10193,7 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr 
*E) {
   Elt = SValInt.rotl(i*EltSize+EltSize).zextOrTrunc(EltSize);
 else
   Elt = SValInt.rotr(i*EltSize).zextOrTrunc(EltSize);
-Elts.push_back(APValue(APSInt(Elt, EltTy->isSignedIntegerType(;
+Elts.push_back(APValue(APSInt(Elt, !EltTy->isSignedIntegerType(;
   }
 } else {
   return Error(E);

diff  --git a/clang/test/CodeGenOpenCL/vector_literals.cl 
b/clang/test/CodeGenOpenCL/vector_literals.cl
index af571714368e..3115aef2b50a 100644
--- a/clang/test/CodeGenOpenCL/vector_literals.cl
+++ b/clang/test/CodeGenOpenCL/vector_literals.cl
@@ -63,3 +63,10 @@ void vector_literals_valid() {
   //CHECK: store <4 x float> , <4 x float>* %V2
   float4 V2 = (float4)(1);
 }
+
+void vector_literals_with_cast() {
+  // CHECK-LABEL: vector_literals_with_cast
+  // CHECK: store <2 x i32> , <2 x i32>*
+  // CHECK: extractelement <2 x i32> %{{[0-9]+}}, i64 0
+  unsigned int withCast = ((int2)((int2)(12, 34))).s0;
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] de6cd53 - [DebugInfo][NFC] add a new DIE type to represent label + offset.

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-14T07:03:38-05:00
New Revision: de6cd53343c4ed37926c18edbad04aeec06f6ec1

URL: 
https://github.com/llvm/llvm-project/commit/de6cd53343c4ed37926c18edbad04aeec06f6ec1
DIFF: 
https://github.com/llvm/llvm-project/commit/de6cd53343c4ed37926c18edbad04aeec06f6ec1.diff

LOG: [DebugInfo][NFC] add a new DIE type to represent label + offset.

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/include/llvm/CodeGen/DIE.h
llvm/include/llvm/CodeGen/DIEValue.def
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/DIE.cpp
llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 76486b0b48ce..a8a31b83d01c 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -580,7 +580,7 @@ class AsmPrinter : public MachineFunctionPass {
   /// Emit something like ".long Label+Offset" where the size in bytes of the
   /// directive is specified by Size and Label specifies the label.  This
   /// implicitly uses .set if it is available.
-  void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
+  void emitLabelPlusOffset(const MCSymbol *Label, int64_t Offset,
unsigned Size, bool IsSectionRelative = false) 
const;
 
   /// Emit something like ".long Label" where the size in bytes of the 
directive

diff  --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h
index 3efef6ec0acd..634ac2815926 100644
--- a/llvm/include/llvm/CodeGen/DIE.h
+++ b/llvm/include/llvm/CodeGen/DIE.h
@@ -266,6 +266,22 @@ class DIEDelta {
   void print(raw_ostream &O) const;
 };
 
+//======//
+/// A simple label plus offset DIE.
+///
+class DIELabelPlusOffset {
+  const MCSymbol *Label;
+  int64_t Offset;
+
+public:
+  DIELabelPlusOffset(const MCSymbol *L, int64_t O) : Label(L), Offset(O) {}
+
+  void emitValue(const AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
+
+  void print(raw_ostream &O) const;
+};
+
 //======//
 /// A container for string pool string values.
 ///
@@ -370,7 +386,8 @@ class DIEValue {
   /// should be stored by reference instead of by value.
   using ValTy = AlignedCharArrayUnion;
+  DIELoc *, DIELocList, DIEBaseTypeRef *,
+  DIELabelPlusOffset *>;
 
   static_assert(sizeof(ValTy) <= sizeof(uint64_t) ||
 sizeof(ValTy) <= sizeof(void *),

diff  --git a/llvm/include/llvm/CodeGen/DIEValue.def 
b/llvm/include/llvm/CodeGen/DIEValue.def
index 92afeb3868b4..9091f8d06c3b 100644
--- a/llvm/include/llvm/CodeGen/DIEValue.def
+++ b/llvm/include/llvm/CodeGen/DIEValue.def
@@ -41,6 +41,7 @@ HANDLE_DIEVALUE_LARGE(Block)
 HANDLE_DIEVALUE_LARGE(Loc)
 HANDLE_DIEVALUE_SMALL(LocList)
 HANDLE_DIEVALUE_LARGE(InlineString)
+HANDLE_DIEVALUE_LARGE(LabelPlusOffset)
 
 #undef HANDLE_DIEVALUE
 #undef HANDLE_DIEVALUE_SMALL

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 85754bf29d0c..89a01e4e1a57 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2319,7 +2319,7 @@ void AsmPrinter::emitLabelDifference(const MCSymbol *Hi, 
const MCSymbol *Lo,
 /// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
 /// where the size in bytes of the directive is specified by Size and Label
 /// specifies the label.  This implicitly uses .set if it is available.
-void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
+void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, int64_t Offset,
  unsigned Size,
  bool IsSectionRelative) const {
   if (MAI->needsDwarfSectionOffsetDirective() && IsSectionRelative) {

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 39b0b027c765..2ca586c713ab 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -564,6 +564,36 @@ void DIEDelta::print(raw_ostream &O) const {
   O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();
 }
 
+//===--===//
+// DIELabelPlusOffset Implementation
+//===--===//
+
+/// EmitValue - Emit lable plus offset value.
+///
+void DIELabelPlusOffset::emitValue(const AsmPrinter *AP, dwarf::Form Form) 
const {
+  AP->emitLabelPlusOffset(Label, Offse

[llvm-branch-commits] [llvm] 4fda9ab - [AIX DWARF] support aix dwarf for 32-bit assembly.

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-25T07:01:54-05:00
New Revision: 4fda9ab7444d93fa12e830975230fc4a1fdfe094

URL: 
https://github.com/llvm/llvm-project/commit/4fda9ab7444d93fa12e830975230fc4a1fdfe094
DIFF: 
https://github.com/llvm/llvm-project/commit/4fda9ab7444d93fa12e830975230fc4a1fdfe094.diff

LOG: [AIX DWARF] support aix dwarf for 32-bit assembly.

Added: 


Modified: 
llvm/include/llvm/MC/MCAsmInfo.h
llvm/include/llvm/MC/MCAsmStreamer.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCDwarf.h
llvm/include/llvm/MC/MCSectionXCOFF.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/MC/MCAsmInfoXCOFF.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/MC/MCSectionXCOFF.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp

Removed: 




diff  --git a/llvm/include/llvm/MC/MCAsmInfo.h 
b/llvm/include/llvm/MC/MCAsmInfo.h
index 98e9c2fd3607..3c7d9420d963 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -388,6 +388,14 @@ class MCAsmInfo {
   /// absolute 
diff erence.
   bool DwarfFDESymbolsUseAbsDiff = false;
 
+  /// True if the target supports generating the DWARF line table through using
+  /// of the .loc/.file directives. Defaults to true.
+  bool UsesDwarfFileAndLocDirectives = true;
+
+  /// True if the target needs dwarf section size in the header of dwarf 
section
+  /// (if any) in assembly file. Defaults to true.
+  bool DwarfSectionSizeRequired = true;
+
   /// True if dwarf register numbers are printed instead of symbolic register
   /// names in .cfi_* directives.  Defaults to false.
   bool DwarfRegNumForCFI = false;
@@ -667,6 +675,14 @@ class MCAsmInfo {
 return SupportsExtendedDwarfLocDirective;
   }
 
+  bool usesDwarfFileAndLocDirectives() const {
+return UsesDwarfFileAndLocDirectives;
+  }
+
+  bool requiredDwarfSectionSize() const {
+return DwarfSectionSizeRequired;
+  }
+
   void addInitialFrameState(const MCCFIInstruction &Inst);
 
   const std::vector &getInitialFrameState() const {

diff  --git a/llvm/include/llvm/MC/MCAsmStreamer.h 
b/llvm/include/llvm/MC/MCAsmStreamer.h
index 5b2f407841e5..3bb845c40b43 100644
--- a/llvm/include/llvm/MC/MCAsmStreamer.h
+++ b/llvm/include/llvm/MC/MCAsmStreamer.h
@@ -367,6 +367,9 @@ class MCAsmStreamer final : public MCStreamer {
   void emitRawTextImpl(StringRef String) override;
 
   void finishImpl() override;
+  void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
+const MCSymbol *Label,
+unsigned PointerSize) override;
 };
 
 } // end anonymous namespace.

diff  --git a/llvm/include/llvm/MC/MCContext.h 
b/llvm/include/llvm/MC/MCContext.h
index 49ab0ce8d6fd..1c31fdfc4165 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -574,7 +574,8 @@ namespace llvm {
 XCOFF::StorageMappingClass MappingClass,
 XCOFF::SymbolType CSectType, SectionKind K,
 bool MultiSymbolsAllowed = false,
-const char *BeginSymName = nullptr);
+const char *BeginSymName = nullptr,
+unsigned SecFlags = 0);
 
 // Create and save a copy of STI and return a reference to the copy.
 MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);

diff  --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h
index 70da5f76e766..715035203cbc 100644
--- a/llvm/include/llvm/MC/MCDwarf.h
+++ b/llvm/include/llvm/MC/MCDwarf.h
@@ -172,7 +172,7 @@ class MCDwarfLineEntry : public MCDwarfLoc {
   // This is called when an instruction is assembled into the specified
   // section and if there is information from the last .loc directive that
   // has yet to have a line entry made for it is made.
-  static void Make(MCObjectStreamer *MCOS, MCSection *Section);
+  static void Make(MCStreamer *MCOS, MCSection *Section);
 };
 
 /// Instances of this class represent the line information for a compile
@@ -310,10 +310,10 @@ class MCDwarfLineTable {
 
 public:
   // This emits the Dwarf file and the line tables for all Compile Units.
-  static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params);
+  static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params);
 
   // This emits the Dwarf file and the line tables for a given Compile Unit.
-  void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params,
+  void EmitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
   Optional &LineStr) const;
 
   Expected tryGetFile(StringRef &Directory, StringRef &F

[llvm-branch-commits] [llvm] 6744490 - [debug-info] NFC - add isa<> support for MCStreamer

2021-01-25 Thread Chen Zheng via llvm-branch-commits

Author: Chen Zheng
Date: 2021-01-25T02:55:35-05:00
New Revision: 67444901ed2ae692dcf9971708362df2463be975

URL: 
https://github.com/llvm/llvm-project/commit/67444901ed2ae692dcf9971708362df2463be975
DIFF: 
https://github.com/llvm/llvm-project/commit/67444901ed2ae692dcf9971708362df2463be975.diff

LOG: [debug-info] NFC - add isa<> support for MCStreamer

Added: 
llvm/include/llvm/MC/MCAsmStreamer.h

Modified: 
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCNullStreamer.cpp
llvm/lib/Object/RecordStreamer.h

Removed: 




diff  --git a/llvm/include/llvm/MC/MCAsmStreamer.h 
b/llvm/include/llvm/MC/MCAsmStreamer.h
new file mode 100644
index ..5b2f407841e5
--- /dev/null
+++ b/llvm/include/llvm/MC/MCAsmStreamer.h
@@ -0,0 +1,374 @@
+//===- MCObjectStreamer.h - MCStreamer Object File Interface *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_MC_MCASMSTREAMER_H
+#define LLVM_MC_MCASMSTREAMER_H
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/MC/MCAsmBackend.h"
+#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCCodeEmitter.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCInstPrinter.h"
+#include "llvm/MC/MCObjectFileInfo.h"
+#include "llvm/MC/MCObjectWriter.h"
+#include "llvm/MC/MCRegister.h"
+#include "llvm/MC/MCStreamer.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/FormattedStream.h"
+
+using namespace llvm;
+
+namespace llvm {
+
+class MCAsmStreamer final : public MCStreamer {
+  std::unique_ptr OSOwner;
+  formatted_raw_ostream &OS;
+  const MCAsmInfo *MAI;
+  std::unique_ptr InstPrinter;
+  std::unique_ptr Assembler;
+
+  SmallString<128> ExplicitCommentToEmit;
+  SmallString<128> CommentToEmit;
+  raw_svector_ostream CommentStream;
+  raw_null_ostream NullStream;
+
+  unsigned IsVerboseAsm : 1;
+  unsigned ShowInst : 1;
+  unsigned UseDwarfDirectory : 1;
+
+  void EmitRegisterName(int64_t Register);
+  void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
+  void emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
+
+public:
+  MCAsmStreamer(MCContext &Context, std::unique_ptr os,
+bool isVerboseAsm, bool useDwarfDirectory,
+MCInstPrinter *printer, std::unique_ptr emitter,
+std::unique_ptr asmbackend, bool showInst)
+  : MCStreamer(Context), OSOwner(std::move(os)), OS(*OSOwner),
+MAI(Context.getAsmInfo()), InstPrinter(printer),
+Assembler(std::make_unique(
+Context, std::move(asmbackend), std::move(emitter),
+(asmbackend) ? asmbackend->createObjectWriter(NullStream)
+ : nullptr)),
+CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
+ShowInst(showInst), UseDwarfDirectory(useDwarfDirectory) {
+assert(InstPrinter);
+if (IsVerboseAsm)
+InstPrinter->setCommentStream(CommentStream);
+if (Assembler->getBackendPtr())
+  setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
+
+Context.setUseNamesOnTempLabels(true);
+  }
+
+  MCAssembler &getAssembler() { return *Assembler; }
+  MCAssembler *getAssemblerPtr() override { return nullptr; }
+
+  inline void EmitEOL() {
+// Dump Explicit Comments here.
+emitExplicitComments();
+// If we don't have any comments, just emit a \n.
+if (!IsVerboseAsm) {
+  OS << '\n';
+  return;
+}
+EmitCommentsAndEOL();
+  }
+
+  uint32_t getStreamerKind() const override { return StreamerKindAsm; }
+  static bool classof(const MCStreamer *S) {
+return S->getStreamerKind() == StreamerKindAsm;
+  }
+
+  void emitSyntaxDirective() override;
+
+  void EmitCommentsAndEOL();
+
+  /// Return true if this streamer supports verbose assembly at all.
+  bool isVerboseAsm() const override { return IsVerboseAsm; }
+
+  /// Do we support EmitRawText?
+  bool hasRawTextSupport() const override { return true; }
+
+  /// Add a comment that can be emitted to the generated .s file to make the
+  /// output of the compiler more readable. This only affects the MCAsmStreamer
+  /// and only when verbose assembly output is enabled.
+  void AddComment(const Twine &T, bool EOL = true) override;
+
+  /// Add a comment showing the encoding of an instruction.
+  void AddEncodingComment(const MCInst &Inst, const MCSubtargetInfo &);
+
+  /// Return a raw_ostream that comments can be written to.
+  

[llvm-branch-commits] [llvm] 1b780cf - [X86][AVX] LowerTRUNCATE - avoid bitcasts around extract_subvectors.

2021-01-25 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-25T12:10:36Z
New Revision: 1b780cf32e3eea193aa2255b852a7ef164ea00a5

URL: 
https://github.com/llvm/llvm-project/commit/1b780cf32e3eea193aa2255b852a7ef164ea00a5
DIFF: 
https://github.com/llvm/llvm-project/commit/1b780cf32e3eea193aa2255b852a7ef164ea00a5.diff

LOG: [X86][AVX] LowerTRUNCATE - avoid bitcasts around extract_subvectors.

We allow extract_subvector lowering of all legal types, so pre-bitcast the 
source type to try and reduce bitcast pollution.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2a86e12dd53c..d2a07e7364dd 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -21075,30 +21075,29 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, 
SelectionDAG &DAG) const {
   assert(VT.is128BitVector() && InVT.is256BitVector() && "Unexpected types!");
 
   if ((VT == MVT::v4i32) && (InVT == MVT::v4i64)) {
+In = DAG.getBitcast(MVT::v8i32, In);
+
 // On AVX2, v4i64 -> v4i32 becomes VPERMD.
 if (Subtarget.hasInt256()) {
   static const int ShufMask[] = {0, 2, 4, 6, -1, -1, -1, -1};
-  In = DAG.getBitcast(MVT::v8i32, In);
   In = DAG.getVectorShuffle(MVT::v8i32, DL, In, In, ShufMask);
   return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, In,
  DAG.getIntPtrConstant(0, DL));
 }
 
-SDValue OpLo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v2i64, In,
+SDValue OpLo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v4i32, In,
DAG.getIntPtrConstant(0, DL));
-SDValue OpHi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v2i64, In,
-   DAG.getIntPtrConstant(2, DL));
-OpLo = DAG.getBitcast(MVT::v4i32, OpLo);
-OpHi = DAG.getBitcast(MVT::v4i32, OpHi);
+SDValue OpHi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v4i32, In,
+   DAG.getIntPtrConstant(4, DL));
 static const int ShufMask[] = {0, 2, 4, 6};
 return DAG.getVectorShuffle(VT, DL, OpLo, OpHi, ShufMask);
   }
 
   if ((VT == MVT::v8i16) && (InVT == MVT::v8i32)) {
+In = DAG.getBitcast(MVT::v32i8, In);
+
 // On AVX2, v8i32 -> v8i16 becomes PSHUFB.
 if (Subtarget.hasInt256()) {
-  In = DAG.getBitcast(MVT::v32i8, In);
-
   // The PSHUFB mask:
   static const int ShufMask1[] = { 0,  1,  4,  5,  8,  9, 12, 13,
   -1, -1, -1, -1, -1, -1, -1, -1,
@@ -21107,21 +21106,17 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, 
SelectionDAG &DAG) const {
   In = DAG.getVectorShuffle(MVT::v32i8, DL, In, In, ShufMask1);
   In = DAG.getBitcast(MVT::v4i64, In);
 
-  static const int ShufMask2[] = {0,  2,  -1,  -1};
-  In = DAG.getVectorShuffle(MVT::v4i64, DL,  In, In, ShufMask2);
-  In = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v2i64, In,
-   DAG.getIntPtrConstant(0, DL));
-  return DAG.getBitcast(VT, In);
+  static const int ShufMask2[] = {0, 2, -1, -1};
+  In = DAG.getVectorShuffle(MVT::v4i64, DL, In, In, ShufMask2);
+  return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v8i16,
+ DAG.getBitcast(MVT::v16i16, In),
+ DAG.getIntPtrConstant(0, DL));
 }
 
-SDValue OpLo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v4i32, In,
+SDValue OpLo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v16i8, In,
DAG.getIntPtrConstant(0, DL));
-
-SDValue OpHi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v4i32, In,
-   DAG.getIntPtrConstant(4, DL));
-
-OpLo = DAG.getBitcast(MVT::v16i8, OpLo);
-OpHi = DAG.getBitcast(MVT::v16i8, OpHi);
+SDValue OpHi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::v16i8, In,
+   DAG.getIntPtrConstant(16, DL));
 
 // The PSHUFB mask:
 static const int ShufMask1[] = {0,  1,  4,  5,  8,  9, 12, 13,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 171d124 - [SLPVectorizer] NFC: Migrate getVectorCallCosts to use InstructionCost.

2021-01-25 Thread Sander de Smalen via llvm-branch-commits

Author: Sander de Smalen
Date: 2021-01-25T12:27:01Z
New Revision: 171d12489f20818e292362342b5665c689073ad2

URL: 
https://github.com/llvm/llvm-project/commit/171d12489f20818e292362342b5665c689073ad2
DIFF: 
https://github.com/llvm/llvm-project/commit/171d12489f20818e292362342b5665c689073ad2.diff

LOG: [SLPVectorizer] NFC: Migrate getVectorCallCosts to use InstructionCost.

This change also changes getReductionCost to return InstructionCost,
and it simplifies two expressions by removing a redundant 'isValid' check.

Added: 


Modified: 
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp 
b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 7114b4d412fd..0b630197911a 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3411,21 +3411,21 @@ bool BoUpSLP::areAllUsersVectorized(Instruction *I) 
const {
  });
 }
 
-static std::pair
+static std::pair
 getVectorCallCosts(CallInst *CI, FixedVectorType *VecTy,
TargetTransformInfo *TTI, TargetLibraryInfo *TLI) {
   Intrinsic::ID ID = getVectorIntrinsicIDForCall(CI, TLI);
 
   // Calculate the cost of the scalar and vector calls.
   IntrinsicCostAttributes CostAttrs(ID, *CI, VecTy->getElementCount());
-  int IntrinsicCost =
+  auto IntrinsicCost =
 TTI->getIntrinsicInstrCost(CostAttrs, TTI::TCK_RecipThroughput);
 
   auto Shape = VFShape::get(*CI, ElementCount::getFixed(static_cast(
  VecTy->getNumElements())),
 false /*HasGlobalPred*/);
   Function *VecFunc = VFDatabase(*CI).getVectorizedFunction(Shape);
-  int LibCost = IntrinsicCost;
+  auto LibCost = IntrinsicCost;
   if (!CI->isNoBuiltin() && VecFunc) {
 // Calculate the cost of the vector library call.
 SmallVector VecTys;
@@ -5994,7 +5994,7 @@ bool 
SLPVectorizerPass::vectorizeStoreChain(ArrayRef Chain, BoUpSLP &R,
   InstructionCost Cost = R.getTreeCost();
 
   LLVM_DEBUG(dbgs() << "SLP: Found cost = " << Cost << " for VF =" << VF << 
"\n");
-  if (Cost.isValid() && Cost < -SLPCostThreshold) {
+  if (Cost < -SLPCostThreshold) {
 LLVM_DEBUG(dbgs() << "SLP: Decided to vectorize cost = " << Cost << "\n");
 
 using namespace ore;
@@ -6295,7 +6295,7 @@ bool SLPVectorizerPass::tryToVectorizeList(ArrayRef VL, BoUpSLP &R,
 
   MinCost = std::min(MinCost, Cost);
 
-  if (Cost.isValid() && Cost < -SLPCostThreshold) {
+  if (Cost < -SLPCostThreshold) {
 LLVM_DEBUG(dbgs() << "SLP: Vectorizing list at cost:" << Cost << 
".\n");
 R.getORE()->emit(OptimizationRemark(SV_NAME, "VectorizedList",
 cast(Ops[0]))
@@ -7007,11 +7007,12 @@ class HorizontalReduction {
 
 private:
   /// Calculate the cost of a reduction.
-  int getReductionCost(TargetTransformInfo *TTI, Value *FirstReducedVal,
-   unsigned ReduxWidth) {
+  InstructionCost getReductionCost(TargetTransformInfo *TTI,
+   Value *FirstReducedVal,
+   unsigned ReduxWidth) {
 Type *ScalarTy = FirstReducedVal->getType();
 FixedVectorType *VectorTy = FixedVectorType::get(ScalarTy, ReduxWidth);
-int VectorCost, ScalarCost;
+InstructionCost VectorCost, ScalarCost;
 switch (RdxKind) {
 case RecurKind::Add:
 case RecurKind::Mul:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] 1c8f199 - [flang][driver] Update PP tests to use the new driver

2021-01-25 Thread Faris Rehman via llvm-branch-commits

Author: Faris Rehman
Date: 2021-01-25T12:32:23Z
New Revision: 1c8f199f449916d30ec12ecc5bb0f157ab1d01a0

URL: 
https://github.com/llvm/llvm-project/commit/1c8f199f449916d30ec12ecc5bb0f157ab1d01a0
DIFF: 
https://github.com/llvm/llvm-project/commit/1c8f199f449916d30ec12ecc5bb0f157ab1d01a0.diff

LOG: [flang][driver] Update PP tests to use the new driver

Update the preprocessor regression tests to use the new driver if the new 
driver is built (FLANG_BUILD_NEW_DRIVER=On), otherwise the tests will still run 
using f18.

Summary of changes:
- Introduce %flang to the regression tests, which points to the new driver if 
it is built or otherwise points to f18
- Update all tests in flang/test/Preprocessing/ to use %flang

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

Added: 


Modified: 
flang/test/Preprocessing/assert.F90
flang/test/Preprocessing/compiler_defined_macros.F90
flang/test/Preprocessing/defines.F90
flang/test/Preprocessing/fixed-rescan.F
flang/test/Preprocessing/hollerith.f
flang/test/Preprocessing/include-comment.F90
flang/test/Preprocessing/pp001.F
flang/test/Preprocessing/pp002.F
flang/test/Preprocessing/pp003.F
flang/test/Preprocessing/pp004.F
flang/test/Preprocessing/pp005.F
flang/test/Preprocessing/pp006.F
flang/test/Preprocessing/pp007.F
flang/test/Preprocessing/pp008.F
flang/test/Preprocessing/pp009.F
flang/test/Preprocessing/pp010.F
flang/test/Preprocessing/pp011.F
flang/test/Preprocessing/pp012.F
flang/test/Preprocessing/pp013.F
flang/test/Preprocessing/pp014.F
flang/test/Preprocessing/pp015.F
flang/test/Preprocessing/pp016.F
flang/test/Preprocessing/pp017.F
flang/test/Preprocessing/pp018.F
flang/test/Preprocessing/pp019.F
flang/test/Preprocessing/pp020.F
flang/test/Preprocessing/pp021.F
flang/test/Preprocessing/pp022.F
flang/test/Preprocessing/pp023.F
flang/test/Preprocessing/pp024.F
flang/test/Preprocessing/pp025.F
flang/test/Preprocessing/pp026.F
flang/test/Preprocessing/pp027.F
flang/test/Preprocessing/pp028.F
flang/test/Preprocessing/pp029.F
flang/test/Preprocessing/pp030.F
flang/test/Preprocessing/pp031.F
flang/test/Preprocessing/pp032.F
flang/test/Preprocessing/pp033.F
flang/test/Preprocessing/pp034.F
flang/test/Preprocessing/pp035.F
flang/test/Preprocessing/pp036.F
flang/test/Preprocessing/pp037.F
flang/test/Preprocessing/pp038.F
flang/test/Preprocessing/pp039.F
flang/test/Preprocessing/pp040.F
flang/test/Preprocessing/pp041.F
flang/test/Preprocessing/pp042.F
flang/test/Preprocessing/pp043.F
flang/test/Preprocessing/pp044.F
flang/test/Preprocessing/pp101.F90
flang/test/Preprocessing/pp102.F90
flang/test/Preprocessing/pp103.F90
flang/test/Preprocessing/pp104.F90
flang/test/Preprocessing/pp105.F90
flang/test/Preprocessing/pp106.F90
flang/test/Preprocessing/pp107.F90
flang/test/Preprocessing/pp108.F90
flang/test/Preprocessing/pp109.F90
flang/test/Preprocessing/pp110.F90
flang/test/Preprocessing/pp111.F90
flang/test/Preprocessing/pp112.F90
flang/test/Preprocessing/pp113.F90
flang/test/Preprocessing/pp114.F90
flang/test/Preprocessing/pp115.F90
flang/test/Preprocessing/pp116.F90
flang/test/Preprocessing/pp117.F90
flang/test/Preprocessing/pp118.F90
flang/test/Preprocessing/pp119.F90
flang/test/Preprocessing/pp120.F90
flang/test/Preprocessing/pp121.F90
flang/test/Preprocessing/pp122.F90
flang/test/Preprocessing/pp123.F90
flang/test/Preprocessing/pp124.F90
flang/test/Preprocessing/pp125.F90
flang/test/Preprocessing/pp126.F90
flang/test/Preprocessing/pp127.F90
flang/test/Preprocessing/pp128.F90
flang/test/Preprocessing/pp129.F90
flang/test/Preprocessing/pp130.F90
flang/test/lit.cfg.py

Removed: 




diff  --git a/flang/test/Preprocessing/assert.F90 
b/flang/test/Preprocessing/assert.F90
index 64d49e6f1cbd..5d4837efd6d5 100644
--- a/flang/test/Preprocessing/assert.F90
+++ b/flang/test/Preprocessing/assert.F90
@@ -1,4 +1,4 @@
-!RUN: %f18 -E %s 2>&1 | FileCheck %s
+!RUN: %flang -E %s 2>&1 | FileCheck %s
 !CHECK: if(.not.(.true.)) error stop "assert(" // ".TRUE." // ") failed " // 
"at ""
 !CHECK-SAME: assert.F90"": " // "7"
 #define STR(x) #x

diff  --git a/flang/test/Preprocessing/compiler_defined_macros.F90 
b/flang/test/Preprocessing/compiler_defined_macros.F90
index ba20f6d39622..f5f955bbc750 100644
--- a/flang/test/Preprocessing/compiler_defined_macros.F90
+++ b/flang/test/Preprocessing/compiler_defined_macros.F90
@@ -3,7 +3,7 @@
 !CHECK: flang_major = {{[1-9][0-9]*$}}
 !CHECK: flang_minor = {{[0-9]+$}}
 !CHECK: flang_patchlevel = {{[0-9]+$}}
-!RUN: %f18 -E %s | FileCheck  --ignore-case %s
+!RUN: %flang -E %s | FileCheck  --ignore-case %s
 
   
 integer, parameter :: flang_major

[llvm-branch-commits] [mlir] dbf9bed - [mlir][Linalg] Add a hoistPaddingOnTensors transformation

2021-01-25 Thread Nicolas Vasilache via llvm-branch-commits

Author: Nicolas Vasilache
Date: 2021-01-25T12:41:18Z
New Revision: dbf9bedf40792cf8c5492a27b61809737793b9c7

URL: 
https://github.com/llvm/llvm-project/commit/dbf9bedf40792cf8c5492a27b61809737793b9c7
DIFF: 
https://github.com/llvm/llvm-project/commit/dbf9bedf40792cf8c5492a27b61809737793b9c7.diff

LOG: [mlir][Linalg] Add a hoistPaddingOnTensors transformation

This transformation anchors on a padding op whose result is only used as an 
input
to a Linalg op and pulls it out of a given number of loops.
The result is a packing of padded tailes of ops that is amortized just before
the outermost loop from which the pad operation is hoisted.

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

Added: 
mlir/test/Dialect/Linalg/hoist-padding.mlir

Modified: 
mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/lib/Transforms/TestLinalgTransforms.cpp

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h 
b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
index ed585d1f5cf5..4d44b3717991 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
@@ -11,8 +11,10 @@
 
 namespace mlir {
 class FuncOp;
+struct LogicalResult;
 
 namespace linalg {
+class SimplePadOp;
 
 /// Hoist alloc/dealloc pairs and alloca op out of immediately enclosing
 /// scf::ForOp if both conditions are true:
@@ -40,6 +42,44 @@ void hoistRedundantVectorTransfers(FuncOp func);
 /// instead of buffers.
 void hoistRedundantVectorTransfersOnTensor(FuncOp func);
 
+/// Mechanically hoist padding operations on tensors by `nLoops` into a new,
+/// generally larger tensor. This achieves packing of multiple padding ops into
+/// a larger tensor. On success, `simplePadOp` is replaced by the cloned 
version
+/// in the packing loop so the caller can continue reasoning about the padding
+/// operation.
+///
+/// Example in pseudo-mlir:
+/// ===
+///
+/// If hoistPaddingOnTensors is called with `nLoops` = 2 on the following IR.
+/// ```
+///scf.for (%i, %j, %k)
+///  %st0 = subtensor f(%i, %k) : ... to tensor
+///  %0 = linalg.simple_pad %st0 pad %pad :
+/// tensor to tensor<4x8xf32>
+///  compute(%0)
+/// ```
+///
+/// IR resembling the following is produced:
+///
+/// ```
+///scf.for (%i) {
+///  %packed_init = linalg.init_tensor range(%j) : tensor
+///  %packed = scf.for (%k) iter_args(%p : %packed_init)
+///%st0 = subtensor f(%i, %k) : ... to tensor
+///%0 = linalg.simple_pad %st0 pad %pad :
+///   tensor to tensor<4x8xf32>
+///scf.yield %1: tensor
+///  } -> tensor
+///  scf.for (%j, %k) {
+///%st0 = subtensor %packed [%k, 0, 0][1, 4, 8][1, 1, 1] :
+/// tensor to tensor<4x8xf32>
+///compute(%st0)
+///  }
+///}
+/// ```
+LogicalResult hoistPaddingOnTensors(SimplePadOp &simplePadOp, unsigned nLoops);
+
 } // namespace linalg
 } // namespace mlir
 

diff  --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td 
b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index ce1907cb6435..1c21b1639b7e 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -3058,6 +3058,17 @@ def SubTensorOp : BaseOpWithOffsetSizesAndStrides<
 // Build a SubTensorOp with all dynamic entries and custom result type.
 OpBuilderDAG<(ins "RankedTensorType":$resultType, "Value":$source,
   "ValueRange":$offsets, "ValueRange":$sizes, "ValueRange":$strides,
+  CArg<"ArrayRef", "{}">:$attrs)>,
+// Build a SubTensorOp with mixed static and dynamic entries and inferred
+// result type.
+OpBuilderDAG<(ins "Value":$source, "ArrayRef":$offsets,
+  "ArrayRef":$sizes, "ArrayRef":$strides,
+  CArg<"ArrayRef", "{}">:$attrs)>,
+// Build a SubTensorOp with mixed static and dynamic entries and custom
+// result type. If the type passed is nullptr, it is inferred.
+OpBuilderDAG<(ins "RankedTensorType":$resultType, "Value":$source,
+  "ArrayRef":$offsets, "ArrayRef":$sizes,
+  "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>
   ];
 
@@ -3154,6 +3165,11 @@ def SubTensorInsertOp : BaseOpWithOffsetSizesAndStrides<
 // Build a SubTensorInsertOp with all dynamic entries.
 OpBuilderDAG<(ins "Value":$source, "Value":$dest, "ValueRange":$offsets,
   "ValueRange":$sizes, "ValueRange":$strides,
+  CArg<"ArrayRef", "{}">:$attrs)>,
+// Build a SubTensorInsertOp with mixed static and dynamic entries.
+OpBuilderDAG<(ins "Value":$source, "Value":$dest,
+  "ArrayRef":$offsets, "ArrayRef":$sizes,
+  "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>
   

[llvm-branch-commits] [clang] b16fb1f - Revert "[clang] Fix signedness in vector bitcast evaluation"

2021-01-25 Thread Sven van Haastregt via llvm-branch-commits

Author: Sven van Haastregt
Date: 2021-01-25T12:43:30Z
New Revision: b16fb1ffc3ceebdff1f570668e73f257d7f7e499

URL: 
https://github.com/llvm/llvm-project/commit/b16fb1ffc3ceebdff1f570668e73f257d7f7e499
DIFF: 
https://github.com/llvm/llvm-project/commit/b16fb1ffc3ceebdff1f570668e73f257d7f7e499.diff

LOG: Revert "[clang] Fix signedness in vector bitcast evaluation"

This reverts commit 14947cd04701d923a57a0161fd1967b81e00ff5e because
it broke clang-cmake-armv7-quick.

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/test/CodeGenOpenCL/vector_literals.cl

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index c1973720e49ac..56181bbe11668 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10193,7 +10193,7 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr 
*E) {
   Elt = SValInt.rotl(i*EltSize+EltSize).zextOrTrunc(EltSize);
 else
   Elt = SValInt.rotr(i*EltSize).zextOrTrunc(EltSize);
-Elts.push_back(APValue(APSInt(Elt, !EltTy->isSignedIntegerType(;
+Elts.push_back(APValue(APSInt(Elt, EltTy->isSignedIntegerType(;
   }
 } else {
   return Error(E);

diff  --git a/clang/test/CodeGenOpenCL/vector_literals.cl 
b/clang/test/CodeGenOpenCL/vector_literals.cl
index 3115aef2b50ae..af571714368ef 100644
--- a/clang/test/CodeGenOpenCL/vector_literals.cl
+++ b/clang/test/CodeGenOpenCL/vector_literals.cl
@@ -63,10 +63,3 @@ void vector_literals_valid() {
   //CHECK: store <4 x float> , <4 x float>* %V2
   float4 V2 = (float4)(1);
 }
-
-void vector_literals_with_cast() {
-  // CHECK-LABEL: vector_literals_with_cast
-  // CHECK: store <2 x i32> , <2 x i32>*
-  // CHECK: extractelement <2 x i32> %{{[0-9]+}}, i64 0
-  unsigned int withCast = ((int2)((int2)(12, 34))).s0;
-}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 07b60d0 - [InstCombine] add tests for min/max intrinsics with extended values; NFC

2021-01-25 Thread Sanjay Patel via llvm-branch-commits

Author: Sanjay Patel
Date: 2021-01-25T07:52:50-05:00
New Revision: 07b60d0060688dea121be36b46de859bafcec29b

URL: 
https://github.com/llvm/llvm-project/commit/07b60d0060688dea121be36b46de859bafcec29b
DIFF: 
https://github.com/llvm/llvm-project/commit/07b60d0060688dea121be36b46de859bafcec29b.diff

LOG: [InstCombine] add tests for min/max intrinsics with extended values; NFC

Added: 


Modified: 
llvm/test/Transforms/InstCombine/minmax-intrinsics.ll

Removed: 




diff  --git a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll 
b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
index 797f85d94447..bccfac81bdce 100644
--- a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
@@ -5,6 +5,8 @@ declare i8 @llvm.umin.i8(i8, i8)
 declare i8 @llvm.umax.i8(i8, i8)
 declare i8 @llvm.smin.i8(i8, i8)
 declare i8 @llvm.smax.i8(i8, i8)
+declare <3 x i8> @llvm.umin.v3i8(<3 x i8>, <3 x i8>)
+declare void @use(i8)
 
 define i8 @umin_known_bits(i8 %x, i8 %y) {
 ; CHECK-LABEL: @umin_known_bits(
@@ -45,3 +47,154 @@ define i8 @smax_known_bits(i8 %x, i8 %y) {
   %r = and i8 %m, -128
   ret i8 %r
 }
+
+define i8 @smax_sext(i5 %x, i5 %y) {
+; CHECK-LABEL: @smax_sext(
+; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smax.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %sx = sext i5 %x to i8
+  %sy = sext i5 %y to i8
+  %m = call i8 @llvm.smax.i8(i8 %sx, i8 %sy)
+  ret i8 %m
+}
+
+define i8 @smin_sext(i5 %x, i5 %y) {
+; CHECK-LABEL: @smin_sext(
+; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:call void @use(i8 [[SY]])
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smin.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %sx = sext i5 %x to i8
+  %sy = sext i5 %y to i8
+  call void @use(i8 %sy)
+  %m = call i8 @llvm.smin.i8(i8 %sx, i8 %sy)
+  ret i8 %m
+}
+
+define i8 @umax_sext(i5 %x, i5 %y) {
+; CHECK-LABEL: @umax_sext(
+; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
+; CHECK-NEXT:call void @use(i8 [[SX]])
+; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.umax.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %sx = sext i5 %x to i8
+  call void @use(i8 %sx)
+  %sy = sext i5 %y to i8
+  %m = call i8 @llvm.umax.i8(i8 %sx, i8 %sy)
+  ret i8 %m
+}
+
+define <3 x i8> @umin_sext(<3 x i5> %x, <3 x i5> %y) {
+; CHECK-LABEL: @umin_sext(
+; CHECK-NEXT:[[SX:%.*]] = sext <3 x i5> [[X:%.*]] to <3 x i8>
+; CHECK-NEXT:[[SY:%.*]] = sext <3 x i5> [[Y:%.*]] to <3 x i8>
+; CHECK-NEXT:[[M:%.*]] = call <3 x i8> @llvm.umin.v3i8(<3 x i8> [[SX]], <3 
x i8> [[SY]])
+; CHECK-NEXT:ret <3 x i8> [[M]]
+;
+  %sx = sext <3 x i5> %x to <3 x i8>
+  %sy = sext <3 x i5> %y to <3 x i8>
+  %m = call <3 x i8> @llvm.umin.v3i8(<3 x i8> %sx, <3 x i8> %sy)
+  ret <3 x i8> %m
+}
+
+define i8 @smax_zext(i5 %x, i5 %y) {
+; CHECK-LABEL: @smax_zext(
+; CHECK-NEXT:[[ZX:%.*]] = zext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[ZY:%.*]] = zext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smax.i8(i8 [[ZX]], i8 [[ZY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %zx = zext i5 %x to i8
+  %zy = zext i5 %y to i8
+  %m = call i8 @llvm.smax.i8(i8 %zx, i8 %zy)
+  ret i8 %m
+}
+
+define i8 @smin_zext(i5 %x, i5 %y) {
+; CHECK-LABEL: @smin_zext(
+; CHECK-NEXT:[[ZX:%.*]] = zext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[ZY:%.*]] = zext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smin.i8(i8 [[ZX]], i8 [[ZY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %zx = zext i5 %x to i8
+  %zy = zext i5 %y to i8
+  %m = call i8 @llvm.smin.i8(i8 %zx, i8 %zy)
+  ret i8 %m
+}
+
+define i8 @umax_zext(i5 %x, i5 %y) {
+; CHECK-LABEL: @umax_zext(
+; CHECK-NEXT:[[ZX:%.*]] = zext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[ZY:%.*]] = zext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.umax.i8(i8 [[ZX]], i8 [[ZY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %zx = zext i5 %x to i8
+  %zy = zext i5 %y to i8
+  %m = call i8 @llvm.umax.i8(i8 %zx, i8 %zy)
+  ret i8 %m
+}
+
+define i8 @umin_zext(i5 %x, i5 %y) {
+; CHECK-LABEL: @umin_zext(
+; CHECK-NEXT:[[ZX:%.*]] = zext i5 [[X:%.*]] to i8
+; CHECK-NEXT:[[ZY:%.*]] = zext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.umin.i8(i8 [[ZX]], i8 [[ZY]])
+; CHECK-NEXT:ret i8 [[M]]
+;
+  %zx = zext i5 %x to i8
+  %zy = zext i5 %y to i8
+  %m = call i8 @llvm.umin.i8(i8 %zx, i8 %zy)
+  ret i8 %m
+}
+
+define i8 @umin_zext_types(i6 %x, i5 %y) {
+; CHECK-LABEL: @umin_zext_types(
+; CHECK-NEXT:[[ZX:%.*]] = zext i6 [[X:%.*]] to i8
+; CHECK-NEXT:[[ZY:%.*]] = zext i5 [[Y:%.*]] to i8
+; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.umin.i8(i8 [[ZX]], i8 [[ZY]])
+; CHECK-NEXT:re

[llvm-branch-commits] [llvm] 09a136b - [InstCombine] narrow min/max intrinsics with extended inputs

2021-01-25 Thread Sanjay Patel via llvm-branch-commits

Author: Sanjay Patel
Date: 2021-01-25T07:52:50-05:00
New Revision: 09a136bcc6947128df86492d88f1733bdff745d1

URL: 
https://github.com/llvm/llvm-project/commit/09a136bcc6947128df86492d88f1733bdff745d1
DIFF: 
https://github.com/llvm/llvm-project/commit/09a136bcc6947128df86492d88f1733bdff745d1.diff

LOG: [InstCombine] narrow min/max intrinsics with extended inputs

We can sink extends after min/max if they match and would
not change the sign-interpreted compare. The only combo
that doesn't work is zext+smin/smax because the zexts
could change a negative number into positive:
https://alive2.llvm.org/ce/z/D6sz6J

Sext+umax/umin works:

  define i32 @src(i8 %x, i8 %y) {
  %0:
%sx = sext i8 %x to i32
%sy = sext i8 %y to i32
%m = umax i32 %sx, %sy
ret i32 %m
  }
  =>
  define i32 @tgt(i8 %x, i8 %y) {
  %0:
%m = umax i8 %x, %y
%r = sext i8 %m to i32
ret i32 %r
  }
  Transformation seems to be correct!

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/minmax-intrinsics.ll

Removed: 




diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 5ba51d255109..0b4246feecee 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -830,6 +830,30 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) 
{
 
 break;
   }
+  case Intrinsic::umax:
+  case Intrinsic::umin: {
+Value *I0 = II->getArgOperand(0), *I1 = II->getArgOperand(1);
+Value *X, *Y;
+if (match(I0, m_ZExt(m_Value(X))) && match(I1, m_ZExt(m_Value(Y))) &&
+(I0->hasOneUse() || I1->hasOneUse()) && X->getType() == Y->getType()) {
+  Value *NarrowMaxMin = Builder.CreateBinaryIntrinsic(IID, X, Y);
+  return CastInst::Create(Instruction::ZExt, NarrowMaxMin, II->getType());
+}
+// If both operands of unsigned min/max are sign-extended, it is still ok
+// to narrow the operation.
+LLVM_FALLTHROUGH;
+  }
+  case Intrinsic::smax:
+  case Intrinsic::smin: {
+Value *I0 = II->getArgOperand(0), *I1 = II->getArgOperand(1);
+Value *X, *Y;
+if (match(I0, m_SExt(m_Value(X))) && match(I1, m_SExt(m_Value(Y))) &&
+(I0->hasOneUse() || I1->hasOneUse()) && X->getType() == Y->getType()) {
+  Value *NarrowMaxMin = Builder.CreateBinaryIntrinsic(IID, X, Y);
+  return CastInst::Create(Instruction::SExt, NarrowMaxMin, II->getType());
+}
+break;
+  }
   case Intrinsic::bswap: {
 Value *IIOperand = II->getArgOperand(0);
 Value *X = nullptr;

diff  --git a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll 
b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
index bccfac81bdce..97ed799f32a8 100644
--- a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll
@@ -50,9 +50,8 @@ define i8 @smax_known_bits(i8 %x, i8 %y) {
 
 define i8 @smax_sext(i5 %x, i5 %y) {
 ; CHECK-LABEL: @smax_sext(
-; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
-; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
-; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smax.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:[[TMP1:%.*]] = call i5 @llvm.smax.i5(i5 [[X:%.*]], i5 
[[Y:%.*]])
+; CHECK-NEXT:[[M:%.*]] = sext i5 [[TMP1]] to i8
 ; CHECK-NEXT:ret i8 [[M]]
 ;
   %sx = sext i5 %x to i8
@@ -61,12 +60,14 @@ define i8 @smax_sext(i5 %x, i5 %y) {
   ret i8 %m
 }
 
+; Extra use is ok.
+
 define i8 @smin_sext(i5 %x, i5 %y) {
 ; CHECK-LABEL: @smin_sext(
-; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
 ; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
 ; CHECK-NEXT:call void @use(i8 [[SY]])
-; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.smin.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:[[TMP1:%.*]] = call i5 @llvm.smin.i5(i5 [[X:%.*]], i5 [[Y]])
+; CHECK-NEXT:[[M:%.*]] = sext i5 [[TMP1]] to i8
 ; CHECK-NEXT:ret i8 [[M]]
 ;
   %sx = sext i5 %x to i8
@@ -76,12 +77,14 @@ define i8 @smin_sext(i5 %x, i5 %y) {
   ret i8 %m
 }
 
+; Sext doesn't change unsigned min/max comparison of narrow values.
+
 define i8 @umax_sext(i5 %x, i5 %y) {
 ; CHECK-LABEL: @umax_sext(
 ; CHECK-NEXT:[[SX:%.*]] = sext i5 [[X:%.*]] to i8
 ; CHECK-NEXT:call void @use(i8 [[SX]])
-; CHECK-NEXT:[[SY:%.*]] = sext i5 [[Y:%.*]] to i8
-; CHECK-NEXT:[[M:%.*]] = call i8 @llvm.umax.i8(i8 [[SX]], i8 [[SY]])
+; CHECK-NEXT:[[TMP1:%.*]] = call i5 @llvm.umax.i5(i5 [[X]], i5 [[Y:%.*]])
+; CHECK-NEXT:[[M:%.*]] = sext i5 [[TMP1]] to i8
 ; CHECK-NEXT:ret i8 [[M]]
 ;
   %sx = sext i5 %x to i8
@@ -93,9 +96,8 @@ define i8 @umax_sext(i5 %x, i5 %y) {
 
 define <3 x i8> @umin_sext(<3 x i5> %x, <3 x i5> %y) {
 ; CHECK-LABEL: @umin_sext(
-; CHECK-NEXT:[[SX:%.*]] = sext <3 x i5> [[X:%.*]] to <3 x i8>
-; CHECK-NEXT:[[SY:%.*]] = sext <3 x i5> [[Y:%.*]] to <3 x

[llvm-branch-commits] [clang-tools-extra] d6d36ba - Add a --use-color option to clang-query to allow forcing the behavior

2021-01-25 Thread Aaron Ballman via llvm-branch-commits

Author: Tom Ritter
Date: 2021-01-25T08:06:54-05:00
New Revision: d6d36baa33e76ace11ac20c03de1097d48bd9246

URL: 
https://github.com/llvm/llvm-project/commit/d6d36baa33e76ace11ac20c03de1097d48bd9246
DIFF: 
https://github.com/llvm/llvm-project/commit/d6d36baa33e76ace11ac20c03de1097d48bd9246.diff

LOG: Add a --use-color option to clang-query to allow forcing the behavior

D62056 makes the output color if clang auto-detects a tty, but if it
does not, there is no way to force it to use colors anyway.

This patch adjusts the command-lines given to ClangTool which will
force color on or off if --use-color is specified.

Added: 


Modified: 
clang-tools-extra/clang-query/Query.cpp
clang-tools-extra/clang-query/tool/ClangQuery.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-query/Query.cpp 
b/clang-tools-extra/clang-query/Query.cpp
index ca2a285e9eb7..e33612a2e16d 100644
--- a/clang-tools-extra/clang-query/Query.cpp
+++ b/clang-tools-extra/clang-query/Query.cpp
@@ -156,8 +156,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession 
&QS) const {
 if (QS.DetailedASTOutput) {
   OS << "Binding for \"" << BI->first << "\":\n";
   const ASTContext &Ctx = AST->getASTContext();
-  const SourceManager &SM = Ctx.getSourceManager();
-  ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
+  ASTDumper Dumper(OS, Ctx, AST->getDiagnostics().getShowColors());
   Dumper.SetTraversalKind(QS.TK);
   Dumper.Visit(BI->second);
   OS << "\n";

diff  --git a/clang-tools-extra/clang-query/tool/ClangQuery.cpp 
b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
index 31c7f12251c9..45a355073945 100644
--- a/clang-tools-extra/clang-query/tool/ClangQuery.cpp
+++ b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
@@ -49,6 +49,14 @@ using namespace llvm;
 static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static cl::OptionCategory ClangQueryCategory("clang-query options");
 
+static cl::opt
+UseColor("use-color",
+ cl::desc(
+ R"(Use colors in detailed AST output. If not set, colors
+will be used if the terminal connected to
+standard output supports colors.)"),
+ cl::init(false), cl::cat(ClangQueryCategory));
+
 static cl::list Commands("c", cl::desc("Specify command to run"),
   cl::value_desc("command"),
   cl::cat(ClangQueryCategory));
@@ -109,6 +117,19 @@ int main(int argc, const char **argv) {
 
   ClangTool Tool(OptionsParser->getCompilations(),
  OptionsParser->getSourcePathList());
+
+  if (UseColor.getNumOccurrences() > 0) {
+ArgumentsAdjuster colorAdjustor = [](const CommandLineArguments &Args, 
StringRef /*unused*/) {
+  CommandLineArguments AdjustedArgs = Args;
+  if (UseColor)
+AdjustedArgs.push_back("-fdiagnostics-color");
+  else
+AdjustedArgs.push_back("-fno-diagnostics-color");
+  return AdjustedArgs;
+};
+Tool.appendArgumentsAdjuster(colorAdjustor);
+  }
+
   std::vector> ASTs;
   int ASTStatus = 0;
   switch (Tool.buildASTs(ASTs)) {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 84851a2 - Revert "[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests - continued"

2021-01-25 Thread Abhina Sreeskantharajan via llvm-branch-commits

Author: Abhina Sreeskantharajan
Date: 2021-01-25T08:29:38-05:00
New Revision: 84851a274e2beaa3cdafd6a70e6d1128cabf8b21

URL: 
https://github.com/llvm/llvm-project/commit/84851a274e2beaa3cdafd6a70e6d1128cabf8b21
DIFF: 
https://github.com/llvm/llvm-project/commit/84851a274e2beaa3cdafd6a70e6d1128cabf8b21.diff

LOG: Revert "[SystemZ][z/OS] Fix No such file or directory expression error 
matching in lit tests - continued"

This reverts commit 520b5ecf856152f35ee38207eec39f5674dd2bd4.

Added: 


Modified: 
clang/test/Driver/clang-offload-bundler.c
clang/test/Frontend/output-failures.c
llvm/test/Object/archive-extract-dir.test
llvm/test/Object/archive-extract.test
llvm/test/Object/directory.ll
llvm/test/tools/llvm-ar/error-opening-directory.test
llvm/test/tools/llvm-ar/move.test
llvm/test/tools/llvm-ar/print.test
llvm/test/tools/llvm-ar/quick-append.test
llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test
llvm/test/tools/llvm-lipo/create-arch.test
llvm/test/tools/llvm-lipo/replace-invalid-input.test
llvm/test/tools/llvm-lto/error.ll
llvm/test/tools/llvm-objcopy/wasm/dump-section.test
llvm/test/tools/llvm-symbolizer/pdb/missing_pdb.test

Removed: 




diff  --git a/clang/test/Driver/clang-offload-bundler.c 
b/clang/test/Driver/clang-offload-bundler.c
index f7428d7f02f4..3e1fab25d754 100644
--- a/clang/test/Driver/clang-offload-bundler.c
+++ b/clang/test/Driver/clang-offload-bundler.c
@@ -72,7 +72,7 @@
 
 // RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2.notexist -outputs=%t.bundle.i 2>&1 | FileCheck %s 
-DFILE=%t.tgt2.notexist --check-prefix CK-ERR5
 // RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i.notexist -unbundle 2>&1 | 
FileCheck %s -DFILE=%t.bundle.i.notexist --check-prefix CK-ERR5
-// CK-ERR5: error: '[[FILE]]': {{.*}}{{N|n}}o such file or directory
+// CK-ERR5: error: '[[FILE]]': {{N|n}}o such file or directory
 
 // RUN: not clang-offload-bundler -type=invalid 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s 
-DTYPE=invalid --check-prefix CK-ERR6
 // CK-ERR6: error: '[[TYPE]]': invalid file type specified

diff  --git a/clang/test/Frontend/output-failures.c 
b/clang/test/Frontend/output-failures.c
index 26d25fdbef36..0e9ea63f8067 100644
--- a/clang/test/Frontend/output-failures.c
+++ b/clang/test/Frontend/output-failures.c
@@ -1,4 +1,4 @@
 // RUN: not %clang_cc1 -emit-llvm -o %t.doesnotexist/somename %s 2> %t
 // RUN: FileCheck -check-prefix=OUTPUTFAIL -input-file=%t %s
 
-// OUTPUTFAIL: error: unable to open output file 
'{{.*}}doesnotexist{{.}}somename': '{{.*}}{{[nN]}}o such file or 
directory{{.*}}'
+// OUTPUTFAIL: error: unable to open output file 
'{{.*}}doesnotexist{{.}}somename': '{{[nN]}}o such file or directory'

diff  --git a/llvm/test/Object/archive-extract-dir.test 
b/llvm/test/Object/archive-extract-dir.test
index d6a721c090b3..5182a2f91411 100644
--- a/llvm/test/Object/archive-extract-dir.test
+++ b/llvm/test/Object/archive-extract-dir.test
@@ -8,4 +8,4 @@ RUN: rm foo
 RUN: mkdir foo
 RUN: not llvm-ar x test.a foo 2>&1 | FileCheck %s
 
-CHECK: foo: {{.*}}{{[Ii]}}s a directory{{.*}}
+CHECK: foo: {{[Ii]}}s a directory

diff  --git a/llvm/test/Object/archive-extract.test 
b/llvm/test/Object/archive-extract.test
index 589e8b8fe856..11ca12e3353b 100644
--- a/llvm/test/Object/archive-extract.test
+++ b/llvm/test/Object/archive-extract.test
@@ -58,4 +58,4 @@ RUN: llvm-ar p %p/Inputs/thin.a evenlen | FileCheck %s 
--check-prefix=EVENLEN
 EVENLEN: evenlen
 
 RUN: not llvm-ar p %p/Inputs/thin-path.a t/test2.o 2>&1 | FileCheck %s 
--check-prefix=MISSING
-MISSING: error: {{.*}}{{N|n}}o such file or directory
+MISSING: error: {{N|n}}o such file or directory

diff  --git a/llvm/test/Object/directory.ll b/llvm/test/Object/directory.ll
index d9e340a587b1..3e9ac2ce202e 100644
--- a/llvm/test/Object/directory.ll
+++ b/llvm/test/Object/directory.ll
@@ -1,6 +1,6 @@
 ;RUN: rm -rf %t && mkdir -p %t
 ;RUN: not llvm-ar r %t/test.a . 2>&1 | FileCheck %s
-;CHECK: .: {{.*}}{{I|i}}s a directory{{.*}}
+;CHECK: .: {{I|i}}s a directory
 
 ;RUN: rm -f %t/test.a
 ;RUN: touch %t/a-very-long-file-name

diff  --git a/llvm/test/tools/llvm-ar/error-opening-directory.test 
b/llvm/test/tools/llvm-ar/error-opening-directory.test
index 5a6491bd29c8..c3068871230f 100644
--- a/llvm/test/tools/llvm-ar/error-opening-directory.test
+++ b/llvm/test/tools/llvm-ar/error-opening-directory.test
@@ -9,4 +9,4 @@
 # RUN: not llvm-ar p %t/tmpDir 2>&1 | \
 # RUN:FileCheck %s --check-prefix=IS-DIR -DARCHIVE=%t/tmpDir

[llvm-branch-commits] [lld] 978444d - Revert "[SystemZ][z/OS] Fix No such file or directory expression error"

2021-01-25 Thread Abhina Sreeskantharajan via llvm-branch-commits

Author: Abhina Sreeskantharajan
Date: 2021-01-25T08:29:38-05:00
New Revision: 978444d531ddc2b3bd29ad469e8421293b4cc2e5

URL: 
https://github.com/llvm/llvm-project/commit/978444d531ddc2b3bd29ad469e8421293b4cc2e5
DIFF: 
https://github.com/llvm/llvm-project/commit/978444d531ddc2b3bd29ad469e8421293b4cc2e5.diff

LOG: Revert "[SystemZ][z/OS] Fix No such file or directory expression error"

This reverts commit 06f8a49693957bc27b83e0ab5f429ff874941a07.

Added: 


Modified: 
clang/test/CodeGen/basic-block-sections.c
clang/test/CodeGen/ubsan-blacklist-vfs.c
clang/test/Frontend/stats-file.c
lld/test/COFF/driver.test
lld/test/COFF/manifestinput-error.test
lld/test/COFF/nodefaultlib.test
lld/test/COFF/pdb-type-server-invalid-signature.yaml
lld/test/ELF/archive-thin-missing-member.s
lld/test/ELF/basic.s
lld/test/ELF/symbol-ordering-file.s
llvm/test/DebugInfo/symbolize-missing-file.test
llvm/test/tools/dsymutil/X86/papertrail-warnings.test
llvm/test/tools/llvm-ar/missing-thin-archive-member.test
llvm/test/tools/llvm-ar/replace.test
llvm/test/tools/llvm-ar/response.test
llvm/test/tools/llvm-cxxdump/trivial.test
llvm/test/tools/llvm-libtool-darwin/filelist.test
llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
llvm/test/tools/llvm-mc/basic.test
llvm/test/tools/llvm-mca/invalid_input_file_name.test
llvm/test/tools/llvm-ml/basic.test
llvm/test/tools/llvm-objcopy/COFF/add-section.test
llvm/test/tools/llvm-objcopy/ELF/add-section.test
llvm/test/tools/llvm-objcopy/ELF/error-format.test
llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
llvm/test/tools/llvm-objcopy/redefine-symbols.test
llvm/test/tools/llvm-profdata/weight-instr.test
llvm/test/tools/llvm-profdata/weight-sample.test
llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
llvm/test/tools/llvm-readobj/basic.test
llvm/test/tools/llvm-readobj/thin-archive.test
llvm/test/tools/llvm-size/no-input.test
llvm/test/tools/llvm-xray/X86/no-such-file.txt
llvm/test/tools/obj2yaml/invalid_input_file.test
llvm/test/tools/yaml2obj/output-file.yaml

Removed: 




diff  --git a/clang/test/CodeGen/basic-block-sections.c 
b/clang/test/CodeGen/basic-block-sections.c
index 91bcb6222848..70cdeeebb0d3 100644
--- a/clang/test/CodeGen/basic-block-sections.c
+++ b/clang/test/CodeGen/basic-block-sections.c
@@ -41,4 +41,4 @@ int another(int a) {
 //
 // UNIQUE: .section .text.world.world.__part.1,
 // UNIQUE: .section .text.another.another.__part.1,
-// ERROR: error:  unable to load basic block sections function list: 
'{{.*}}{{[Nn]}}o such file or directory'
+// ERROR: error:  unable to load basic block sections function list: 
'{{[Nn]}}o such file or directory'

diff  --git a/clang/test/CodeGen/ubsan-blacklist-vfs.c 
b/clang/test/CodeGen/ubsan-blacklist-vfs.c
index a8509eb2f6f9..0647cbf7a57b 100644
--- a/clang/test/CodeGen/ubsan-blacklist-vfs.c
+++ b/clang/test/CodeGen/ubsan-blacklist-vfs.c
@@ -8,10 +8,10 @@
 // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/only-virtual-file.blacklist 
-emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
 
 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%/T/invalid-virtual-file.blacklist 
-emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE
-// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': {{.*}}{{[Nn]}}o such 
file or directory
+// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': {{[Nn]}}o such file 
or directory
 
 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay 
%t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s 
-o - 2>&1 | FileCheck %s --check-prefix=INVALID
-// INVALID: nonexistent.blacklist': {{.*}}{{[Nn]}}o such file or directory
+// INVALID: nonexistent.blacklist': {{[Nn]}}o such file or directory
 
 unsigned i;
 

diff  --git a/clang/test/Frontend/stats-file.c 
b/clang/test/Frontend/stats-file.c
index 0d0a97b0d1d6..53b264534c57 100644
--- a/clang/test/Frontend/stats-file.c
+++ b/clang/test/Frontend/stats-file.c
@@ -5,4 +5,4 @@
 // CHECK: }
 
 // RUN: %clang_cc1 -emit-llvm -o %t -stats-file=%t.doesnotexist/bla %s 2>&1 | 
FileCheck -check-prefix=OUTPUTFAIL %s
-// OUTPUTFAIL: warning: unable to open statistics output file 
'{{.*}}doesnotexist{{.}}bla': '{{.*}}{{[Nn]}}o such file or directory{{.*}}'
+// OUTPUTFAIL: warning: unable to open statistics output file 
'{{.*}}doesnotexist{{.}}bla': '{{[Nn]}}o such file or directory'

diff  --git a/lld/test/COFF/driver.test b/lld/test/COFF/driver.test
index 951a4d3319f1..d756dc9ed4aa 100644
--- a/lld/test/COFF/driver.test
+++ b/lld/test/COFF/driver.test
@@ -1,6 +1,6 @@
 # RUN: not lld-link nosuchfile.obj >& %t.log
 # RUN: FileCheck -check-prefix=MISSING %s < %

[llvm-branch-commits] [llvm] 821a51a - [X86][AVX] combineX86ShuffleChainWithExtract - widen to at least original root size. NFCI.

2021-01-25 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-25T13:45:37Z
New Revision: 821a51a9cacfac7da8b34ccc0498d316471f1dbc

URL: 
https://github.com/llvm/llvm-project/commit/821a51a9cacfac7da8b34ccc0498d316471f1dbc
DIFF: 
https://github.com/llvm/llvm-project/commit/821a51a9cacfac7da8b34ccc0498d316471f1dbc.diff

LOG: [X86][AVX] combineX86ShuffleChainWithExtract - widen to at least original 
root size. NFCI.

We're relying on the source inputs for shuffle combining having already been 
widened to the root size (otherwise the offset logic falls over) - we're going 
to be supporting different sized shuffle inputs soon, so we need to explicitly 
make the minimum widened width the original root size.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index d2a07e7364dd..ae73a32a5d9a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -35997,12 +35997,16 @@ static SDValue combineX86ShuffleChainWithExtract(
   if (NumInputs == 0)
 return SDValue();
 
+  EVT RootVT = Root.getValueType();
+  unsigned RootSizeInBits = RootVT.getSizeInBits();
+  assert((RootSizeInBits % NumMaskElts) == 0 && "Unexpected root shuffle 
mask");
+
   SmallVector WideInputs(Inputs.begin(), Inputs.end());
   SmallVector Offsets(NumInputs, 0);
 
   // Peek through subvectors.
   // TODO: Support inter-mixed EXTRACT_SUBVECTORs + BITCASTs?
-  unsigned WideSizeInBits = WideInputs[0].getValueSizeInBits();
+  unsigned WideSizeInBits = RootSizeInBits;
   for (unsigned i = 0; i != NumInputs; ++i) {
 SDValue &Src = WideInputs[i];
 unsigned &Offset = Offsets[i];
@@ -36025,8 +36029,6 @@ static SDValue combineX86ShuffleChainWithExtract(
   if (llvm::all_of(Offsets, [](unsigned Offset) { return Offset == 0; }))
 return SDValue();
 
-  EVT RootVT = Root.getValueType();
-  unsigned RootSizeInBits = RootVT.getSizeInBits();
   unsigned Scale = WideSizeInBits / RootSizeInBits;
   assert((WideSizeInBits % RootSizeInBits) == 0 &&
  "Unexpected subvector extraction");



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] 68eee55 - [mlir][Linalg] Address missed review item

2021-01-25 Thread Nicolas Vasilache via llvm-branch-commits

Author: Nicolas Vasilache
Date: 2021-01-25T13:47:44Z
New Revision: 68eee55ce6a41bb294d63886679b599883e96c3a

URL: 
https://github.com/llvm/llvm-project/commit/68eee55ce6a41bb294d63886679b599883e96c3a
DIFF: 
https://github.com/llvm/llvm-project/commit/68eee55ce6a41bb294d63886679b599883e96c3a.diff

LOG: [mlir][Linalg] Address missed review item

This revision addresses a remaining comment that was overlooked in 
https://reviews.llvm.org/D95243:
the pad hoisting transformation is made to additionally bail out on side 
effecting ops other than LoopLikeOps.

Added: 


Modified: 
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir

Removed: 




diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp 
b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index 7f1ead8ca386..9ca1f6da43f6 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -342,6 +342,8 @@ void mlir::linalg::hoistRedundantVectorTransfers(FuncOp 
func) {
 ///   3. There exists an op with a region that is dominated by
 ///   `outermostEnclosingForOp` and that isn't a LoopLikeInterface or a
 ///LinalgOp.
+///   3. There exists an op with side effects that is dominated by
+///`outermostEnclosingForOp` and that isn't a LoopLikeInterface.
 ///
 /// While ensuring prerequisites:
 ///   1. Fill the `backwardSlice` to contain the topologically sorted ops
@@ -383,6 +385,21 @@ hoistPaddingOnTensorsPrerequisites(linalg::SimplePadOp 
simplePadOp, int nLevels,
 return domInfo.dominates(outermostEnclosingForOp, op);
   });
 
+  #if 0
+
+  // Bail on any op with a region that is not a LoopLikeInterface or a 
LinalgOp.
+  // Bail on any op with side effects that is not a LoopLikeInterface.
+  if (llvm::any_of(backwardSlice, [](Operation *op) {
+if (isa(op))
+  return false;
+if (!MemoryEffectOpInterface::hasNoEffect(op))
+  return true;
+return op->getNumRegions() > 0 && !isa(op);
+  }))
+return failure();
+
+  #else
+
   // Bail on any op with a region that is not a LoopLikeInterface or a 
LinalgOp.
   if (llvm::any_of(backwardSlice, [](Operation *op) {
 return op->getNumRegions() > 0 && !isa(op) &&
@@ -390,6 +407,8 @@ hoistPaddingOnTensorsPrerequisites(linalg::SimplePadOp 
simplePadOp, int nLevels,
   }))
 return failure();
 
+  #endif
+
   // Filter out the loops whose induction variable is not used to compute the
   // padded result. As a first approximation, just look for IVs that have no 
use
   // in the backwardSlice.

diff  --git a/mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir 
b/mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir
index e4121083e240..1291b5c990df 100644
--- a/mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir
+++ b/mlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir
@@ -1,4 +1,5 @@
-// RUN: mlir-opt %s -test-linalg-transform-patterns=test-tile-and-pad-pattern 
-canonicalize | FileCheck %s
+// RUN: mlir-opt %s -test-linalg-transform-patterns=test-tile-and-pad-pattern 
-canonicalize
+//| FileCheck %s
 
 // CHECK-LABEL: func @matmul_tensors(
 // CHECK-SAME:%[[TA:[0-9a-z]+]]: tensor



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] d462aa5 - [clang] Fix a nullptr dereference bug on invalid code

2021-01-25 Thread Adam Czachorowski via llvm-branch-commits

Author: Adam Czachorowski
Date: 2021-01-25T15:02:25+01:00
New Revision: d462aa5a619ab9fdf8b024e48c19bc8820fe8781

URL: 
https://github.com/llvm/llvm-project/commit/d462aa5a619ab9fdf8b024e48c19bc8820fe8781
DIFF: 
https://github.com/llvm/llvm-project/commit/d462aa5a619ab9fdf8b024e48c19bc8820fe8781.diff

LOG: [clang] Fix a nullptr dereference bug on invalid code

When working with invalid code, we would try to dereference a nullptr
while deducing template arguments in some dependend code operating on a
lambda with invalid return type.

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

Added: 
clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp

Modified: 
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index d3d6df5e0064..dc1e0ef60cac 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4189,6 +4189,9 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl 
*D,
   for (unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
OldIdx != NumOldParams; ++OldIdx) {
 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
+if (!OldParam)
+  return nullptr;
+
 LocalInstantiationScope *Scope = SemaRef.CurrentInstantiationScope;
 
 Optional NumArgumentsInExpansion;

diff  --git a/clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp 
b/clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp
new file mode 100644
index ..c783ff50
--- /dev/null
+++ b/clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang -fsyntax-only -std=c++17 %s -Xclang -verify
+
+// The important part is that we do not crash.
+
+template T declval();
+
+template 
+auto Call(T x) -> decltype(declval()(0)) {} // expected-note{{candidate 
template ignored}}
+
+class Status {};
+
+void fun() {
+  // The Status() (instead of Status) here used to cause a crash.
+  Call([](auto x) -> Status() {}); // expected-error{{function cannot return 
function type 'Status ()}}
+  // expected-error@-1{{no matching function for call to 'Call'}}
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] 52e2552 - [mlir][Linalg] Fix incorrect erase order

2021-01-25 Thread Nicolas Vasilache via llvm-branch-commits

Author: Nicolas Vasilache
Date: 2021-01-25T14:04:06Z
New Revision: 52e25523a98f1f6c0afeba7f29308b02761d8017

URL: 
https://github.com/llvm/llvm-project/commit/52e25523a98f1f6c0afeba7f29308b02761d8017
DIFF: 
https://github.com/llvm/llvm-project/commit/52e25523a98f1f6c0afeba7f29308b02761d8017.diff

LOG: [mlir][Linalg] Fix incorrect erase order

Added: 


Modified: 
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp

Removed: 




diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp 
b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index 9ca1f6da43f6..5c67c8e61829 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -595,11 +595,14 @@ LogicalResult 
mlir::linalg::hoistPaddingOnTensors(SimplePadOp &simplePadOp,
   b.create(loc, simplePadOp.getResultType(), packedTensor,
 offsets, sizes, strides)
   ->getResult(0));
-  simplePadOp.erase();
+
+  Operation *toErase = simplePadOp;
 
   // Make the newly cloned `simplePadOp` available to the caller.
   simplePadOp =
   cast(bvm.lookup(simplePadOp.result()).getDefiningOp());
 
+  toErase->erase();
+
   return success();
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 7163aa9 - [NFC] Fix title comment typo and provide description for LLJIT example.

2021-01-25 Thread via llvm-branch-commits

Author: xgupta
Date: 2021-01-25T19:46:02+05:30
New Revision: 7163aa999060f7c524a98024550c5c0cd99c2b4c

URL: 
https://github.com/llvm/llvm-project/commit/7163aa999060f7c524a98024550c5c0cd99c2b4c
DIFF: 
https://github.com/llvm/llvm-project/commit/7163aa999060f7c524a98024550c5c0cd99c2b4c.diff

LOG: [NFC] Fix title comment typo and provide description for LLJIT example.

Added: 


Modified: 
llvm/examples/HowToUseLLJIT/HowToUseLLJIT.cpp

Removed: 




diff  --git a/llvm/examples/HowToUseLLJIT/HowToUseLLJIT.cpp 
b/llvm/examples/HowToUseLLJIT/HowToUseLLJIT.cpp
index c71c4d9293ab..170a89913605 100644
--- a/llvm/examples/HowToUseLLJIT/HowToUseLLJIT.cpp
+++ b/llvm/examples/HowToUseLLJIT/HowToUseLLJIT.cpp
@@ -1,10 +1,28 @@
-//===-- examples/HowToUseJIT/HowToUseJIT.cpp - An example use of the JIT 
--===//
+//===--- HowToUseLLJIT.cpp - An example use of ORC-based LLJIT 
===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
+//
+//  This small program provides an example of how to quickly build a small
+//  module with a 'add1' function and use of IRBuilder to create add & return
+//  instructions.
+//
+// Goal:
+//  The goal of this snippet is to create in the memory
+//  the LLVM module consisting of a function as follow:
+//
+// int add1(int x) {
+//   return x+1;
+// }
+//  add1(42);
+//
+// then compile the module via LLJIT, then execute the 'add1'
+// function and return result to a driver, i.e. to a "host program".
+//
+//===--===//
 
 #include "llvm/ExecutionEngine/Orc/LLJIT.h"
 #include "llvm/IR/Function.h"



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] 05d5125 - [mlir] Generalize OpFoldResult usage in ops with offsets, sizes and operands.

2021-01-25 Thread Nicolas Vasilache via llvm-branch-commits

Author: Nicolas Vasilache
Date: 2021-01-25T14:17:03Z
New Revision: 05d5125d8a9ffa458ea2deff90eb73473db0047e

URL: 
https://github.com/llvm/llvm-project/commit/05d5125d8a9ffa458ea2deff90eb73473db0047e
DIFF: 
https://github.com/llvm/llvm-project/commit/05d5125d8a9ffa458ea2deff90eb73473db0047e.diff

LOG: [mlir] Generalize OpFoldResult usage in ops with offsets, sizes and 
operands.

This revision starts evolving the APIs to manipulate ops with offsets, sizes 
and operands towards a ValueOrAttr abstraction that is already used in folding 
under the name OpFoldResult.

The objective, in the future, is to allow such manipulations all the way to the 
level of ODS to avoid all the genuflexions involved in distinguishing between 
values and attributes for generic constant foldings.

Once this evolution is accepted, the next step will be a mechanical 
OpFoldResult -> ValueOrAttr.

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

Added: 


Modified: 
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/Interfaces/ViewLikeInterface.td
mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/lib/Dialect/StandardOps/Transforms/ExpandOps.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Linalg/fusion-sequence.mlir
mlir/test/Dialect/Linalg/promote.mlir
mlir/test/Dialect/Linalg/transform-patterns.mlir
mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir

Removed: 




diff  --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td 
b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index 1c21b1639b7e..08f2174886f7 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -1959,14 +1959,19 @@ def MemRefReinterpretCastOp:
   let builders = [
 // Build a ReinterpretCastOp with mixed static and dynamic entries.
 OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
-  "int64_t":$staticOffset, "ArrayRef":$staticSizes,
-  "ArrayRef":$staticStrides, "ValueRange":$offset,
-  "ValueRange":$sizes, "ValueRange":$strides,
+  "OpFoldResult":$offset, "ArrayRef":$sizes,
+  "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>,
-// Build a ReinterpretCastOp with all dynamic entries.
+// Build a ReinterpretCastOp with static entries.
 OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
-  "Value":$offset, "ValueRange":$sizes, "ValueRange":$strides,
+  "int64_t":$offset, "ArrayRef":$sizes,
+  "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>,
+// Build a ReinterpretCastOp with dynamic entries.
+OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
+  "Value":$offset, "ValueRange":$sizes,
+  "ValueRange":$strides,
+  CArg<"ArrayRef", "{}">:$attrs)>
   ];
 
   let extraClassDeclaration = extraBaseClassDeclaration # [{
@@ -2927,23 +2932,33 @@ def SubViewOp : BaseOpWithOffsetSizesAndStrides<
   let results = (outs AnyMemRef:$result);
 
   let builders = [
-// Build a SubViewOp with mixed static and dynamic entries.
-OpBuilderDAG<(ins "Value":$source, "ArrayRef":$staticOffsets,
-  "ArrayRef":$staticSizes, "ArrayRef":$staticStrides,
-  "ValueRange":$offsets, "ValueRange":$sizes, "ValueRange":$strides,
+// Build a SubViewOp with mixed static and dynamic entries and custom
+// result type. If the type passed is nullptr, it is inferred.
+OpBuilderDAG<(ins "Value":$source, "ArrayRef":$offsets,
+  "ArrayRef":$sizes, "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>,
-// Build a SubViewOp with all dynamic entries.
-OpBuilderDAG<(ins "Value":$source, "ValueRange":$offsets,
-  "ValueRange":$sizes, "ValueRange":$strides,
+// Build a SubViewOp with mixed static and dynamic entries and inferred
+// result type.
+OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
+  "ArrayRef":$offsets, "ArrayRef":$sizes,
+  "ArrayRef":$strides,
   CArg<"ArrayRef", "{}">:$attrs)>,
-// Build a SubViewOp with mixed static and dynamic entries
-// and custom result type.
+// Build a SubViewOp with static entries and custom result type. If the
+// type passed is nullptr, it is inferred.
+OpBuilderDAG<(ins "Value":$source, "ArrayRef":$offsets,
+  "ArrayRef":$sizes, "ArrayRef":$strides,
+  CArg<"ArrayRef", "{}">:$attrs)>,
+// Build a SubViewOp with static entries and inferred result type.
 OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
-  "ArrayRef":$staticOffsets, "ArrayRef":$staticSizes,
-  "ArrayRef":$staticStrides, "

[llvm-branch-commits] [llvm] 3201274 - [VPlan] Handle scalarized values in VPTransformState.

2021-01-25 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2021-01-25T14:21:56Z
New Revision: 3201274dea63abbac5467f3f992f0280cbf3b100

URL: 
https://github.com/llvm/llvm-project/commit/3201274dea63abbac5467f3f992f0280cbf3b100
DIFF: 
https://github.com/llvm/llvm-project/commit/3201274dea63abbac5467f3f992f0280cbf3b100.diff

LOG: [VPlan] Handle scalarized values in VPTransformState.

This patch adds plumbing to handle scalarized values directly in
VPTransformState.

Reviewed By: gilr

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

Added: 


Modified: 
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 




diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp 
b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9373d40458f4..ea0d7673edf6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7718,9 +7718,15 @@ void 
LoopVectorizationPlanner::executePlan(InnerLoopVectorizer &ILV,
 
   assert(BestVF.hasValue() && "Vectorization Factor is missing");
 
-  VPTransformState State{*BestVF, BestUF,  LI,
- DT,  ILV.Builder, ILV.VectorLoopValueMap,
- &ILV,CallbackILV};
+  VPTransformState State{*BestVF,
+ BestUF,
+ OrigLoop,
+ LI,
+ DT,
+ ILV.Builder,
+ ILV.VectorLoopValueMap,
+ &ILV,
+ CallbackILV};
   State.CFG.PrevBB = ILV.createVectorizedLoopSkeleton();
   State.TripCount = ILV.getOrCreateTripCount(nullptr);
   State.CanonicalIV = ILV.Induction;

diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp 
b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 120562b6db5f..b26399e0ae58 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -216,6 +216,27 @@ VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
   return It;
 }
 
+Value *VPTransformState::get(VPValue *Def, const VPIteration &Instance) {
+  if (!Def->getDef() && OrigLoop->isLoopInvariant(Def->getLiveInIRValue()))
+return Def->getLiveInIRValue();
+
+  if (hasScalarValue(Def, Instance))
+return Data.PerPartScalars[Def][Instance.Part][Instance.Lane];
+
+  if (hasVectorValue(Def, Instance.Part)) {
+assert(Data.PerPartOutput.count(Def));
+auto *VecPart = Data.PerPartOutput[Def][Instance.Part];
+if (!VecPart->getType()->isVectorTy()) {
+  assert(Instance.Lane == 0 && "cannot get lane > 0 for scalar");
+  return VecPart;
+}
+// TODO: Cache created scalar values.
+return Builder.CreateExtractElement(VecPart,
+Builder.getInt32(Instance.Lane));
+  }
+  return Callback.getOrCreateScalarValue(VPValue2Value[Def], Instance);
+}
+
 BasicBlock *
 VPBasicBlock::createEmptyBasicBlock(VPTransformState::CFGState &CFG) {
   // BB stands for IR BasicBlocks. VPBB stands for VPlan VPBasicBlocks.

diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h 
b/llvm/lib/Transforms/Vectorize/VPlan.h
index 8d907dbc857d..2cce127cd4ce 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -246,12 +246,12 @@ struct VPCallback {
 /// VPTransformState holds information passed down when "executing" a VPlan,
 /// needed for generating the output IR.
 struct VPTransformState {
-  VPTransformState(ElementCount VF, unsigned UF, LoopInfo *LI,
+  VPTransformState(ElementCount VF, unsigned UF, Loop *OrigLoop, LoopInfo *LI,
DominatorTree *DT, IRBuilder<> &Builder,
VectorizerValueMap &ValueMap, InnerLoopVectorizer *ILV,
VPCallback &Callback)
-  : VF(VF), UF(UF), Instance(), LI(LI), DT(DT), Builder(Builder),
-ValueMap(ValueMap), ILV(ILV), Callback(Callback) {}
+  : VF(VF), UF(UF), Instance(), OrigLoop(OrigLoop), LI(LI), DT(DT),
+Builder(Builder), ValueMap(ValueMap), ILV(ILV), Callback(Callback) {}
 
   /// The chosen Vectorization and Unroll Factors of the loop being vectorized.
   ElementCount VF;
@@ -269,6 +269,9 @@ struct VPTransformState {
 typedef SmallVector PerPartValuesTy;
 
 DenseMap PerPartOutput;
+
+using ScalarsPerPartValuesTy = SmallVector, 2>;
+DenseMap PerPartScalars;
   } Data;
 
   /// Get the generated Value for a given VPValue and a given Part. Note that
@@ -285,24 +288,21 @@ struct VPTransformState {
   }
 
   /// Get the generated Value for a given VPValue and given Part and Lane.
-  Value *get(VPValue *Def, const VPIteration &Instance) {
-// If the Def is managed directly by VPTransformState, extract the lane 
from
-// the relevant part. Note that currently only VPInstructions and external
-// defs are managed by VPTransformState. 

[llvm-branch-commits] [llvm] 3546b37 - [Doc][NFC] Fix Kaleidoscope links, typos and add blog posts for MCJIT

2021-01-25 Thread via llvm-branch-commits

Author: xgupta
Date: 2021-01-25T19:59:36+05:30
New Revision: 3546b372219db5c5f4004da6a0066bb9860d3d37

URL: 
https://github.com/llvm/llvm-project/commit/3546b372219db5c5f4004da6a0066bb9860d3d37
DIFF: 
https://github.com/llvm/llvm-project/commit/3546b372219db5c5f4004da6a0066bb9860d3d37.diff

LOG: [Doc][NFC] Fix Kaleidoscope links, typos and add blog posts for MCJIT

Added: 


Modified: 
llvm/docs/tutorial/LangImpl01.rst
llvm/docs/tutorial/LangImpl02.rst
llvm/docs/tutorial/LangImpl03.rst
llvm/docs/tutorial/LangImpl04.rst
llvm/docs/tutorial/LangImpl05.rst
llvm/docs/tutorial/LangImpl06.rst
llvm/docs/tutorial/LangImpl07.rst
llvm/docs/tutorial/LangImpl08.rst
llvm/docs/tutorial/LangImpl09.rst
llvm/docs/tutorial/LangImpl10.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst
llvm/examples/Kaleidoscope/MCJIT/README.txt
llvm/examples/Kaleidoscope/MCJIT/cached/README.txt
llvm/examples/Kaleidoscope/MCJIT/complete/README.txt
llvm/examples/Kaleidoscope/MCJIT/initial/README.txt
llvm/examples/Kaleidoscope/MCJIT/lazy/README.txt

Removed: 




diff  --git a/llvm/docs/tutorial/LangImpl01.rst 
b/llvm/docs/tutorial/LangImpl01.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl01.rst
+++ b/llvm/docs/tutorial/LangImpl01.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl02.rst 
b/llvm/docs/tutorial/LangImpl02.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl02.rst
+++ b/llvm/docs/tutorial/LangImpl02.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl03.rst 
b/llvm/docs/tutorial/LangImpl03.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl03.rst
+++ b/llvm/docs/tutorial/LangImpl03.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl04.rst 
b/llvm/docs/tutorial/LangImpl04.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl04.rst
+++ b/llvm/docs/tutorial/LangImpl04.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl05.rst 
b/llvm/docs/tutorial/LangImpl05.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl05.rst
+++ b/llvm/docs/tutorial/LangImpl05.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl06.rst 
b/llvm/docs/tutorial/LangImpl06.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl06.rst
+++ b/llvm/docs/tutorial/LangImpl06.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl07.rst 
b/llvm/docs/tutorial/LangImpl07.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl07.rst
+++ b/llvm/docs/tutorial/LangImpl07.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl08.rst 
b/llvm/docs/tutorial/LangImpl08.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl08.rst
+++ b/llvm/docs/tutorial/LangImpl08.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 =
 
-The Kaleidoscope Tutorial has `moved to another location 
`_ .
+The Kaleidoscope Tutorial has moved to :doc:`MyFirstLanguageFrontend/index`.

diff  --git a/llvm/docs/tutorial/LangImpl09.rst 
b/llvm/docs/tutorial/LangImpl09.rst
index defa9d7f216a..6b90634055a0 100644
--- a/llvm/docs/tutorial/LangImpl09.rst
+++ b/llvm/docs/tutorial/LangImpl09.rst
@@ -4,4 +4,4 @@
 Kaleidoscope Tutorial
 ==

[llvm-branch-commits] [clang] 0005438 - [clangd] Fix a crash when indexing invalid ObjC method declaration

2021-01-25 Thread Adam Czachorowski via llvm-branch-commits

Author: Adam Czachorowski
Date: 2021-01-25T15:43:11+01:00
New Revision: 00054382b95a9d95e2df6457e7fe1fca2323d287

URL: 
https://github.com/llvm/llvm-project/commit/00054382b95a9d95e2df6457e7fe1fca2323d287
DIFF: 
https://github.com/llvm/llvm-project/commit/00054382b95a9d95e2df6457e7fe1fca2323d287.diff

LOG: [clangd] Fix a crash when indexing invalid ObjC method declaration

This fix will make us not crash, but ideally we would handle this case
better.

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

Added: 


Modified: 
clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
clang/lib/Sema/SemaCodeComplete.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp 
b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
index 7e36cff7afa6..924cfd03cba7 100644
--- a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -1838,6 +1838,20 @@ TEST_F(SymbolCollectorTest, UndefOfModuleMacro) {
   EXPECT_THAT(TU.headerSymbols(), Not(Contains(QName("X";
 }
 
+TEST_F(SymbolCollectorTest, NoCrashOnObjCMethodCStyleParam) {
+  auto TU = TestTU::withCode(R"objc(
+@interface Foo
+- (void)fun:(bool)foo, bool bar;
+@end
+  )objc");
+  TU.ExtraArgs.push_back("-xobjective-c++");
+
+  TU.build();
+  // We mostly care about not crashing.
+  EXPECT_THAT(TU.headerSymbols(),
+  UnorderedElementsAre(QName("Foo"), QName("Foo::fun:")));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang

diff  --git a/clang/lib/Sema/SemaCodeComplete.cpp 
b/clang/lib/Sema/SemaCodeComplete.cpp
index d77c9e43a9bd..c2785fd60fc2 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -3529,9 +3529,11 @@ CodeCompletionString 
*CodeCompletionResult::createCodeCompletionStringForDecl(
 Result.AddTypedTextChunk("");
 }
 unsigned Idx = 0;
+// The extra Idx < Sel.getNumArgs() check is needed due to legacy C-style
+// method parameters.
 for (ObjCMethodDecl::param_const_iterator P = Method->param_begin(),
   PEnd = Method->param_end();
- P != PEnd; (void)++P, ++Idx) {
+ P != PEnd && Idx < Sel.getNumArgs(); (void)++P, ++Idx) {
   if (Idx > 0) {
 std::string Keyword;
 if (Idx > StartParameter)



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] 7e506b3 - [clangd] Allow diagnostics to be suppressed with configuration

2021-01-25 Thread Sam McCall via llvm-branch-commits

Author: Sam McCall
Date: 2021-01-25T15:59:07+01:00
New Revision: 7e506b30a1e1500c3b0b54fba88ea664bc4232e5

URL: 
https://github.com/llvm/llvm-project/commit/7e506b30a1e1500c3b0b54fba88ea664bc4232e5
DIFF: 
https://github.com/llvm/llvm-project/commit/7e506b30a1e1500c3b0b54fba88ea664bc4232e5.diff

LOG: [clangd] Allow diagnostics to be suppressed with configuration

This has been specifically requested:
  https://github.com/clangd/vscode-clangd/issues/114
and various issues can be addressed with this as a workaround, e.g.:
  https://github.com/clangd/clangd/issues/662

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

Added: 


Modified: 
clang-tools-extra/clangd/Config.h
clang-tools-extra/clangd/ConfigCompile.cpp
clang-tools-extra/clangd/ConfigFragment.h
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/Diagnostics.h
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/Config.h 
b/clang-tools-extra/clangd/Config.h
index 79e94ef6fe37..675e721c7e64 100644
--- a/clang-tools-extra/clangd/Config.h
+++ b/clang-tools-extra/clangd/Config.h
@@ -28,6 +28,7 @@
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
 #include 
 #include 
 
@@ -77,6 +78,12 @@ struct Config {
 llvm::Optional External;
   } Index;
 
+  /// Controls warnings and errors when parsing code.
+  struct {
+bool SuppressAll = false;
+llvm::StringSet<> Suppress;
+  } Diagnostics;
+
   /// Style of the codebase.
   struct {
 // Namespaces that should always be fully qualified, meaning no "using"

diff  --git a/clang-tools-extra/clangd/ConfigCompile.cpp 
b/clang-tools-extra/clangd/ConfigCompile.cpp
index 2040ea4649fe..f2e6d544e6c9 100644
--- a/clang-tools-extra/clangd/ConfigCompile.cpp
+++ b/clang-tools-extra/clangd/ConfigCompile.cpp
@@ -27,6 +27,7 @@
 #include "Config.h"
 #include "ConfigFragment.h"
 #include "ConfigProvider.h"
+#include "Diagnostics.h"
 #include "Features.inc"
 #include "TidyProvider.h"
 #include "support/Logger.h"
@@ -187,6 +188,7 @@ struct FragmentCompiler {
 compile(std::move(F.If));
 compile(std::move(F.CompileFlags));
 compile(std::move(F.Index));
+compile(std::move(F.Diagnostics));
 compile(std::move(F.ClangTidy));
   }
 
@@ -328,6 +330,27 @@ struct FragmentCompiler {
 });
   }
 
+  void compile(Fragment::DiagnosticsBlock &&F) {
+std::vector Normalized;
+for (const auto &Suppressed : F.Suppress) {
+  if (*Suppressed == "*") {
+Out.Apply.push_back([&](const Params &, Config &C) {
+  C.Diagnostics.SuppressAll = true;
+  C.Diagnostics.Suppress.clear();
+});
+return;
+  }
+  Normalized.push_back(normalizeSuppressedCode(*Suppressed));
+}
+if (!Normalized.empty())
+  Out.Apply.push_back([Normalized](const Params &, Config &C) {
+if (C.Diagnostics.SuppressAll)
+  return;
+for (llvm::StringRef N : Normalized)
+  C.Diagnostics.Suppress.insert(N);
+  });
+  }
+
   void compile(Fragment::StyleBlock &&F) {
 if (!F.FullyQualifiedNamespaces.empty()) {
   std::vector FullyQualifiedNamespaces;

diff  --git a/clang-tools-extra/clangd/ConfigFragment.h 
b/clang-tools-extra/clangd/ConfigFragment.h
index 0e4ce638fc72..c491ec5ee68c 100644
--- a/clang-tools-extra/clangd/ConfigFragment.h
+++ b/clang-tools-extra/clangd/ConfigFragment.h
@@ -181,6 +181,24 @@ struct Fragment {
   };
   IndexBlock Index;
 
+  /// Controls behavior of diagnostics (errors and warnings).
+  struct DiagnosticsBlock {
+/// Diagnostic codes that should be suppressed.
+///
+/// Valid values are:
+/// - *, to disable all diagnostics
+/// - diagnostic codes exposed by clangd (e.g unknown_type, 
-Wunused-result)
+/// - clang internal diagnostic codes (e.g. err_unknown_type)
+/// - warning categories (e.g. unused-result)
+/// - clang-tidy check names (e.g. bugprone-narrowing-conversions)
+///
+/// This is a simple filter. Diagnostics can be controlled in other ways
+/// (e.g. by disabling a clang-tidy check, or the -Wunused compile flag).
+/// This often has other advantages, such as skipping some analysis.
+std::vector> Suppress;
+  };
+  DiagnosticsBlock Diagnostics;
+
   // Describes the style of the codebase, beyond formatting.
   struct StyleBlock {
 // Namespaces that should always be fully qualified, meaning no "using"
@@ -195,6 +213,7 @@ struct Fragment {
   ///
   /// The settings are merged with any settings found in .clang-tidy
   /// configiration files with these ones taking precedence.
+  // FIXME: move this to Diagnostics.Tidy.
   s

[llvm-branch-commits] [llvm] 6e530a3 - [Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance checking

2021-01-25 Thread Jeroen Dobbelaere via llvm-branch-commits

Author: Jeroen Dobbelaere
Date: 2021-01-25T16:19:12+01:00
New Revision: 6e530a3dac0c41608bac30f12d59fa3cbca48c4a

URL: 
https://github.com/llvm/llvm-project/commit/6e530a3dac0c41608bac30f12d59fa3cbca48c4a
DIFF: 
https://github.com/llvm/llvm-project/commit/6e530a3dac0c41608bac30f12d59fa3cbca48c4a.diff

LOG: [Verifier] enable and limit llvm.experimental.noalias.scope.decl dominance 
checking

Checking the llvm.experimental.noalias.scope.decl dominance can be worstcase 
O(N^2).
Limit the dominance check to N=32.

Reviewed By: fhahn

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

Added: 


Modified: 
llvm/lib/IR/Verifier.cpp

Removed: 




diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 8d960770313b..a05c3ed200fd 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -116,7 +116,7 @@
 using namespace llvm;
 
 static cl::opt VerifyNoAliasScopeDomination(
-"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false),
+"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(true),
 cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical "
  "scopes are not dominating"));
 
@@ -5587,18 +5587,17 @@ void Verifier::verifyNoAliasScopeDecl() {
 } while (ItNext != NoAliasScopeDecls.end() &&
  GetScope(*ItNext) == CurScope);
 
-// [ItCurrent, ItNext[ represents the declarations for the same scope.
-// Ensure they are not dominating each other
-for (auto *I : llvm::make_range(ItCurrent, ItNext)) {
-  for (auto *J : llvm::make_range(ItCurrent, ItNext)) {
-if (I != J) {
-  Assert(!DT.dominates(I, J),
- "llvm.experimental.noalias.scope.decl dominates another one "
- "with the same scope",
- I);
-}
-  }
-}
+// [ItCurrent, ItNext) represents the declarations for the same scope.
+// Ensure they are not dominating each other.. but only if it is not too
+// expensive.
+if (ItNext - ItCurrent < 32)
+  for (auto *I : llvm::make_range(ItCurrent, ItNext))
+for (auto *J : llvm::make_range(ItCurrent, ItNext))
+  if (I != J)
+Assert(!DT.dominates(I, J),
+   "llvm.experimental.noalias.scope.decl dominates another one 
"
+   "with the same scope",
+   I);
 ItCurrent = ItNext;
   }
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 13f2aee - [X86][AVX] Generalize vperm2f128/vperm2i128 patterns to support all legal 256-bit vector types

2021-01-25 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-25T15:35:36Z
New Revision: 13f2aee7831c9bec17006a6d401008df541a121d

URL: 
https://github.com/llvm/llvm-project/commit/13f2aee7831c9bec17006a6d401008df541a121d
DIFF: 
https://github.com/llvm/llvm-project/commit/13f2aee7831c9bec17006a6d401008df541a121d.diff

LOG: [X86][AVX] Generalize vperm2f128/vperm2i128 patterns to support all legal 
256-bit vector types

Remove bitcasts to/from v4x64 types through vperm2f128/vperm2i128 ops to help 
improve shuffle combining and demanded vector elts folding.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86InstrSSE.td
llvm/test/CodeGen/X86/haddsub-2.ll
llvm/test/CodeGen/X86/masked_store_trunc.ll
llvm/test/CodeGen/X86/var-permute-256.ll
llvm/test/CodeGen/X86/vector-reduce-and-bool.ll
llvm/test/CodeGen/X86/vector-reduce-or-bool.ll
llvm/test/CodeGen/X86/vector-reduce-xor-bool.ll
llvm/test/CodeGen/X86/vector-shuffle-256-v16.ll
llvm/test/CodeGen/X86/vector-trunc.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ae73a32a5d9a..fc19800eda79 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -35436,7 +35436,6 @@ static SDValue combineX86ShuffleChain(ArrayRef 
Inputs, SDValue Root,
 DL, 256);
 }
 
-MVT ShuffleVT = (FloatDomain ? MVT::v4f64 : MVT::v4i64);
 if (Depth == 0 && Root.getOpcode() == X86ISD::VPERM2X128)
   return SDValue(); // Nothing to do!
 
@@ -35449,12 +35448,9 @@ static SDValue 
combineX86ShuffleChain(ArrayRef Inputs, SDValue Root,
   unsigned PermMask = 0;
   PermMask |= ((BaseMask[0] < 0 ? 0x8 : (BaseMask[0] & 1)) << 0);
   PermMask |= ((BaseMask[1] < 0 ? 0x8 : (BaseMask[1] & 1)) << 4);
-
-  Res = CanonicalizeShuffleInput(ShuffleVT, V1);
-  Res = DAG.getNode(X86ISD::VPERM2X128, DL, ShuffleVT, Res,
-DAG.getUNDEF(ShuffleVT),
-DAG.getTargetConstant(PermMask, DL, MVT::i8));
-  return DAG.getBitcast(RootVT, Res);
+  return DAG.getNode(
+  X86ISD::VPERM2X128, DL, RootVT, CanonicalizeShuffleInput(RootVT, V1),
+  DAG.getUNDEF(RootVT), DAG.getTargetConstant(PermMask, DL, MVT::i8));
 }
 
 if (Depth == 0 && Root.getOpcode() == X86ISD::SHUF128)
@@ -35470,14 +35466,12 @@ static SDValue 
combineX86ShuffleChain(ArrayRef Inputs, SDValue Root,
 unsigned PermMask = 0;
 PermMask |= ((BaseMask[0] & 3) << 0);
 PermMask |= ((BaseMask[1] & 3) << 4);
-
 SDValue LHS = isInRange(BaseMask[0], 0, 2) ? V1 : V2;
 SDValue RHS = isInRange(BaseMask[1], 0, 2) ? V1 : V2;
-Res = DAG.getNode(X86ISD::VPERM2X128, DL, ShuffleVT,
-  CanonicalizeShuffleInput(ShuffleVT, LHS),
-  CanonicalizeShuffleInput(ShuffleVT, RHS),
+return DAG.getNode(X86ISD::VPERM2X128, DL, RootVT,
+  CanonicalizeShuffleInput(RootVT, LHS),
+  CanonicalizeShuffleInput(RootVT, RHS),
   DAG.getTargetConstant(PermMask, DL, MVT::i8));
-return DAG.getBitcast(RootVT, Res);
   }
 }
   }
@@ -37323,11 +37317,26 @@ static SDValue combineTargetShuffle(SDValue N, 
SelectionDAG &DAG,
 return SDValue();
   }
   case X86ISD::VPERM2X128: {
+// Fold vperm2x128(bitcast(x),bitcast(y),c) -> bitcast(vperm2x128(x,y,c)).
+SDValue LHS = N->getOperand(0);
+SDValue RHS = N->getOperand(1);
+if (LHS.getOpcode() == ISD::BITCAST &&
+(RHS.getOpcode() == ISD::BITCAST || RHS.isUndef())) {
+  EVT SrcVT = LHS.getOperand(0).getValueType();
+  if (RHS.isUndef() || SrcVT == RHS.getOperand(0).getValueType()) {
+return DAG.getBitcast(VT, DAG.getNode(X86ISD::VPERM2X128, DL, SrcVT,
+  DAG.getBitcast(SrcVT, LHS),
+  DAG.getBitcast(SrcVT, RHS),
+  N->getOperand(2)));
+  }
+}
+
+// Fold vperm2x128(op(),op()) -> op(vperm2x128(),vperm2x128()).
 if (SDValue Res = canonicalizeLaneShuffleWithRepeatedOps(N, DAG, DL))
-return Res;
+  return Res;
 
-// Combine vperm2x128 subvector shuffle with an inner concat pattern.
-// vperm2x128(concat(X,Y),concat(Z,W)) --> concat X,Y etc.
+// Fold vperm2x128 subvector shuffle with an inner concat pattern.
+// vperm2x128(concat(X,Y),concat(Z,W)) --> concat X,Y etc.  
 auto FindSubVector128 = [&](unsigned Idx) {
   if (Idx > 3)
 return SDValue();

diff  --git a/llvm/lib/Target/X86/X86InstrSSE.td 
b/llvm/lib/Target/X86/X86InstrSSE.td
index 071c638077b2..7cf555748c46 100644
--- a/llvm/lib/Target/X86/X86InstrSSE.td
+++ b/llvm/lib/Target/X86/X86InstrSSE.td
@@ -7287,16 +7287,12 

[llvm-branch-commits] [llvm] 3b5d36e - [Verifier] disable llvm.experimental.noalias.scope.decl dominance check.

2021-01-25 Thread Jeroen Dobbelaere via llvm-branch-commits

Author: Jeroen Dobbelaere
Date: 2021-01-25T16:43:08+01:00
New Revision: 3b5d36ece21f9baf96d82944b0165cb352443bee

URL: 
https://github.com/llvm/llvm-project/commit/3b5d36ece21f9baf96d82944b0165cb352443bee
DIFF: 
https://github.com/llvm/llvm-project/commit/3b5d36ece21f9baf96d82944b0165cb352443bee.diff

LOG: [Verifier] disable llvm.experimental.noalias.scope.decl dominance check.

This was enabled in https://reviews.llvm.org/D95335 but it breaks the stage2 
fuchsia build
(See http://lab.llvm.org:8011/#/builders/98/builds/4105/steps/9/logs/stdio)

Added: 


Modified: 
llvm/lib/IR/Verifier.cpp

Removed: 




diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index a05c3ed200fd..2b12e656c45e 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -116,7 +116,7 @@
 using namespace llvm;
 
 static cl::opt VerifyNoAliasScopeDomination(
-"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(true),
+"verify-noalias-scope-decl-dom", cl::Hidden, cl::init(false),
 cl::desc("Ensure that llvm.experimental.noalias.scope.decl for identical "
  "scopes are not dominating"));
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] b45020c - [LLDB] Remove leftovers and typos from RegisterInfos_arm64_sve.h

2021-01-25 Thread Muhammad Omair Javaid via llvm-branch-commits

Author: Muhammad Omair Javaid
Date: 2021-01-25T20:48:15+05:00
New Revision: b45020cf63f6f3a1de0f8d2b8be3c527f6cbdfd5

URL: 
https://github.com/llvm/llvm-project/commit/b45020cf63f6f3a1de0f8d2b8be3c527f6cbdfd5
DIFF: 
https://github.com/llvm/llvm-project/commit/b45020cf63f6f3a1de0f8d2b8be3c527f6cbdfd5.diff

LOG: [LLDB] Remove leftovers and typos from RegisterInfos_arm64_sve.h

This patch removes a couple of left-overs and a typo from
RegisterInfos_arm64_sve.h and RegisterInfoPOSIX_arm64.h.

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
index 1cbed5acb41c..2929f2009dd9 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -85,7 +85,7 @@ class RegisterInfoPOSIX_arm64
 
   size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
 
-  uint32_t ConfigureVectorRegisterInfos(uint32_t mode);
+  uint32_t ConfigureVectorRegisterInfos(uint32_t sve_vq);
 
   bool VectorSizeIsValid(uint32_t vq) {
 if (vq >= eVectorQuadwordAArch64 && vq <= eVectorQuadwordAArch64SVEMax)

diff  --git a/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h 
b/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h
index ea43ef8fe457..9551db7e8ebf 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h
@@ -9,9 +9,6 @@
 #ifdef DECLARE_REGISTER_INFOS_ARM64_STRUCT
 
 enum {
-  sve_fpsr = fpu_fpsr,
-  sve_fpcr = fpu_fpcr,
-
   sve_vg = exc_far,
 
   sve_z0,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] 2fd4d92 - [LLDB] Define AUXV_AT_HWCAP2 in AuxVector.h

2021-01-25 Thread Muhammad Omair Javaid via llvm-branch-commits

Author: Muhammad Omair Javaid
Date: 2021-01-25T20:48:16+05:00
New Revision: 2fd4d923a826c9563d587e1dafefe41b461ef3b8

URL: 
https://github.com/llvm/llvm-project/commit/2fd4d923a826c9563d587e1dafefe41b461ef3b8
DIFF: 
https://github.com/llvm/llvm-project/commit/2fd4d923a826c9563d587e1dafefe41b461ef3b8.diff

LOG: [LLDB] Define AUXV_AT_HWCAP2 in AuxVector.h

This patch defines AUXV_AT_HWCAP2 for accessing Aux extensions.

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/AuxVector.cpp
lldb/source/Plugins/Process/Utility/AuxVector.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/AuxVector.cpp 
b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
index 685d9d0824f6..c4f45f759a33 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.cpp
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
@@ -82,6 +82,7 @@ const char *AuxVector::GetEntryName(EntryType type) const {
 case ENTRY_NAME(AUXV_AT_SECURE); break;
 case ENTRY_NAME(AUXV_AT_BASE_PLATFORM);  break;
 case ENTRY_NAME(AUXV_AT_RANDOM); break;
+case ENTRY_NAME(AUXV_AT_HWCAP2); break;
 case ENTRY_NAME(AUXV_AT_EXECFN); break;
 case ENTRY_NAME(AUXV_AT_SYSINFO);break;
 case ENTRY_NAME(AUXV_AT_SYSINFO_EHDR);   break;

diff  --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index c8c8b1249413..07a0010e198f 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -50,6 +50,7 @@ class AuxVector {
 AUXV_AT_SECURE = 23,///< Boolean, was exec setuid-like?
 AUXV_AT_BASE_PLATFORM = 24, ///< String identifying real platforms.
 AUXV_AT_RANDOM = 25,///< Address of 16 random bytes.
+AUXV_AT_HWCAP2 = 26,///< Extension of AT_HWCAP.
 AUXV_AT_EXECFN = 31,///< Filename of executable.
 AUXV_AT_SYSINFO = 32, ///< Pointer to the global system page used for 
system
   /// calls and other nice things.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] e9a3fac - [LLDB] Skip TestPlatformProcessConnect on arm/aarch64 buildbot

2021-01-25 Thread Muhammad Omair Javaid via llvm-branch-commits

Author: Muhammad Omair Javaid
Date: 2021-01-25T20:48:16+05:00
New Revision: e9a3fac76cf199d902a746c2b2fc308dfe0ade26

URL: 
https://github.com/llvm/llvm-project/commit/e9a3fac76cf199d902a746c2b2fc308dfe0ade26
DIFF: 
https://github.com/llvm/llvm-project/commit/e9a3fac76cf199d902a746c2b2fc308dfe0ade26.diff

LOG: [LLDB] Skip TestPlatformProcessConnect on arm/aarch64 buildbot

TestPlatformProcessConnect is randomly failing on LLDB Arm/AArch64
buildbot. I am disabling it temporarily untill problem is fixed.

Added: 


Modified: 

lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
 
b/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
index 8ddab260b494..74b5f2e16eeb 100644
--- 
a/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
+++ 
b/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
@@ -12,6 +12,7 @@ class 
TestPlatformProcessConnect(gdbremote_testcase.GdbRemoteTestCaseBase):
 @expectedFailureAll(hostoslist=["windows"], triple='.*-android')
 @skipIfWindows # lldb-server does not terminate correctly
 @skipIfDarwin # lldb-server not found correctly
+@skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Fails randomly
 def test_platform_process_connect(self):
 self.build()
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] f807825 - Revert "[JITLink] Enable exception handling for ELF."

2021-01-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-25T11:00:38-05:00
New Revision: f80782590c6cdba88e0072792b238ae8a5a4223d

URL: 
https://github.com/llvm/llvm-project/commit/f80782590c6cdba88e0072792b238ae8a5a4223d
DIFF: 
https://github.com/llvm/llvm-project/commit/f80782590c6cdba88e0072792b238ae8a5a4223d.diff

LOG: Revert "[JITLink] Enable exception handling for ELF."

This reverts commit 6884fbc2c4fb46d0528c02d16d510f4f725fac11.
Breaks tests on Windows: http://45.33.8.238/win/31981/step_11.txt

Added: 


Modified: 
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp

Removed: 
llvm/test/ExecutionEngine/JITLink/X86/ELF_ehframe_basic.s



diff  --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp 
b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
index 3602601287f4..8b730bc23ce0 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -119,10 +119,9 @@ Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B,
 }
 
 EHFrameEdgeFixer::EHFrameEdgeFixer(StringRef EHFrameSectionName,
-   unsigned PointerSize, Edge::Kind Delta64,
-   Edge::Kind Delta32, Edge::Kind NegDelta32)
-: EHFrameSectionName(EHFrameSectionName), PointerSize(PointerSize),
-  Delta64(Delta64), Delta32(Delta32), NegDelta32(NegDelta32) {}
+   Edge::Kind Delta64, Edge::Kind NegDelta32)
+: EHFrameSectionName(EHFrameSectionName), Delta64(Delta64),
+  NegDelta32(NegDelta32) {}
 
 Error EHFrameEdgeFixer::operator()(LinkGraph &G) {
   auto *EHFrame = G.findSectionByName(EHFrameSectionName);
@@ -135,11 +134,6 @@ Error EHFrameEdgeFixer::operator()(LinkGraph &G) {
 return Error::success();
   }
 
-  // Check that we support the graph's pointer size.
-  if (G.getPointerSize() != 4 && G.getPointerSize() != 8)
-return make_error(
-"EHFrameEdgeFixer only supports 32 and 64 bit targets");
-
   LLVM_DEBUG({
 dbgs() << "EHFrameEdgeFixer: Processing " << EHFrameSectionName << "...\n";
   });
@@ -264,6 +258,7 @@ Error EHFrameEdgeFixer::processBlock(ParseContext &PC, 
Block &B) {
 Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B,
size_t RecordOffset, size_t RecordLength,
size_t CIEDeltaFieldOffset) {
+  using namespace dwarf;
 
   LLVM_DEBUG(dbgs() << "  Record is CIE\n");
 
@@ -334,12 +329,11 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, 
Block &B,
   uint8_t LSDAPointerEncoding;
   if (auto Err = RecordReader.readInteger(LSDAPointerEncoding))
 return Err;
-  if (!isSupportedPointerEncoding(LSDAPointerEncoding))
+  if (LSDAPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr))
 return make_error(
 "Unsupported LSDA pointer encoding " +
 formatv("{0:x2}", LSDAPointerEncoding) + " in CIE at " +
 formatv("{0:x16}", CIESymbol.getAddress()));
-  CIEInfo.LSDAPointerEncoding = LSDAPointerEncoding;
   break;
 }
 case 'P': {
@@ -347,8 +341,7 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block 
&B,
   if (auto Err = RecordReader.readInteger(PersonalityPointerEncoding))
 return Err;
   if (PersonalityPointerEncoding !=
-  (dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
-   dwarf::DW_EH_PE_sdata4))
+  (DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4))
 return make_error(
 "Unspported personality pointer "
 "encoding " +
@@ -363,12 +356,12 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, 
Block &B,
   uint8_t FDEPointerEncoding;
   if (auto Err = RecordReader.readInteger(FDEPointerEncoding))
 return Err;
-  if (!isSupportedPointerEncoding(FDEPointerEncoding))
+  if (FDEPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr))
 return make_error(
-"Unsupported FDE pointer encoding " +
+"Unsupported FDE address pointer "
+"encoding " +
 formatv("{0:x2}", FDEPointerEncoding) + " in CIE at " +
 formatv("{0:x16}", CIESymbol.getAddress()));
-  CIEInfo.FDEPointerEncoding = FDEPointerEncoding;
   break;
 }
 default:
@@ -452,13 +445,11 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, 
Block &B,
 JITTargetAddress PCBeginFieldOffset = RecordReader.getOffset();
 auto PCEdgeItr = BlockEdges.find(RecordOffset + PCBeginFieldOffset);
 if (PCEdgeItr == BlockEdges.end()) {
-  auto PCBeginPtrInfo =
-  readEncodedPointer(CIEInfo->FDEPointerEncoding,
- 

[llvm-branch-commits] [llvm] 558b3bb - [AMDGPU][MC] Improved errors handling for SDWA operands

2021-01-25 Thread Dmitry Preobrazhensky via llvm-branch-commits

Author: Dmitry Preobrazhensky
Date: 2021-01-25T19:02:53+03:00
New Revision: 558b3bbb5b67387c5a29c1eb6548be81c1588adc

URL: 
https://github.com/llvm/llvm-project/commit/558b3bbb5b67387c5a29c1eb6548be81c1588adc
DIFF: 
https://github.com/llvm/llvm-project/commit/558b3bbb5b67387c5a29c1eb6548be81c1588adc.diff

LOG: [AMDGPU][MC] Improved errors handling for SDWA operands

Reviewers: rampitec

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

Added: 


Modified: 
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/test/MC/AMDGPU/gfx10_err_pos.s

Removed: 




diff  --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp 
b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index 5146271befff..035278135cef 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -1297,7 +1297,8 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
   parseNamedBit(const char *Name, OperandVector &Operands,
 AMDGPUOperand::ImmTy ImmTy = AMDGPUOperand::ImmTyNone);
   OperandMatchResultTy parseStringWithPrefix(StringRef Prefix,
- StringRef &Value);
+ StringRef &Value,
+ SMLoc &StringLoc);
 
   bool isModifier();
   bool isOperandModifier(const AsmToken &Token, const AsmToken &NextToken) 
const;
@@ -5099,11 +5100,15 @@ static void addOptionalImmOperand(
 }
 
 OperandMatchResultTy
-AMDGPUAsmParser::parseStringWithPrefix(StringRef Prefix, StringRef &Value) {
+AMDGPUAsmParser::parseStringWithPrefix(StringRef Prefix,
+   StringRef &Value,
+   SMLoc &StringLoc) {
   if (!trySkipId(Prefix, AsmToken::Colon))
 return MatchOperand_NoMatch;
 
-  return parseId(Value) ? MatchOperand_Success : MatchOperand_ParseFail;
+  StringLoc = getLoc();
+  return parseId(Value, "expected an identifier") ? MatchOperand_Success
+  : MatchOperand_ParseFail;
 }
 
 
//===--===//
@@ -7523,7 +7528,8 @@ AMDGPUAsmParser::parseSDWASel(OperandVector &Operands, 
StringRef Prefix,
   StringRef Value;
   OperandMatchResultTy res;
 
-  res = parseStringWithPrefix(Prefix, Value);
+  SMLoc StringLoc;
+  res = parseStringWithPrefix(Prefix, Value, StringLoc);
   if (res != MatchOperand_Success) {
 return res;
   }
@@ -7540,6 +7546,7 @@ AMDGPUAsmParser::parseSDWASel(OperandVector &Operands, 
StringRef Prefix,
 .Default(0x);
 
   if (Int == 0x) {
+Error(StringLoc, "invalid " + Twine(Prefix) + " value");
 return MatchOperand_ParseFail;
   }
 
@@ -7555,7 +7562,8 @@ AMDGPUAsmParser::parseSDWADstUnused(OperandVector 
&Operands) {
   StringRef Value;
   OperandMatchResultTy res;
 
-  res = parseStringWithPrefix("dst_unused", Value);
+  SMLoc StringLoc;
+  res = parseStringWithPrefix("dst_unused", Value, StringLoc);
   if (res != MatchOperand_Success) {
 return res;
   }
@@ -7568,6 +7576,7 @@ AMDGPUAsmParser::parseSDWADstUnused(OperandVector 
&Operands) {
 .Default(0x);
 
   if (Int == 0x) {
+Error(StringLoc, "invalid dst_unused value");
 return MatchOperand_ParseFail;
   }
 

diff  --git a/llvm/test/MC/AMDGPU/gfx10_err_pos.s 
b/llvm/test/MC/AMDGPU/gfx10_err_pos.s
index cb4f9ae91153..b0cf97921daa 100644
--- a/llvm/test/MC/AMDGPU/gfx10_err_pos.s
+++ b/llvm/test/MC/AMDGPU/gfx10_err_pos.s
@@ -483,6 +483,24 @@ v_mov_b32_sdwa v1, sext(u)
 // CHECK-NEXT:{{^}}v_mov_b32_sdwa v1, sext(u)
 // CHECK-NEXT:{{^}}^
 
+//==
+// expected an identifier
+
+v_mov_b32_sdwa v5, v1 dst_sel:
+// CHECK: error: expected an identifier
+// CHECK-NEXT:{{^}}v_mov_b32_sdwa v5, v1 dst_sel:
+// CHECK-NEXT:{{^}}  ^
+
+v_mov_b32_sdwa v5, v1 dst_sel:0
+// CHECK: error: expected an identifier
+// CHECK-NEXT:{{^}}v_mov_b32_sdwa v5, v1 dst_sel:0
+// CHECK-NEXT:{{^}}  ^
+
+v_mov_b32_sdwa v5, v1 dst_sel:DWORD dst_unused:[UNUSED_PAD]
+// CHECK: error: expected an identifier
+// CHECK-NEXT:{{^}}v_mov_b32_sdwa v5, v1 dst_sel:DWORD dst_unused:[UNUSED_PAD]
+// CHECK-NEXT:{{^}}   ^
+
 
//==
 // expected an opening square bracket
 
@@ -623,6 +641,22 @@ s_waitcnt vmcnt(0) & expcnt(0) x(0)
 // CHECK-NEXT:{{^}}s_waitcnt vmcnt(0) & expcnt(0) x(0)
 // CHECK-NEXT:{{^}}   ^
 
+//==
+// invalid dst_sel value
+
+v_mov_b32_sdwa v5, v1 dst_sel:WORD
+// CHECK: error: invalid dst_sel 

[llvm-branch-commits] [openmp] 95f0d1e - [libomptarget] Compile with older cuda, revert D95274

2021-01-25 Thread Jon Chesterfield via llvm-branch-commits

Author: Jon Chesterfield
Date: 2021-01-25T16:12:56Z
New Revision: 95f0d1edafe3e52a4057768f8cde5d55faf39d16

URL: 
https://github.com/llvm/llvm-project/commit/95f0d1edafe3e52a4057768f8cde5d55faf39d16
DIFF: 
https://github.com/llvm/llvm-project/commit/95f0d1edafe3e52a4057768f8cde5d55faf39d16.diff

LOG: [libomptarget] Compile with older cuda, revert D95274

[libomptarget] Compile with older cuda, revert D95274

Fixes regression reported in comments of D95274.

Reviewed By: jdoerfert

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

Added: 


Modified: 
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
openmp/libomptarget/plugins/cuda/src/rtl.cpp

Removed: 




diff  --git a/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp 
b/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
index ad67fe95c77e..cc7bc42412f6 100644
--- a/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
+++ b/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
@@ -28,26 +28,26 @@ DLWRAP(cuFuncGetAttribute, 3);
 DLWRAP(cuGetErrorString, 2);
 DLWRAP(cuLaunchKernel, 11);
 
-DLWRAP(cuMemAlloc_v2, 2);
-DLWRAP(cuMemcpyDtoDAsync_v2, 4);
+DLWRAP(cuMemAlloc, 2);
+DLWRAP(cuMemcpyDtoDAsync, 4);
 
-DLWRAP(cuMemcpyDtoH_v2, 3);
-DLWRAP(cuMemcpyDtoHAsync_v2, 4);
-DLWRAP(cuMemcpyHtoD_v2, 3);
-DLWRAP(cuMemcpyHtoDAsync_v2, 4);
+DLWRAP(cuMemcpyDtoH, 3);
+DLWRAP(cuMemcpyDtoHAsync, 4);
+DLWRAP(cuMemcpyHtoD, 3);
+DLWRAP(cuMemcpyHtoDAsync, 4);
 
-DLWRAP(cuMemFree_v2, 1);
+DLWRAP(cuMemFree, 1);
 DLWRAP(cuModuleGetFunction, 3);
-DLWRAP(cuModuleGetGlobal_v2, 4);
+DLWRAP(cuModuleGetGlobal, 4);
 
 DLWRAP(cuModuleUnload, 1);
 DLWRAP(cuStreamCreate, 2);
-DLWRAP(cuStreamDestroy_v2, 1);
+DLWRAP(cuStreamDestroy, 1);
 DLWRAP(cuStreamSynchronize, 1);
 DLWRAP(cuCtxSetCurrent, 1);
-DLWRAP(cuDevicePrimaryCtxRelease_v2, 1);
+DLWRAP(cuDevicePrimaryCtxRelease, 1);
 DLWRAP(cuDevicePrimaryCtxGetState, 3);
-DLWRAP(cuDevicePrimaryCtxSetFlags_v2, 2);
+DLWRAP(cuDevicePrimaryCtxSetFlags, 2);
 DLWRAP(cuDevicePrimaryCtxRetain, 2);
 DLWRAP(cuModuleLoadDataEx, 5);
 

diff  --git a/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h 
b/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
index dd579a1f7490..832c26965144 100644
--- a/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
+++ b/openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
@@ -48,6 +48,18 @@ typedef enum CUctx_flags_enum {
   CU_CTX_SCHED_MASK = 0x07,
 } CUctx_flags;
 
+#define cuMemFree cuMemFree_v2
+#define cuMemAlloc cuMemAlloc_v2
+#define cuMemcpyDtoH cuMemcpyDtoH_v2
+#define cuMemcpyHtoD cuMemcpyHtoD_v2
+#define cuStreamDestroy cuStreamDestroy_v2
+#define cuModuleGetGlobal cuModuleGetGlobal_v2
+#define cuMemcpyDtoHAsync cuMemcpyDtoHAsync_v2
+#define cuMemcpyDtoDAsync cuMemcpyDtoDAsync_v2
+#define cuMemcpyHtoDAsync cuMemcpyHtoDAsync_v2
+#define cuDevicePrimaryCtxRelease cuDevicePrimaryCtxRelease_v2
+#define cuDevicePrimaryCtxSetFlags cuDevicePrimaryCtxSetFlags_v2
+
 CUresult cuCtxGetDevice(CUdevice *);
 CUresult cuDeviceGet(CUdevice *, int);
 CUresult cuDeviceGetAttribute(int *, CUdevice_attribute, CUdevice);
@@ -60,26 +72,26 @@ CUresult cuLaunchKernel(CUfunction, unsigned, unsigned, 
unsigned, unsigned,
 unsigned, unsigned, unsigned, CUstream, void **,
 void **);
 
-CUresult cuMemAlloc_v2(CUdeviceptr *, size_t);
-CUresult cuMemcpyDtoDAsync_v2(CUdeviceptr, CUdeviceptr, size_t, CUstream);
+CUresult cuMemAlloc(CUdeviceptr *, size_t);
+CUresult cuMemcpyDtoDAsync(CUdeviceptr, CUdeviceptr, size_t, CUstream);
 
-CUresult cuMemcpyDtoH_v2(void *, CUdeviceptr, size_t);
-CUresult cuMemcpyDtoHAsync_v2(void *, CUdeviceptr, size_t, CUstream);
-CUresult cuMemcpyHtoD_v2(CUdeviceptr, const void *, size_t);
-CUresult cuMemcpyHtoDAsync_v2(CUdeviceptr, const void *, size_t, CUstream);
+CUresult cuMemcpyDtoH(void *, CUdeviceptr, size_t);
+CUresult cuMemcpyDtoHAsync(void *, CUdeviceptr, size_t, CUstream);
+CUresult cuMemcpyHtoD(CUdeviceptr, const void *, size_t);
+CUresult cuMemcpyHtoDAsync(CUdeviceptr, const void *, size_t, CUstream);
 
-CUresult cuMemFree_v2(CUdeviceptr);
+CUresult cuMemFree(CUdeviceptr);
 CUresult cuModuleGetFunction(CUfunction *, CUmodule, const char *);
-CUresult cuModuleGetGlobal_v2(CUdeviceptr *, size_t *, CUmodule, const char *);
+CUresult cuModuleGetGlobal(CUdeviceptr *, size_t *, CUmodule, const char *);
 
 CUresult cuModuleUnload(CUmodule);
 CUresult cuStreamCreate(CUstream *, unsigned);
-CUresult cuStreamDestroy_v2(CUstream);
+CUresult cuStreamDestroy(CUstream);
 CUresult cuStreamSynchronize(CUstream);
 CUresult cuCtxSetCurrent(CUcontext);
-CUresult cuDevicePrimaryCtxRelease_v2(CUdevice);
+CUresult cuDevicePrimaryCtxRelease(CUdevice);
 CUresult cuDevicePrimaryCtxGetState(CUdevice, unsigned *, int *);
-CUresult cuDevicePrimaryCtxSetFlags_v2(CUdevice, unsigned);
+CUresult cuDevicePrimary

[llvm-branch-commits] [libcxx] 51faba3 - [libc++] Implement P0655R1 visit: Explicit Return Type for visit

2021-01-25 Thread Louis Dionne via llvm-branch-commits

Author: Ruslan Arutyunyan
Date: 2021-01-25T11:14:45-05:00
New Revision: 51faba35fd81fbd3af407a29c136895a718ccd96

URL: 
https://github.com/llvm/llvm-project/commit/51faba35fd81fbd3af407a29c136895a718ccd96
DIFF: 
https://github.com/llvm/llvm-project/commit/51faba35fd81fbd3af407a29c136895a718ccd96.diff

LOG: [libc++] Implement P0655R1 visit: Explicit Return Type for visit

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

Added: 
libcxx/test/std/utilities/variant/variant.visit/visit_return_type.pass.cpp

Modified: 
libcxx/docs/Cxx2aStatusPaperStatus.csv
libcxx/include/variant
libcxx/test/std/utilities/variant/variant.visit/robust_against_adl.pass.cpp
libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
libcxx/test/support/variant_test_helpers.h

Removed: 




diff  --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv 
b/libcxx/docs/Cxx2aStatusPaperStatus.csv
index efdcb1b67161..8991a03b2a5c 100644
--- a/libcxx/docs/Cxx2aStatusPaperStatus.csv
+++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv
@@ -59,7 +59,7 @@
 "`P0595R2 `__","CWG","P0595R2 
std::is_constant_evaluated()","San Diego","|Complete|","9.0"
 "`P0602R4 `__","LWG","variant and optional should 
propagate copy/move triviality","San Diego","|Complete|","8.0"
 "`P0608R3 `__","LWG","A sane variant converting 
constructor","San Diego","|Complete|","9.0"
-"`P0655R1 `__","LWG","visit: Explicit Return 
Type for visit","San Diego","* *",""
+"`P0655R1 `__","LWG","visit: Explicit Return 
Type for visit","San Diego","|Complete|","12.0"
 "`P0771R1 `__","LWG","std::function move 
constructor should be noexcept","San Diego","|Complete|","6.0"
 "`P0896R4 `__","LWG","The One Ranges Proposal","San 
Diego","* *",""
 "`P0899R1 `__","LWG","P0899R1 - LWG 3016 is not a 
defect","San Diego","|Nothing To Do|",""

diff  --git a/libcxx/include/variant b/libcxx/include/variant
index daa3dd2d71c6..cb46f09bdc06 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -169,6 +169,9 @@ namespace std {
   template 
   constexpr see below visit(Visitor&&, Variants&&...);
 
+  template 
+  constexpr R visit(Visitor&&, Variants&&...); // since C++20
+
   // 20.7.7, class monostate
   struct monostate;
 
@@ -583,6 +586,16 @@ struct __variant {
 __make_value_visitor(_VSTD::forward<_Visitor>(__visitor)),
 _VSTD::forward<_Vs>(__vs)...);
   }
+#if _LIBCPP_STD_VER > 17
+  template 
+  inline _LIBCPP_INLINE_VISIBILITY
+  static constexpr _Rp __visit_value(_Visitor&& __visitor,
+ _Vs&&... __vs) {
+return __visit_alt(
+__make_value_visitor<_Rp>(_VSTD::forward<_Visitor>(__visitor)),
+_VSTD::forward<_Vs>(__vs)...);
+  }
+#endif
 
 private:
   template 
@@ -605,12 +618,43 @@ private:
 _Visitor&& __visitor;
   };
 
+#if _LIBCPP_STD_VER > 17
+  template 
+  struct __value_visitor_return_type {
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _Rp operator()(_Alts&&... __alts) const {
+  __std_visit_exhaustive_visitor_check<
+  _Visitor,
+  decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
+  if constexpr (is_void_v<_Rp>) {
+_VSTD::__invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
+  _VSTD::forward<_Alts>(__alts).__value...);
+  }
+  else {
+return _VSTD::__invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
+ 
_VSTD::forward<_Alts>(__alts).__value...);
+  }
+}
+
+_Visitor&& __visitor;
+  };
+#endif
+
   template 
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
 return __value_visitor<_Visitor>{_VSTD::forward<_Visitor>(__visitor)};
   }
+
+#if _LIBCPP_STD_VER > 17
+  template 
+  inline _LIBCPP_INLINE_VISIBILITY
+  static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
+return __value_visitor_return_type<_Rp, 
_Visitor>{_VSTD::forward<_Visitor>(__visitor)};
+  }
 };
+#endif
 
 } // namespace __visitation
 
@@ -1594,18 +1638,37 @@ constexpr bool operator>=(const variant<_Types...>& 
__lhs,
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
-  using __variant_detail::__visitation::__variant;
-  bool __results[] = {__vs.valueless_by_exception()...};
-  for (bool __result : __results) {
-if (__result) {
+constexpr void __throw_if_valueless(_Visitor&& __visitor, _Vs&&... __vs) {
+  const bool __valueless = (... || __vs.valueless_by_exception());
+  if (__valueless) {
   __throw_bad_variant_access();
-}
   }
+}
+
+template 
+inline _LIBCPP

[llvm-branch-commits] [llvm] 17c3538 - Revert "Fix unused variable in CoroFrame.cpp when building Release with GCC 10"

2021-01-25 Thread Xun Li via llvm-branch-commits

Author: Xun Li
Date: 2021-01-25T08:37:45-08:00
New Revision: 17c3538aef656178b342573043eff328f5cf2673

URL: 
https://github.com/llvm/llvm-project/commit/17c3538aef656178b342573043eff328f5cf2673
DIFF: 
https://github.com/llvm/llvm-project/commit/17c3538aef656178b342573043eff328f5cf2673.diff

LOG: Revert "Fix unused variable in CoroFrame.cpp when building Release with 
GCC 10"

This reverts commit ff5e896425577f445ed080d88b582aab0896fba0.

Added: 


Modified: 
llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp 
b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 3f290f2f087b..cd5c1863bb3c 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1549,7 +1549,6 @@ static void rewritePHIs(BasicBlock &BB) {
 for (BasicBlock *Pred : Preds) {
   if (CatchSwitchInst *CS =
   dyn_cast(Pred->getTerminator())) {
-(void)CS;
 // CleanupPad with a CatchSwitch predecessor: therefore this is an
 // unwind destination that needs to be handle specially.
 assert(CS->getUnwindDest() == &BB);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] e123cd6 - [OpenCL] Refactor of targets OpenCL option settings

2021-01-25 Thread Anton Zabaznov via llvm-branch-commits

Author: Anton Zabaznov
Date: 2021-01-25T19:50:23+03:00
New Revision: e123cd674c0209c80bc6225bb9e3a2d1d2ee418b

URL: 
https://github.com/llvm/llvm-project/commit/e123cd674c0209c80bc6225bb9e3a2d1d2ee418b
DIFF: 
https://github.com/llvm/llvm-project/commit/e123cd674c0209c80bc6225bb9e3a2d1d2ee418b.diff

LOG: [OpenCL] Refactor of targets OpenCL option settings

Currently, there is some refactoring needed in existing interface of OpenCL 
option
settings to support OpenCL C 3.0. The problem is that OpenCL extensions and 
features
are not only determined by the target platform but also by the OpenCL version.
Also, there are core extensions/features which are supported unconditionally in
specific OpenCL C version. In fact, these rules are not being followed for all 
targets.
For example, there are some targets (as nvptx and r600) which don't support
OpenCL C 2.0 core features (nvptx.languageOptsOpenCL.cl, 
r600.languageOptsOpenCL.cl).

After the change there will be explicit differentiation between optional core 
and core
OpenCL features which allows giving diagnostics if target doesn't support any of
necessary core features for specific OpenCL version.

This patch also eliminates `OpenCLOptions` instance duplication from 
`TargetOptions`.
`OpenCLOptions` instance should take place in `Sema` as it's going to be 
modified
during parsing. Removing this duplication will also allow to generally simplify
`OpenCLOptions` class for parsing purposes.

Reviewed By: Anastasia

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

Added: 
clang/lib/Basic/OpenCLOptions.cpp

Modified: 
clang/include/clang/Basic/OpenCLExtensions.def
clang/include/clang/Basic/OpenCLOptions.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Basic/TargetOptions.h
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/AMDGPU.h
clang/lib/Basic/Targets/NVPTX.h
clang/lib/Basic/Targets/SPIR.h
clang/lib/Basic/Targets/X86.h
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Parse/ParsePragma.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Misc/nvptx.languageOptsOpenCL.cl
clang/test/Misc/r600.languageOptsOpenCL.cl

Removed: 




diff  --git a/clang/include/clang/Basic/OpenCLExtensions.def 
b/clang/include/clang/Basic/OpenCLExtensions.def
index 9353be1753b0..801916c3ab94 100644
--- a/clang/include/clang/Basic/OpenCLExtensions.def
+++ b/clang/include/clang/Basic/OpenCLExtensions.def
@@ -10,19 +10,25 @@
 //
 
//===--===//
 
-// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the
+// Macro OPENCLEXTNAME or OPENCL_GENERIC_EXTENSION can be defined to enumerate 
all
 // OpenCL extensions listed in this file.
 //
-// If the extensions are to be enumerated without the supported OpenCL version,
-// define OPENCLEXT(ext) where ext is the name of the extension.
-//
-// If the extensions are to be enumerated with supported OpenCL version,
-// define OPENCLEXT_INTERNAL(ext, avail, core) where
+// If extensions are to be enumerated with information about whether
+// an extension is core or optional core and minimum OpenCL version
+// when an extension becomes available,
+// define OPENCL_GENERIC_EXTENSION(ext, avail, core, opt) where
 //   ext - name of the extension or optional core feature.
 //   avail - minimum OpenCL version supporting it.
-//   core - minimum OpenCL version when the extension becomes optional core
-//  feature or core feature. ~0U indicates not a core feature or an
-//  optional core feature.
+//   core - OpenCL versions mask when the extension becomes core feature.
+//  0U indicates not a core feature.
+//   opt - OpenCL versions mask when the extension becomes optional core
+// feature. 0U indicates not a optional core feature.
+//
+// If extensions are to be enumerated without any information,
+// define OPENCLEXTNAME(ext) where ext is the name of the extension.
+//
+// Difference between optional core feature and core feature is that the 
+// later is unconditionally supported in specific OpenCL version.
 //
 // As per The OpenCL Extension Specification, Section 1.2, in this file, an
 // extension is defined if and only it either:
@@ -32,63 +38,72 @@
 // For such an extension, a preprocessor #define that matches the extension
 // name must be created and a #pragma is required if and only if the
 // compilation flow is impacted, e.g. due to a 
diff erence of syntax or
-// semantics in the language compared to the core standard.
+// semantics in the language compared to the core standard. #pragma directive
+// has no effect for optional core and core features.
 
-#ifndef OPENCLEXT_INTERNAL
-#ifndef OPENCLEXT
-#pragma error "macro OPENCLEXT or OPENCLEXT_INTERNAL is required"

[llvm-branch-commits] [compiler-rt] e9cc5fe - [scudo][standalone] Enable death tests on Fuchsia

2021-01-25 Thread Kostya Kortchinsky via llvm-branch-commits

Author: Kostya Kortchinsky
Date: 2021-01-25T09:19:10-08:00
New Revision: e9cc5fef64631a16f284e5dc09a2eaa8fd34a4a1

URL: 
https://github.com/llvm/llvm-project/commit/e9cc5fef64631a16f284e5dc09a2eaa8fd34a4a1
DIFF: 
https://github.com/llvm/llvm-project/commit/e9cc5fef64631a16f284e5dc09a2eaa8fd34a4a1.diff

LOG: [scudo][standalone] Enable death tests on Fuchsia

zxtest doesn't have `EXPECT_DEATH` and the Scudo unit-tests were
defining it as a no-op.

This enables death tests on Fuchsia by using `ASSERT_DEATH` instead.
I used a lambda to wrap the expressions as this appears to not be
working the same way as `EXPECT_DEATH`.

Additionnally, a death test using `alarm` was failing with the change,
as it's currently not implemented in Fuchsia, so move that test within
a `!SCUDO_FUCHSIA` block.

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

Added: 


Modified: 
compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp

Removed: 




diff  --git a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h 
b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
index 55d039ef77c3..22356c73a86b 100644
--- a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
+++ b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
@@ -16,10 +16,15 @@
 
 // If EXPECT_DEATH isn't defined, make it a no-op.
 #ifndef EXPECT_DEATH
+// If ASSERT_DEATH is defined, make EXPECT_DEATH a wrapper to it.
+#ifdef ASSERT_DEATH
+#define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "")
+#else
 #define EXPECT_DEATH(X, Y) 
\
   do { 
\
   } while (0)
-#endif
+#endif // ASSERT_DEATH
+#endif // EXPECT_DEATH
 
 // If EXPECT_STREQ isn't defined, define our own simple one.
 #ifndef EXPECT_STREQ

diff  --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp 
b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
index 3ddc4ec81832..e01ac38cd806 100644
--- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
@@ -303,8 +303,10 @@ TEST(ScudoWrappersCTest, MallocIterateBoundary) {
   }
 }
 
-// We expect heap operations within a disable/enable scope to deadlock.
+// Fuchsia doesn't have alarm, fork or malloc_info.
+#if !SCUDO_FUCHSIA
 TEST(ScudoWrappersCTest, MallocDisableDeadlock) {
+  // We expect heap operations within a disable/enable scope to deadlock.
   EXPECT_DEATH(
   {
 void *P = malloc(Size);
@@ -318,9 +320,6 @@ TEST(ScudoWrappersCTest, MallocDisableDeadlock) {
   "");
 }
 
-// Fuchsia doesn't have fork or malloc_info.
-#if !SCUDO_FUCHSIA
-
 TEST(ScudoWrappersCTest, MallocInfo) {
   // Use volatile so that the allocations don't get optimized away.
   void *volatile P1 = malloc(1234);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] 193cda1 - [libc++][doc] Update the release notes.

2021-01-25 Thread Mark de Wever via llvm-branch-commits

Author: Mark de Wever
Date: 2021-01-25T18:32:13+01:00
New Revision: 193cda105d9131de533596077ff0c694e8b87bbd

URL: 
https://github.com/llvm/llvm-project/commit/193cda105d9131de533596077ff0c694e8b87bbd
DIFF: 
https://github.com/llvm/llvm-project/commit/193cda105d9131de533596077ff0c694e8b87bbd.diff

LOG: [libc++][doc] Update the release notes.

Updates the libc++ release notes with the changes since the last
release.

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

Added: 


Modified: 
libcxx/docs/ReleaseNotes.rst
libcxx/docs/index.rst

Removed: 




diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 8ce9b2961119..696275e83571 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -37,8 +37,31 @@ What's New in Libc++ 12.0.0?
 
 New Features
 
+- Random device support has been made optional. It's enabled by default and can
+  be disabled by building libc++ with ``-DLIBCXX_ENABLE_RANDOM_DEVICE=OFF``.
+  Disabling random device support can be useful when building the library for
+  platforms that don't have a source of randomness, such as some embedded
+  platforms. When this is not supported, most of  will still be
+  available, but ``std::random_device`` will not.
+- Localization support has been made optional. It's enabled by default and can
+  be disabled by building libc++ with ``-DLIBCXX_ENABLE_LOCALIZATION=OFF``.
+  Disabling localization can be useful when porting to platforms that don't
+  support the C locale API (e.g. embedded). When localization is not
+  supported, several parts of the library will be disabled: ,
+  ,  will be completely unusable, and other parts may be
+  only partly available.
+- If libc++ is compiled with a C++20 capable compiler it will be compiled in
+  C++20 mode. Else libc++ will be compiled in C++17 mode.
+- Several unqualified lookups in libc++ have been changed to qualified lookups.
+  This makes libc++ more ADL-proof.
+- The libc++ implementation status pages have been overhauled. Like other parts
+  documentation they now use restructured text instead of html. Starting with
+  libc++12 the status pages are part of libc++'s documentation.
+- More C++20 features have been implemented. :doc:`Cxx2aStatus` has the full
+  overview of libc++'s C++20 implementation status.
+- Work has started to implement new C++2b features. :doc:`Cxx2bStatus` has the
+  full overview of libc++'s C++2b implementation status.
 
-- ...
 
 API Changes
 ---

diff  --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst
index ecece32228d9..22d54fa3509c 100644
--- a/libcxx/docs/index.rst
+++ b/libcxx/docs/index.rst
@@ -140,7 +140,7 @@ C++ Dialect Support
 * :ref:`C++14 - Complete `
 * :ref:`C++17 - In Progress `
 * :ref:`C++20 - In Progress `
-* :ref:`C++2b - Not Started `
+* :ref:`C++2b - In Progress `
 * `Post C++14 Technical Specifications - In Progress 
`__
 * :ref:`C++ Feature Test Macro Status `
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 4eb4f89 - [RISCV] Use sign extend for i32 arguments and returns in makeLibCall on RV64.

2021-01-25 Thread Craig Topper via llvm-branch-commits

Author: Craig Topper
Date: 2021-01-25T09:33:48-08:00
New Revision: 4eb4f8963f1e4998748bca66a512c3298f6d2289

URL: 
https://github.com/llvm/llvm-project/commit/4eb4f8963f1e4998748bca66a512c3298f6d2289
DIFF: 
https://github.com/llvm/llvm-project/commit/4eb4f8963f1e4998748bca66a512c3298f6d2289.diff

LOG: [RISCV] Use sign extend for i32 arguments and returns in makeLibCall on 
RV64.

As far as I know 32 bits arguments and returns on RV64 are always
sign extended to i64. So I think we should be taking this into
account around libcalls.

Reviewed By: luismarques

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

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 0f9da5600a34..54208fc187c9 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -4250,6 +4250,13 @@ bool RISCVTargetLowering::shouldExtendTypeInLibCall(EVT 
Type) const {
   return true;
 }
 
+bool RISCVTargetLowering::shouldSignExtendTypeInLibCall(EVT Type, bool 
IsSigned) const {
+  if (Subtarget.is64Bit() && Type == MVT::i32)
+return true;
+
+  return IsSigned;
+}
+
 bool RISCVTargetLowering::decomposeMulByConstant(LLVMContext &Context, EVT VT,
  SDValue C) const {
   // Check integral scalar types.

diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.h 
b/llvm/lib/Target/RISCV/RISCVISelLowering.h
index 3b7134341c8b..da16c6970d33 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.h
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.h
@@ -217,6 +217,7 @@ class RISCVTargetLowering : public TargetLowering {
   getExceptionSelectorRegister(const Constant *PersonalityFn) const override;
 
   bool shouldExtendTypeInLibCall(EVT Type) const override;
+  bool shouldSignExtendTypeInLibCall(EVT Type, bool IsSigned) const override;
 
   /// Returns the register with the specified architectural or ABI name. This
   /// method is necessary to lower the llvm.read_register.* and

diff  --git a/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll 
b/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
index 0b450c127077..31897d02e4c5 100644
--- a/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
+++ b/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
@@ -80,7 +80,6 @@ define i32 @flt_s(float %a, float %b) nounwind {
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:call __ltsf2@plt
-; RV64I-NEXT:sext.w a0, a0
 ; RV64I-NEXT:slti a0, a0, 0
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
 ; RV64I-NEXT:addi sp, sp, 16
@@ -96,7 +95,6 @@ define i32 @fle_s(float %a, float %b) nounwind {
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:call __lesf2@plt
-; RV64I-NEXT:sext.w a0, a0
 ; RV64I-NEXT:slti a0, a0, 1
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
 ; RV64I-NEXT:addi sp, sp, 16
@@ -112,7 +110,6 @@ define i32 @fcmp_ogt(float %a, float %b) nounwind {
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:call __gtsf2@plt
-; RV64I-NEXT:sext.w a0, a0
 ; RV64I-NEXT:sgtz a0, a0
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
 ; RV64I-NEXT:addi sp, sp, 16
@@ -128,7 +125,6 @@ define i32 @fcmp_oge(float %a, float %b) nounwind {
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:call __gesf2@plt
-; RV64I-NEXT:sext.w a0, a0
 ; RV64I-NEXT:addi a1, zero, -1
 ; RV64I-NEXT:slt a0, a1, a0
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
@@ -214,8 +210,7 @@ define float @fcvt_s_wu(i32 %a) nounwind {
 ; RV64I:   # %bb.0:
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
-; RV64I-NEXT:slli a0, a0, 32
-; RV64I-NEXT:srli a0, a0, 32
+; RV64I-NEXT:sext.w a0, a0
 ; RV64I-NEXT:call __floatunsisf@plt
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
 ; RV64I-NEXT:addi sp, sp, 16
@@ -675,8 +670,7 @@ define float @fpowi_s(float %a, i32 %b) nounwind {
 ; RV64I:   # %bb.0:
 ; RV64I-NEXT:addi sp, sp, -16
 ; RV64I-NEXT:sd ra, 8(sp) # 8-byte Folded Spill
-; RV64I-NEXT:slli a1, a1, 32
-; RV64I-NEXT:srli a1, a1, 32
+; RV64I-NEXT:sext.w a1, a1
 ; RV64I-NEXT:call __powisf2@plt
 ; RV64I-NEXT:ld ra, 8(sp) # 8-byte Folded Reload
 ; RV64I-NEXT:addi sp, sp, 16



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] 93eef7d - [OpenMP][NFC] Fix SourceInfo.h variable names

2021-01-25 Thread via llvm-branch-commits

Author: Joseph Huber
Date: 2021-01-25T12:43:34-05:00
New Revision: 93eef7d8e978d9efd0b28311d7be0d483f22e5d2

URL: 
https://github.com/llvm/llvm-project/commit/93eef7d8e978d9efd0b28311d7be0d483f22e5d2
DIFF: 
https://github.com/llvm/llvm-project/commit/93eef7d8e978d9efd0b28311d7be0d483f22e5d2.diff

LOG: [OpenMP][NFC] Fix SourceInfo.h variable names

Summary:
Fix the names to use Pascal case to comply with the LLVM coding guidelines. 
`ident_t` is required for compatibility with the rest of libomp.

Added: 


Modified: 
openmp/libomptarget/include/SourceInfo.h

Removed: 




diff  --git a/openmp/libomptarget/include/SourceInfo.h 
b/openmp/libomptarget/include/SourceInfo.h
index c659d916837b..32f115907749 100644
--- a/openmp/libomptarget/include/SourceInfo.h
+++ b/openmp/libomptarget/include/SourceInfo.h
@@ -16,9 +16,9 @@
 #include 
 
 #ifdef _WIN32
-static const bool OS_WINDOWS = true;
+constexpr bool OSWindows = true;
 #else
-static const bool OS_WINDOWS = false;
+constexpr bool OSWindows = false;
 #endif
 
 /// Type alias for source location information for variable mappings with
@@ -39,72 +39,72 @@ struct ident_t {
 /// Struct to hold source individual location information.
 class SourceInfo {
   /// Underlying string copy of the original source information.
-  const std::string sourceStr;
+  const std::string SourceStr;
 
   /// Location fields extracted from the source information string.
-  const std::string name;
-  const std::string filename;
-  const int32_t line;
-  const int32_t column;
+  const std::string Name;
+  const std::string Filename;
+  const int32_t Line;
+  const int32_t Column;
 
-  std::string initStr(const void *name) {
-if (!name)
+  std::string initStr(const void *Name) {
+if (!Name)
   return ";unknown;unknown;0;0;;";
 else
-  return std::string(reinterpret_cast(name));
+  return std::string(reinterpret_cast(Name));
   }
 
-  std::string initStr(const ident_t *loc) {
-if (!loc)
+  std::string initStr(const ident_t *Loc) {
+if (!Loc)
   return ";unknown;unknown;0;0;;";
 else
-  return std::string(reinterpret_cast(loc->psource));
+  return std::string(reinterpret_cast(Loc->psource));
   }
 
   /// Get n-th substring in an expression separated by ;.
-  std::string getSubstring(const int n) const {
-std::size_t begin = sourceStr.find(';');
-std::size_t end = sourceStr.find(';', begin + 1);
-for (int i = 0; i < n; i++) {
-  begin = end;
-  end = sourceStr.find(';', begin + 1);
+  std::string getSubstring(const unsigned N) const {
+std::size_t Begin = SourceStr.find(';');
+std::size_t End = SourceStr.find(';', Begin + 1);
+for (unsigned I = 0; I < N; I++) {
+  Begin = End;
+  End = SourceStr.find(';', Begin + 1);
 }
-return sourceStr.substr(begin + 1, end - begin - 1);
+return SourceStr.substr(Begin + 1, End - Begin - 1);
   };
 
   /// Get the filename from a full path.
-  std::string removePath(const std::string &path) const {
-std::size_t pos = (OS_WINDOWS) ? path.rfind('\\') : path.rfind('/');
-return path.substr(pos + 1);
+  std::string removePath(const std::string &Path) const {
+std::size_t Pos = (OSWindows) ? Path.rfind('\\') : Path.rfind('/');
+return Path.substr(Pos + 1);
   };
 
 public:
-  SourceInfo(const ident_t *loc)
-  : sourceStr(initStr(loc)), name(getSubstring(1)),
-filename(removePath(getSubstring(0))), 
line(std::stoi(getSubstring(2))),
-column(std::stoi(getSubstring(3))) {}
-
-  SourceInfo(const map_var_info_t name)
-  : sourceStr(initStr(name)), name(getSubstring(0)),
-filename(removePath(getSubstring(1))), 
line(std::stoi(getSubstring(2))),
-column(std::stoi(getSubstring(3))) {}
-
-  const char *getName() const { return name.c_str(); }
-  const char *getFilename() const { return filename.c_str(); }
-  int32_t getLine() const { return line; }
-  int32_t getColumn() const { return column; }
-  bool isAvailible() const { return (line || column); }
+  SourceInfo(const ident_t *Loc)
+  : SourceStr(initStr(Loc)), Name(getSubstring(1)),
+Filename(removePath(getSubstring(0))), 
Line(std::stoi(getSubstring(2))),
+Column(std::stoi(getSubstring(3))) {}
+
+  SourceInfo(const map_var_info_t Name)
+  : SourceStr(initStr(Name)), Name(getSubstring(0)),
+Filename(removePath(getSubstring(1))), 
Line(std::stoi(getSubstring(2))),
+Column(std::stoi(getSubstring(3))) {}
+
+  const char *getName() const { return Name.c_str(); }
+  const char *getFilename() const { return Filename.c_str(); }
+  int32_t getLine() const { return Line; }
+  int32_t getColumn() const { return Column; }
+  bool isAvailible() const { return (Line || Column); }
 };
 
 /// Standalone function for getting the variable name of a mapping.
-static inline std::string getNameFromMapping(const map_var_info_t name) {
-  if (!name)
+sta

[llvm-branch-commits] [clang] 3395a33 - [clang-format] add case aware include sorting

2021-01-25 Thread Marek Kurdej via llvm-branch-commits

Author: Lukas Barth
Date: 2021-01-25T18:53:22+01:00
New Revision: 3395a336b02538d0bb768ccfae11c9b6151b102e

URL: 
https://github.com/llvm/llvm-project/commit/3395a336b02538d0bb768ccfae11c9b6151b102e
DIFF: 
https://github.com/llvm/llvm-project/commit/3395a336b02538d0bb768ccfae11c9b6151b102e.diff

LOG: [clang-format] add case aware include sorting

* Adds an option to [clang-format] which sorts
  headers in an alphabetical manner using case
  only for tie-breakers. The options is off by
  default in favor of the current ASCIIbetical
  sorting style.

Reviewed By: curdeius, HazardyKnusperkeks

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Tooling/Inclusions/IncludeStyle.h
clang/lib/Format/Format.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/SortIncludesTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 3141dd5510fc..d5ce1b7b2e8e 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2282,6 +2282,26 @@ the configuration (without a prefix: ``Auto``).
   ``ClassImpl.hpp`` would not have the main include file put on top
   before any other include.
 
+**IncludeSortAlphabetically** (``bool``)
+  Specify if sorting should be done in an alphabetical and
+  case sensitive fashion.
+
+  When ``false``, includes are sorted in an ASCIIbetical
+  fashion.
+  When ``true``, includes are sorted in an alphabetical
+  fashion with case used as a tie-breaker.
+
+  .. code-block:: c++
+
+ false:   true:
+ #include "A/B.h"   vs.   #include "A/B.h"
+ #include "A/b.h" #include "A/b.h"
+ #include "B/A.h" #include "a/b.h"
+ #include "B/a.h" #include "B/A.h"
+ #include "a/b.h" #include "B/a.h"
+
+  This option is off by default.
+
 **IndentCaseBlocks** (``bool``)
   Indent case label blocks one level from the case label.
 

diff  --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h 
b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
index 4caaf4121f15..652a7b61a0a4 100644
--- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -147,6 +147,26 @@ struct IncludeStyle {
   /// ``ClassImpl.hpp`` would not have the main include file put on top
   /// before any other include.
   std::string IncludeIsMainSourceRegex;
+
+  /// Specify if sorting should be done in an alphabetical and
+  /// case sensitive fashion.
+  ///
+  /// When ``false``, includes are sorted in an ASCIIbetical
+  /// fashion.
+  /// When ``true``, includes are sorted in an alphabetical
+  /// fashion with case used as a tie-breaker.
+  ///
+  /// \code
+  ///   false:   true:
+  ///   #include "A/B.h"   vs.   #include "A/B.h"
+  ///   #include "A/b.h" #include "A/b.h"
+  ///   #include "B/A.h" #include "a/b.h"
+  ///   #include "B/a.h" #include "B/A.h"
+  ///   #include "a/b.h" #include "B/a.h"
+  /// \endcode
+  ///
+  /// This option is off by default.
+  bool IncludeSortAlphabetically;
 };
 
 } // namespace tooling

diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index cd1c6e4f6023..0986ef845a4e 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -571,6 +571,8 @@ template <> struct MappingTraits {
 IO.mapOptional("IncludeIsMainRegex", 
Style.IncludeStyle.IncludeIsMainRegex);
 IO.mapOptional("IncludeIsMainSourceRegex",
Style.IncludeStyle.IncludeIsMainSourceRegex);
+IO.mapOptional("IncludeSortAlphabetically",
+   Style.IncludeStyle.IncludeSortAlphabetically);
 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels);
 IO.mapOptional("IndentCaseBlocks", Style.IndentCaseBlocks);
 IO.mapOptional("IndentGotoLabels", Style.IndentGotoLabels);
@@ -940,6 +942,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   {".*", 1, 0, false}};
   LLVMStyle.IncludeStyle.IncludeIsMainRegex = "(Test)?$";
   LLVMStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Preserve;
+  LLVMStyle.IncludeStyle.IncludeSortAlphabetically = false;
   LLVMStyle.IndentCaseLabels = false;
   LLVMStyle.IndentCaseBlocks = false;
   LLVMStyle.IndentGotoLabels = true;
@@ -2194,10 +2197,23 @@ static void sortCppIncludes(const FormatStyle &Style,
   for (unsigned i = 0, e = Includes.size(); i != e; ++i) {
 Indices.push_back(i);
   }
-  llvm::stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
-return std::tie(Includes[LHSI].Priority, Includes[

[llvm-branch-commits] [libcxx] 3fbd3ea - [libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right)

2021-01-25 Thread Arthur O'Dwyer via llvm-branch-commits

Author: Arthur O'Dwyer
Date: 2021-01-25T12:57:04-05:00
New Revision: 3fbd3eaf28c1e6f2bb9519022611829dfe3b0464

URL: 
https://github.com/llvm/llvm-project/commit/3fbd3eaf28c1e6f2bb9519022611829dfe3b0464
DIFF: 
https://github.com/llvm/llvm-project/commit/3fbd3eaf28c1e6f2bb9519022611829dfe3b0464.diff

LOG: [libc++] Implement [P0769] "Add shift to algorithm" (shift_left, 
shift_right)

I believe this is a complete implementation of std::shift_left and 
std::shift_right from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf

Some test cases copied-with-modification from D60027.

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

Added: 

libcxx/test/std/algorithms/alg.modifying.operations/alg.shift/shift_left.pass.cpp

libcxx/test/std/algorithms/alg.modifying.operations/alg.shift/shift_right.pass.cpp

Modified: 
libcxx/docs/Cxx2aStatusPaperStatus.csv
libcxx/docs/FeatureTestMacroTable.rst
libcxx/include/algorithm
libcxx/include/version

libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp

libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py

Removed: 




diff  --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv 
b/libcxx/docs/Cxx2aStatusPaperStatus.csv
index 8991a03b2a5c..e30a289470d3 100644
--- a/libcxx/docs/Cxx2aStatusPaperStatus.csv
+++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv
@@ -38,7 +38,7 @@
 "`P0722R3 `__","CWG","Efficient sized delete for 
variable sized classes","Rapperswil","|Complete|","9.0"
 "`P0758R1 `__","LWG","Implicit conversion traits 
and utility functions","Rapperswil","|Complete|",""
 "`P0759R1 `__","LWG","fpos 
Requirements","Rapperswil","|Complete|","11.0"
-"`P0769R2 `__","LWG","Add shift to 
","Rapperswil","",""
+"`P0769R2 `__","LWG","Add shift to 
","Rapperswil","|Complete|","12.0"
 "`P0788R3 `__","LWG","Standard Library 
Specification in a Concepts and Contracts World","Rapperswil","*Removed in 
Cologne*","n/a"
 "`P0879R0 `__","LWG","Constexpr for swap and swap 
related functions Also resolves LWG issue 2800.","Rapperswil","",""
 "`P0887R1 `__","LWG","The identity 
metafunction","Rapperswil","|Complete|","8.0"

diff  --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index b5db1e08d7bf..ed05488fa711 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -266,7 +266,7 @@ Status
 - -
 ``__cpp_lib_semaphore``   ``201907L``
 - -
-``__cpp_lib_shift``   *unimplemented*
+``__cpp_lib_shift``   ``201806L``
 - -
 ``__cpp_lib_smart_ptr_for_overwrite`` *unimplemented*
 - -

diff  --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index da55e5e9add0..77711d250188 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -301,6 +301,16 @@ template
 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
  UniformRandomNumberGenerator&& g);
 
+template
+  constexpr ForwardIterator
+shift_left(ForwardIterator first, ForwardIterator last,
+   typename iterator_traits::
diff erence_type n); // C++20
+
+template
+  constexpr ForwardIterator
+shift_right(ForwardIterator first, ForwardIterator last,
+typename iterator_traits::
diff erence_type n); // C++20
+
 template 
 constexpr bool  // constexpr in C++20
 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
@@ -3259,6 +3269,111 @@ template
 }
 }
 
+#if _LIBCPP_STD_VER > 17
+
+// shift_left, shift_right
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY constexpr
+_ForwardIterator
+shift_left(_ForwardIterator __first, _ForwardIterator __last,
+   typename iterator_traits<_ForwardIterator>::
diff erence_type __n)
+{
+if (__n == 0) {
+return __last;
+}
+
+_ForwardIterator __m = __first;
+if constexpr (__is_cpp17_random_access_iterator<_ForwardIterator>::value) {
+if (__n >= __last - __first) {
+return __first;
+}
+__m += __n;
+} else {
+for (; __n > 0; --__n) {
+if (__m == __last) {
+return __first;
+}
+++__m;
+}
+}
+return _VSTD::move(__m, __last, __first

[llvm-branch-commits] [clang] c435567 - [Sema] Fix an assertion failure in -Wcompletion-handler

2021-01-25 Thread Erik Pilkington via llvm-branch-commits

Author: Erik Pilkington
Date: 2021-01-25T13:02:02-05:00
New Revision: c4355670b4bb12bc7181a99345bf8d09af1c5762

URL: 
https://github.com/llvm/llvm-project/commit/c4355670b4bb12bc7181a99345bf8d09af1c5762
DIFF: 
https://github.com/llvm/llvm-project/commit/c4355670b4bb12bc7181a99345bf8d09af1c5762.diff

LOG: [Sema] Fix an assertion failure in -Wcompletion-handler

NamedDecl::getName() was being called on a constructor.

Added: 
clang/test/SemaObjCXX/warn-called-once.mm

Modified: 
clang/lib/Analysis/CalledOnceCheck.cpp

Removed: 




diff  --git a/clang/lib/Analysis/CalledOnceCheck.cpp 
b/clang/lib/Analysis/CalledOnceCheck.cpp
index 6b7d3790e3e5..883629a300dc 100644
--- a/clang/lib/Analysis/CalledOnceCheck.cpp
+++ b/clang/lib/Analysis/CalledOnceCheck.cpp
@@ -936,8 +936,9 @@ class CalledOnceChecker : public 
ConstStmtVisitor {
 
   /// Return true if the only parameter of the function is conventional.
   static bool isOnlyParameterConventional(const FunctionDecl *Function) {
-return Function->getNumParams() == 1 &&
-   hasConventionalSuffix(Function->getName());
+IdentifierInfo *II = Function->getIdentifier();
+return Function->getNumParams() == 1 && II &&
+   hasConventionalSuffix(II->getName());
   }
 
   /// Return true/false if 'swift_async' attribute states that the given

diff  --git a/clang/test/SemaObjCXX/warn-called-once.mm 
b/clang/test/SemaObjCXX/warn-called-once.mm
new file mode 100644
index ..312da27d9ae3
--- /dev/null
+++ b/clang/test/SemaObjCXX/warn-called-once.mm
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wcompletion-handler %s
+
+// expected-no-diagnostics
+
+class HasCtor {
+  HasCtor(void *) {}
+};



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] f851db3 - [libc++] [P0879] constexpr std::reverse, partition, *_permutation.

2021-01-25 Thread Arthur O'Dwyer via llvm-branch-commits

Author: Arthur O'Dwyer
Date: 2021-01-25T13:09:30-05:00
New Revision: f851db3dae5cc24ce1897918bd69fa989aa31b59

URL: 
https://github.com/llvm/llvm-project/commit/f851db3dae5cc24ce1897918bd69fa989aa31b59
DIFF: 
https://github.com/llvm/llvm-project/commit/f851db3dae5cc24ce1897918bd69fa989aa31b59.diff

LOG: [libc++] [P0879] constexpr std::reverse, partition, *_permutation.

After this patch, the only parts of P0879 that remain missing will be
std::nth_element, std::sort, and the heap/partial_sort algorithms.

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

Added: 


Modified: 
libcxx/include/algorithm

libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp

libcxx/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse.pass.cpp

libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation.pass.cpp

libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation_comp.pass.cpp

libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.pass.cpp

libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation_comp.pass.cpp

Removed: 




diff  --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 77711d250188b..f7fb2013a7573 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -267,7 +267,7 @@ template 
 unique_copy(InputIterator first, InputIterator last, OutputIterator 
result, BinaryPredicate pred);
 
 template 
-void
+constexpr void   // constexpr in C++20
 reverse(BidirectionalIterator first, BidirectionalIterator last);
 
 template 
@@ -316,7 +316,7 @@ template 
 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
 
 template 
-ForwardIterator
+constexpr ForwardIterator  // constexpr in C++20
 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
 
 template 
 InputIterator2 first2, InputIterator2 last2, 
Compare comp);
 
 template 
-bool
+constexpr bool // constexpr in C++20
 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
 
 template 
-bool
+constexpr bool // constexpr in C++20
 next_permutation(BidirectionalIterator first, BidirectionalIterator last, 
Compare comp);
 
 template 
-bool
+constexpr bool // constexpr in C++20
 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
 
 template 
-bool
+constexpr bool // constexpr in C++20
 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, 
Compare comp);
 
 }  // std
@@ -2321,7 +2321,7 @@ unique_copy(_InputIterator __first, _InputIterator 
__last, _OutputIterator __res
 // reverse
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 void
 __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, 
bidirectional_iterator_tag)
 {
@@ -2335,7 +2335,7 @@ __reverse(_BidirectionalIterator __first, 
_BidirectionalIterator __last, bidirec
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 void
 __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, 
random_access_iterator_tag)
 {
@@ -2345,7 +2345,7 @@ __reverse(_RandomAccessIterator __first, 
_RandomAccessIterator __last, random_ac
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 void
 reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
 {
@@ -3393,7 +3393,7 @@ is_partitioned(_InputIterator __first, _InputIterator 
__last, _Predicate __pred)
 // partition
 
 template 
-_ForwardIterator
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
 __partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate 
__pred, forward_iterator_tag)
 {
 while (true)
@@ -3416,7 +3416,7 @@ __partition(_ForwardIterator __first, _ForwardIterator 
__last, _Predicate __pred
 }
 
 template 
-_BidirectionalIterator
+_LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator
 __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, 
_Predicate __pred,
 bidirectional_iterator_tag)
 {
@@ -3441,7 +3441,7 @@ __partition(_BidirectionalIterator __first, 
_BidirectionalIterator __last, _Pred
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator
 partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
 {
@@ -5760,7 +5760,7 @@ lexicographical_compare(_InputIterator1 __first1, 
_InputIterator1 __last1,
 // next_permutation
 
 template 
-bool
+_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
 __next_permutation(_BidirectionalIterator __first, _BidirectionalIterator 
__last, _Compare __com

[llvm-branch-commits] [clang] c332445 - [clang] Add -fprofile-prefix-map

2021-01-25 Thread Keith Smiley via llvm-branch-commits

Author: Keith Smiley
Date: 2021-01-25T10:14:04-08:00
New Revision: c3324450b204392169d4ec7172cb32f74c03e376

URL: 
https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376
DIFF: 
https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376.diff

LOG: [clang] Add -fprofile-prefix-map

This flag allows you to re-write absolute paths in coverage data analogous to 
-fdebug-prefix-map. This flag is also implied by -ffile-prefix-map.

Added: 
clang/test/Profile/profile-prefix-map.c

Modified: 
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/CodeGen/CoverageMappingGen.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/debug-prefix-map.c

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index ef4fa31256cd..5a37569be409 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -169,6 +169,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
   std::string RecordCommandLine;
 
   std::map DebugPrefixMap;
+  std::map ProfilePrefixMap;
 
   /// The ABI to use for passing floating point arguments.
   std::string FloatABI;

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index dd7978435ff1..0a23fb18d3a6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2601,6 +2601,10 @@ def fdebug_prefix_map_EQ
   : Joined<["-"], "fdebug-prefix-map=">, Group,
 Flags<[CC1Option,CC1AsOption]>,
 HelpText<"remap file source paths in debug info">;
+def fprofile_prefix_map_EQ
+  : Joined<["-"], "fprofile-prefix-map=">, Group,
+Flags<[CC1Option]>,
+HelpText<"remap file source paths in coverage info">;
 def ffile_prefix_map_EQ
   : Joined<["-"], "ffile-prefix-map=">, Group,
 HelpText<"remap file source paths in debug info and predefined 
preprocessor macros">;

diff  --git a/clang/lib/CodeGen/CoverageMappingGen.cpp 
b/clang/lib/CodeGen/CoverageMappingGen.cpp
index c474546d4abf..5c25c204cc0b 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1544,13 +1544,6 @@ struct CounterCoverageMappingBuilder
   }
 };
 
-std::string normalizeFilename(StringRef Filename) {
-  llvm::SmallString<256> Path(Filename);
-  llvm::sys::fs::make_absolute(Path);
-  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-  return std::string(Path);
-}
-
 } // end anonymous namespace
 
 static void dump(llvm::raw_ostream &OS, StringRef FunctionName,
@@ -1592,6 +1585,23 @@ static void dump(llvm::raw_ostream &OS, StringRef 
FunctionName,
   }
 }
 
+CoverageMappingModuleGen::CoverageMappingModuleGen(
+CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
+: CGM(CGM), SourceInfo(SourceInfo) {
+  ProfilePrefixMap = CGM.getCodeGenOpts().ProfilePrefixMap;
+}
+
+std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) {
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
+  for (const auto &Entry : ProfilePrefixMap) {
+if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second))
+  break;
+  }
+  return Path.str().str();
+}
+
 static std::string getInstrProfSection(const CodeGenModule &CGM,
llvm::InstrProfSectKind SK) {
   return llvm::getInstrProfSectionName(

diff  --git a/clang/lib/CodeGen/CoverageMappingGen.h 
b/clang/lib/CodeGen/CoverageMappingGen.h
index 9d0aa3b9cad1..b26f79be5316 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.h
+++ b/clang/lib/CodeGen/CoverageMappingGen.h
@@ -93,6 +93,9 @@ class CoverageMappingModuleGen {
   llvm::SmallDenseMap FileEntries;
   std::vector FunctionNames;
   std::vector FunctionRecords;
+  std::map ProfilePrefixMap;
+
+  std::string normalizeFilename(StringRef Filename);
 
   /// Emit a function record.
   void emitFunctionMappingRecord(const FunctionInfo &Info,
@@ -101,8 +104,7 @@ class CoverageMappingModuleGen {
 public:
   static CoverageSourceInfo *setUpCoverageCallbacks(Preprocessor &PP);
 
-  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
-  : CGM(CGM), SourceInfo(SourceInfo) {}
+  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo);
 
   CoverageSourceInfo &getSourceInfo() const {
 return SourceInfo;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 7ae0de21317d..8530ac765332 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -656,6 +656,21 @@ static void addMacroPrefixMapArg(const Driver &D, const 
ArgList &Ar

[llvm-branch-commits] [mlir] 1e73955 - [mlir] Use more C99 comments in C API header files

2021-01-25 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2021-01-25T19:23:06+01:00
New Revision: 1e739552ee96db4b3f2d792976ea849cb6f23650

URL: 
https://github.com/llvm/llvm-project/commit/1e739552ee96db4b3f2d792976ea849cb6f23650
DIFF: 
https://github.com/llvm/llvm-project/commit/1e739552ee96db4b3f2d792976ea849cb6f23650.diff

LOG: [mlir] Use more C99 comments in C API header files

These were left over from the original reformatting commit.

Reviewed By: stellaraccident

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

Added: 


Modified: 
mlir/include/mlir-c/AffineExpr.h
mlir/include/mlir-c/AffineMap.h
mlir/include/mlir-c/BuiltinAttributes.h
mlir/include/mlir-c/BuiltinTypes.h
mlir/include/mlir-c/Diagnostics.h
mlir/include/mlir-c/IR.h
mlir/include/mlir-c/Pass.h
mlir/include/mlir-c/Support.h

Removed: 




diff  --git a/mlir/include/mlir-c/AffineExpr.h 
b/mlir/include/mlir-c/AffineExpr.h
index d5c6e7b9f29e..5516f29088e4 100644
--- a/mlir/include/mlir-c/AffineExpr.h
+++ b/mlir/include/mlir-c/AffineExpr.h
@@ -17,17 +17,16 @@ extern "C" {
 #endif
 
 
//===--===//
-/** Opaque type declarations.
- *
- * Types are exposed to C bindings as structs containing opaque pointers. They
- * are not supposed to be inspected from C. This allows the underlying
- * representation to change without affecting the API users. The use of structs
- * instead of typedefs enables some type safety as structs are not implicitly
- * convertible to each other.
- *
- * Instances of these types may or may not own the underlying object. The
- * ownership semantics is defined by how an instance of the type was obtained.
- */
+// Opaque type declarations.
+//
+// Types are exposed to C bindings as structs containing opaque pointers. They
+// are not supposed to be inspected from C. This allows the underlying
+// representation to change without affecting the API users. The use of structs
+// instead of typedefs enables some type safety as structs are not implicitly
+// convertible to each other.
+//
+// Instances of these types may or may not own the underlying object. The
+// ownership semantics is defined by how an instance of the type was obtained.
 
//===--===//
 
 #define DEFINE_C_API_STRUCT(name, storage) 
\
@@ -54,9 +53,9 @@ inline static bool mlirAffineExprIsNull(MlirAffineExpr 
affineExpr) {
   return affineExpr.ptr == NULL;
 }
 
-/** Prints an affine expression by sending chunks of the string representation
- * and forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints an affine expression by sending chunks of the string representation
+/// and forwarding `userData to `callback`. Note that the callback may be 
called
+/// several times with consecutive chunks of the string.
 MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr affineExpr,
 MlirStringCallback callback,
 void *userData);
@@ -64,17 +63,17 @@ MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr 
affineExpr,
 /// Prints the affine expression to the standard error stream.
 MLIR_CAPI_EXPORTED void mlirAffineExprDump(MlirAffineExpr affineExpr);
 
-/** Checks whether the given affine expression is made out of only symbols and
- * constants. */
+/// Checks whether the given affine expression is made out of only symbols and
+/// constants.
 MLIR_CAPI_EXPORTED bool
 mlirAffineExprIsSymbolicOrConstant(MlirAffineExpr affineExpr);
 
-/** Checks whether the given affine expression is a pure affine expression, 
i.e.
- * mul, floordiv, ceildic, and mod is only allowed w.r.t constants. */
+/// Checks whether the given affine expression is a pure affine expression, 
i.e.
+/// mul, floordiv, ceildic, and mod is only allowed w.r.t constants.
 MLIR_CAPI_EXPORTED bool mlirAffineExprIsPureAffine(MlirAffineExpr affineExpr);
 
-/** Returns the greatest known integral divisor of this affine expression. The
- * result is always positive. */
+/// Returns the greatest known integral divisor of this affine expression. The
+/// result is always positive.
 MLIR_CAPI_EXPORTED int64_t
 mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr);
 
@@ -82,8 +81,8 @@ mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr 
affineExpr);
 MLIR_CAPI_EXPORTED bool mlirAffineExprIsMultipleOf(MlirAffineExpr affineExpr,
int64_t factor);
 
-/** Checks whether the given affine expression involves AffineDimExpr
- * 'position'. */
+/// Checks whether the given affine expression involves AffineDimExpr
+/// 'position'.
 MLIR_CAPI_EXPORTED bool mlirAffineExprIsFunctionOfDim(MlirAffineExpr 
affineExpr,

[llvm-branch-commits] [llvm] 1150bfa - [PowerPC] Add missing negate for VPERMXOR on little endian subtargets

2021-01-25 Thread Nemanja Ivanovic via llvm-branch-commits

Author: Nemanja Ivanovic
Date: 2021-01-25T12:23:33-06:00
New Revision: 1150bfa6bb099f9a85a140f66fde7b7f7aa54e60

URL: 
https://github.com/llvm/llvm-project/commit/1150bfa6bb099f9a85a140f66fde7b7f7aa54e60
DIFF: 
https://github.com/llvm/llvm-project/commit/1150bfa6bb099f9a85a140f66fde7b7f7aa54e60.diff

LOG: [PowerPC] Add missing negate for VPERMXOR on little endian subtargets

This intrinsic is supposed to have the permute control vector complemented on
little endian systems (as the ABI specifies and GCC implements). With the
current code gen, the result vector is byte-reversed.

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

Added: 


Modified: 
llvm/lib/Target/PowerPC/PPCInstrAltivec.td
llvm/lib/Target/PowerPC/PPCInstrVSX.td
llvm/test/CodeGen/PowerPC/crypto_bifs.ll

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td 
b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td
index c029ecb63e72..1a34aa09315b 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td
@@ -1327,8 +1327,8 @@ def VPMSUMW : VX1_Int_Ty<1160, "vpmsumw",
  int_ppc_altivec_crypto_vpmsumw, v4i32>;
 def VPMSUMD : VX1_Int_Ty<1224, "vpmsumd",
  int_ppc_altivec_crypto_vpmsumd, v2i64>;
-def VPERMXOR : VA1a_Int_Ty<45, "vpermxor",
- int_ppc_altivec_crypto_vpermxor, v16i8>;
+def VPERMXOR : VAForm_1<45, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB, 
vrrc:$VC),
+"vpermxor $VD, $VA, $VB, $VC", IIC_VecFP, []>;
 
 // Vector doubleword integer pack and unpack.
 let hasSideEffects = 1 in {

diff  --git a/llvm/lib/Target/PowerPC/PPCInstrVSX.td 
b/llvm/lib/Target/PowerPC/PPCInstrVSX.td
index 2e45d731c953..db6e00c71b89 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrVSX.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrVSX.td
@@ -2408,6 +2408,8 @@ def MrgWords {
 // arbitrarily chosen to be Big, Little.
 //
 // Predicate combinations available:
+// [HasVSX, IsLittleEndian, HasP8Altivec] Altivec patterns using VSX instr.
+// [HasVSX, IsBigEndian, HasP8Altivec] Altivec patterns using VSX instr.
 // [HasVSX]
 // [HasVSX, IsBigEndian]
 // [HasVSX, IsLittleEndian]
@@ -2436,6 +2438,18 @@ def MrgWords {
 // [HasVSX, IsISA3_0, HasDirectMove, IsBigEndian, IsPPC64]
 // [HasVSX, IsISA3_0, HasDirectMove, IsLittleEndian]
 
+// These Altivec patterns are here because we need a VSX instruction to match
+// the intrinsic (but only for little endian system).
+let Predicates = [HasVSX, IsLittleEndian, HasP8Altivec] in
+  def : Pat<(v16i8 (int_ppc_altivec_crypto_vpermxor v16i8:$a,
+v16i8:$b, v16i8:$c)),
+(v16i8 (VPERMXOR $a, $b, (XXLNOR (COPY_TO_REGCLASS $c, VSRC),
+ (COPY_TO_REGCLASS $c, VSRC>;
+let Predicates = [HasVSX, IsBigEndian, HasP8Altivec] in
+  def : Pat<(v16i8 (int_ppc_altivec_crypto_vpermxor v16i8:$a,
+v16i8:$b, v16i8:$c)),
+(v16i8 (VPERMXOR $a, $b, $c))>;
+
 let AddedComplexity = 400 in {
 // Valid for any VSX subtarget, regardless of endianness.
 let Predicates = [HasVSX] in {

diff  --git a/llvm/test/CodeGen/PowerPC/crypto_bifs.ll 
b/llvm/test/CodeGen/PowerPC/crypto_bifs.ll
index b34482abfcd0..e38fe90ecc57 100644
--- a/llvm/test/CodeGen/PowerPC/crypto_bifs.ll
+++ b/llvm/test/CodeGen/PowerPC/crypto_bifs.ll
@@ -1,7 +1,11 @@
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu 
-mcpu=pwr8 < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu 
-mcpu=pwr7 -mattr=+crypto < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu 
-mcpu=pwr9 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -mcpu=pwr8 < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -mcpu=pwr7 -mattr=+crypto < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-LE
 ; FIXME: llc -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < 
%s | FileCheck %s
 ; FIXME: The original intent was to add a check-next for the blr after every 
check.
 ; However, this currently fails since we don't eliminate stores of the unused
@@ -103,6 +107,7 @@ entry:
   %2 = load <16 x i8>,  <16 x i8>* %c, align 16
   %3 = call <16 x i8> @llvm.ppc.altivec.crypto.vpermxor(<16 x i8> %0, <16 x 
i8> %1, <16 x i8> %2)
   ret <16 x i8> %3
+; CHECK-LE: xxlnor
 ; C

[llvm-branch-commits] [lld] 299b0e5 - [lld] Consistent help text for `--save-temps`

2021-01-25 Thread Sam Clegg via llvm-branch-commits

Author: Sam Clegg
Date: 2021-01-25T10:27:18-08:00
New Revision: 299b0e5ee9ee30093ccc9fe78b7797c16887150d

URL: 
https://github.com/llvm/llvm-project/commit/299b0e5ee9ee30093ccc9fe78b7797c16887150d
DIFF: 
https://github.com/llvm/llvm-project/commit/299b0e5ee9ee30093ccc9fe78b7797c16887150d.diff

LOG: [lld] Consistent help text for `--save-temps`

I noticed that this option was not appearing at all in the `--help`
messages for `wasm-ld` or `ld.lld`.

Add help text and make it consistent across all ports.

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

Added: 


Modified: 
lld/COFF/Options.td
lld/ELF/Options.td
lld/MachO/Options.td
lld/wasm/Options.td

Removed: 




diff  --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 5447c8312128..73c3380df17c 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -68,7 +68,7 @@ def lldltocache : P<"lldltocache",
 def lldltocachepolicy : P<"lldltocachepolicy",
 "Pruning policy for the ThinLTO cache">;
 def lldsavetemps : F<"lldsavetemps">,
-HelpText<"Save temporary files instead of deleting them">;
+HelpText<"Save intermediate LTO compilation results">;
 def machine : P<"machine", "Specify target platform">;
 def merge   : P<"merge", "Combine sections">;
 def mllvm   : P<"mllvm", "Options to pass to LLVM">;

diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 0ca283cdfe08..65ef3e824f50 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -566,7 +566,7 @@ def opt_remarks_with_hotness: 
FF<"opt-remarks-with-hotness">,
   HelpText<"Include hotness information in the optimization remarks file">;
 def opt_remarks_format: Separate<["--"], "opt-remarks-format">,
   HelpText<"The format used for serializing remarks (default: YAML)">;
-def save_temps: F<"save-temps">;
+def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation 
results">;
 def lto_basic_block_sections: JJ<"lto-basic-block-sections=">,
   HelpText<"Enable basic block sections for LTO">;
 defm lto_unique_basic_block_section_names: 
BB<"lto-unique-basic-block-section-names",

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 3410f50fa317..51c834c57238 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -477,7 +477,7 @@ def dependency_info : Separate<["-"], "dependency_info">,
  Flags<[HelpHidden]>,
  Group;
 def save_temps : Flag<["-"], "save-temps">,
- HelpText<"Save temporary files instead of deleting them">,
+ HelpText<"Save intermediate LTO compilation results">,
  Group;
 
 def grp_symtab : OptionGroup<"symtab">, HelpText<"SYMBOL TABLE OPTIMIZATIONS">;

diff  --git a/lld/wasm/Options.td b/lld/wasm/Options.td
index ae5ec20d07e8..8e9ebeb168d6 100644
--- a/lld/wasm/Options.td
+++ b/lld/wasm/Options.td
@@ -214,7 +214,7 @@ def lto_O: J<"lto-O">, MetaVarName<"">,
 def lto_partitions: J<"lto-partitions=">,
   HelpText<"Number of LTO codegen partitions">;
 def disable_verify: F<"disable-verify">;
-def save_temps: F<"save-temps">;
+def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation 
results">;
 def thinlto_cache_dir: J<"thinlto-cache-dir=">,
   HelpText<"Path to ThinLTO cached object file directory">;
 defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the 
ThinLTO cache">;



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] c9cd9a0 - [SampleFDO] Report error when reading a bad/incompatible profile instead of

2021-01-25 Thread Wei Mi via llvm-branch-commits

Author: Wei Mi
Date: 2021-01-25T10:28:23-08:00
New Revision: c9cd9a006632419ce7346e50564e6347a93181cc

URL: 
https://github.com/llvm/llvm-project/commit/c9cd9a006632419ce7346e50564e6347a93181cc
DIFF: 
https://github.com/llvm/llvm-project/commit/c9cd9a006632419ce7346e50564e6347a93181cc.diff

LOG: [SampleFDO] Report error when reading a bad/incompatible profile instead of
turning off SampleFDO silently.

Currently sample loader pass turns off SampleFDO optimization silently when
it sees error in reading the profile. This behavior will defeat the tests
which could have caught those bad/incompatible profile problems. This patch
change the behavior to report error.

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

Added: 
llvm/test/Transforms/SampleProfile/Inputs/bad.extbinary.afdo

Modified: 
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/profile-format.ll

Removed: 




diff  --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp 
b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 9dc7173bf529..73ad42fb5824 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1948,7 +1948,12 @@ bool SampleProfileLoader::doInitialization(Module &M,
   Reader = std::move(ReaderOrErr.get());
   Reader->setSkipFlatProf(LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink);
   Reader->collectFuncsFrom(M);
-  ProfileIsValid = (Reader->read() == sampleprof_error::success);
+  if (std::error_code EC = Reader->read()) {
+std::string Msg = "profile reading failed: " + EC.message();
+Ctx.diagnose(DiagnosticInfoSampleProfile(Filename, Msg));
+return false;
+  }
+
   PSL = Reader->getProfileSymbolList();
 
   // While profile-sample-accurate is on, ignore symbol list.
@@ -2001,8 +2006,6 @@ ModulePass *llvm::createSampleProfileLoaderPass(StringRef 
Name) {
 
 bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
   ProfileSummaryInfo *_PSI, CallGraph *CG) 
{
-  if (!ProfileIsValid)
-return false;
   GUIDToFuncNameMapper Mapper(M, *Reader, GUIDToFuncNameMap);
 
   PSI = _PSI;

diff  --git a/llvm/test/Transforms/SampleProfile/Inputs/bad.extbinary.afdo 
b/llvm/test/Transforms/SampleProfile/Inputs/bad.extbinary.afdo
new file mode 100644
index ..173bdde2d045
Binary files /dev/null and 
b/llvm/test/Transforms/SampleProfile/Inputs/bad.extbinary.afdo 
diff er

diff  --git a/llvm/test/Transforms/SampleProfile/profile-format.ll 
b/llvm/test/Transforms/SampleProfile/profile-format.ll
index 3809a9618a39..72765c305490 100644
--- a/llvm/test/Transforms/SampleProfile/profile-format.ll
+++ b/llvm/test/Transforms/SampleProfile/profile-format.ll
@@ -8,6 +8,8 @@
 ; RUN: opt < %s -passes=sample-profile 
-sample-profile-file=%S/Inputs/inline.md5extbinary.afdo -S | FileCheck %s
 ; RUN: opt < %s -sample-profile 
-sample-profile-file=%S/Inputs/inline.fixlenmd5.extbinary.afdo -S | FileCheck %s
 ; RUN: opt < %s -passes=sample-profile 
-sample-profile-file=%S/Inputs/inline.fixlenmd5.extbinary.afdo -S | FileCheck %s
+; RUN: not opt < %s -sample-profile 
-sample-profile-file=%S/Inputs/bad.extbinary.afdo -S 2>&1 | FileCheck %s 
-check-prefix=BAD-PROFILE
+; RUN: not opt < %s -passes=sample-profile 
-sample-profile-file=%S/Inputs/bad.extbinary.afdo -S 2>&1 | FileCheck %s 
-check-prefix=BAD-PROFILE
 
 ; Original C++ test case
 ;
@@ -38,6 +40,9 @@
 ; CHECK: ![[IDX2]] = !{!"branch_weights", i32 5280, i32 113}
 ; CHECK: ![[IDX3]] = !{!"branch_weights", i32 1}
 
+; Check sample-profile phase will report error when it is reading a bad 
profile.
+; BAD-PROFILE: error: {{.*}}bad.extbinary.afdo: profile reading failed: 
Malformed sample profile data
+
 ; Function Attrs: nounwind uwtable
 define i32 @_Z3sumii(i32 %x, i32 %y) #0 !dbg !4 {
 entry:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] c8fc5c0 - [mlir][Affine] Add support for multi-store producer fusion

2021-01-25 Thread Diego Caballero via llvm-branch-commits

Author: Diego Caballero
Date: 2021-01-25T20:31:17+02:00
New Revision: c8fc5c0385dbb47623c1cca5efa0b96d5e5f8151

URL: 
https://github.com/llvm/llvm-project/commit/c8fc5c0385dbb47623c1cca5efa0b96d5e5f8151
DIFF: 
https://github.com/llvm/llvm-project/commit/c8fc5c0385dbb47623c1cca5efa0b96d5e5f8151.diff

LOG: [mlir][Affine] Add support for multi-store producer fusion

This patch adds support for producer-consumer fusion scenarios with
multiple producer stores to the AffineLoopFusion pass. The patch
introduces some changes to the producer-consumer algorithm, including:

* For a given consumer loop, producer-consumer fusion iterates over its
producer candidates until a fixed point is reached.

* Producer candidates are gathered beforehand for each iteration of the
consumer loop and visited in reverse program order (not strictly guaranteed)
to maximize the number of loops fused per iteration.

In general, these changes were needed to simplify the multi-store producer
support and remove some of the workarounds that were introduced in the past
to support more fusion cases under the single-store producer limitation.

This patch also preserves the existing functionality of AffineLoopFusion with
one minor change in behavior. Producer-consumer fusion didn't fuse scenarios
with escaping memrefs and multiple outgoing edges (from a single store).
Multi-store producer scenarios will usually (always?) have multiple outgoing
edges so we couldn't fuse any with escaping memrefs, which would greatly limit
the applicability of this new feature. Therefore, the patch enables fusion for
these scenarios. Please, see modified tests for specific details.

Reviewed By: andydavis1, bondhugula

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

Added: 


Modified: 
mlir/include/mlir/Analysis/AffineStructures.h
mlir/include/mlir/Analysis/Utils.h
mlir/include/mlir/Transforms/LoopFusionUtils.h
mlir/include/mlir/Transforms/Passes.td
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/Analysis/Utils.cpp
mlir/lib/Transforms/LoopFusion.cpp
mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
mlir/test/Transforms/loop-fusion.mlir

Removed: 




diff  --git a/mlir/include/mlir/Analysis/AffineStructures.h 
b/mlir/include/mlir/Analysis/AffineStructures.h
index fa42db500684..6aa0a38243b9 100644
--- a/mlir/include/mlir/Analysis/AffineStructures.h
+++ b/mlir/include/mlir/Analysis/AffineStructures.h
@@ -232,6 +232,21 @@ class FlatAffineConstraints {
   //  TODO: add support for non-unit strides.
   LogicalResult addAffineForOpDomain(AffineForOp forOp);
 
+  /// Adds constraints (lower and upper bounds) for each loop in the loop nest
+  /// described by the bound maps 'lbMaps' and 'ubMaps' of a computation slice.
+  /// Every pair ('lbMaps[i]', 'ubMaps[i]') describes the bounds of a loop in
+  /// the nest, sorted outer-to-inner. 'operands' contains the bound operands
+  /// for a single bound map. All the bound maps will use the same bound
+  /// operands. Note that some loops described by a computation slice might not
+  /// exist yet in the IR so the Value attached to those dimension identifiers
+  /// might be empty. For that reason, this method doesn't perform Value
+  /// look-ups to retrieve the dimension identifier positions. Instead, it
+  /// assumes the position of the dim identifiers in the constraint system is
+  /// the same as the position of the loop in the loop nest.
+  LogicalResult addDomainFromSliceMaps(ArrayRef lbMaps,
+   ArrayRef ubMaps,
+   ArrayRef operands);
+
   /// Adds constraints imposed by the `affine.if` operation. These constraints
   /// are collected from the IntegerSet attached to the given `affine.if`
   /// instance argument (`ifOp`). It is asserted that:

diff  --git a/mlir/include/mlir/Analysis/Utils.h 
b/mlir/include/mlir/Analysis/Utils.h
index 30b6272181f5..ee6f8095f25e 100644
--- a/mlir/include/mlir/Analysis/Utils.h
+++ b/mlir/include/mlir/Analysis/Utils.h
@@ -83,10 +83,25 @@ struct ComputationSliceState {
   // Clears all bounds and operands in slice state.
   void clearBounds();
 
-  /// Return true if the computation slice is empty.
+  /// Returns true if the computation slice is empty.
   bool isEmpty() const { return ivs.empty(); }
 
+  /// Returns true if the computation slice encloses all the iterations of the
+  /// sliced loop nest. Returns false if it does not. Returns llvm::None if it
+  /// cannot determine if the slice is maximal or not.
+  // TODO: Cache 'isMaximal' so that we don't recompute it when the slice
+  // information hasn't changed.
+  Optional isMaximal() const;
+
   void dump() const;
+
+private:
+  /// Fast check to determine if the computation slice is maximal. Returns true
+  /// if each slice dimension maps to an existing dst dimension and both the 
src
+  /// and the dst loops for those dimens

[llvm-branch-commits] [llvm] 988a533 - [Win64] Ensure all stack frames are 8 byte aligned

2021-01-25 Thread Reid Kleckner via llvm-branch-commits

Author: Reid Kleckner
Date: 2021-01-25T10:39:27-08:00
New Revision: 988a5334ed40ee65c91bf30be93631b092316390

URL: 
https://github.com/llvm/llvm-project/commit/988a5334ed40ee65c91bf30be93631b092316390
DIFF: 
https://github.com/llvm/llvm-project/commit/988a5334ed40ee65c91bf30be93631b092316390.diff

LOG: [Win64] Ensure all stack frames are 8 byte aligned

The unwind info format requires that all adjustments are 8 byte aligned,
and the bottom three bits are masked out. Most Win64 calling conventions
have 32 bytes of shadow stack space for spilling parameters, and I
believe that constructing these fixed stack objects had the side effect
of ensuring an alignment of 8. However, the Intel regcall convention
does not have this shadow space, so when using that convention, it was
possible to make a 4 byte stack frame, which was impossible to describe
with unwind info.

Fixes pr48867

Added: 
llvm/test/CodeGen/X86/win64_regcall.ll

Modified: 
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86FrameLowering.h

Removed: 




diff  --git a/llvm/lib/Target/X86/X86FrameLowering.cpp 
b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 8339f512158d..866f11364004 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -3516,13 +3516,21 @@ void 
X86FrameLowering::processFunctionBeforeFrameFinalized(
   // emitPrologue if it gets called and emits CFI.
   MF.setHasWinCFI(false);
 
+  // If we are using Windows x64 CFI, ensure that the stack is always 8 byte
+  // aligned. The format doesn't support misaligned stack adjustments.
+  if (MF.getTarget().getMCAsmInfo()->usesWindowsCFI())
+MF.getFrameInfo().ensureMaxAlignment(Align(SlotSize));
+
   // If this function isn't doing Win64-style C++ EH, we don't need to do
   // anything.
-  const Function &F = MF.getFunction();
-  if (!STI.is64Bit() || !MF.hasEHFunclets() ||
-  classifyEHPersonality(F.getPersonalityFn()) != EHPersonality::MSVC_CXX)
-return;
+  if (STI.is64Bit() && MF.hasEHFunclets() &&
+  classifyEHPersonality(MF.getFunction().getPersonalityFn()) ==
+  EHPersonality::MSVC_CXX) {
+adjustFrameForMsvcCxxEh(MF);
+  }
+}
 
+void X86FrameLowering::adjustFrameForMsvcCxxEh(MachineFunction &MF) const {
   // Win64 C++ EH needs to allocate the UnwindHelp object at some fixed offset
   // relative to RSP after the prologue.  Find the offset of the last fixed
   // object, so that we can allocate a slot immediately following it. If there

diff  --git a/llvm/lib/Target/X86/X86FrameLowering.h 
b/llvm/lib/Target/X86/X86FrameLowering.h
index f77a4843bba4..26e80811af2e 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.h
+++ b/llvm/lib/Target/X86/X86FrameLowering.h
@@ -224,6 +224,8 @@ class X86FrameLowering : public TargetFrameLowering {
const DebugLoc &DL, uint64_t Offset,
uint64_t Align) const;
 
+  void adjustFrameForMsvcCxxEh(MachineFunction &MF) const;
+
   /// Aligns the stack pointer by ANDing it with -MaxAlign.
   void BuildStackAlignAND(MachineBasicBlock &MBB,
   MachineBasicBlock::iterator MBBI, const DebugLoc &DL,

diff  --git a/llvm/test/CodeGen/X86/win64_regcall.ll 
b/llvm/test/CodeGen/X86/win64_regcall.ll
new file mode 100644
index ..4cd051928f36
--- /dev/null
+++ b/llvm/test/CodeGen/X86/win64_regcall.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s
+
+define dso_local x86_regcallcc void @ensure_align() local_unnamed_addr #0 {
+entry:
+  %b = alloca i32, align 4
+  call void asm sideeffect "nopl $0", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* 
nonnull %b)
+  ret void
+}
+
+; CHECK-LABEL: ensure_align: # @ensure_align
+; CHECK: .seh_stackalloc 8
+; CHECK: .seh_endprologue



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] 9d50958 - [libc++] Fix build after 51faba35fd81fbd3af407a29c136895a718ccd96

2021-01-25 Thread Louis Dionne via llvm-branch-commits

Author: Ruslan Arutyunyan
Date: 2021-01-25T13:40:47-05:00
New Revision: 9d5095875754046972d8512d98194acf7f032e36

URL: 
https://github.com/llvm/llvm-project/commit/9d5095875754046972d8512d98194acf7f032e36
DIFF: 
https://github.com/llvm/llvm-project/commit/9d5095875754046972d8512d98194acf7f032e36.diff

LOG: [libc++] Fix build after 51faba35fd81fbd3af407a29c136895a718ccd96

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

Added: 


Modified: 
libcxx/include/variant

Removed: 




diff  --git a/libcxx/include/variant b/libcxx/include/variant
index cb46f09bdc06..2dfab9d40dd7 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1635,10 +1635,10 @@ constexpr bool operator>=(const variant<_Types...>& 
__lhs,
   __lhs.index(), __convert_to_bool>{}, __lhs, __rhs);
 }
 
-template 
+template 
 inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr void __throw_if_valueless(_Visitor&& __visitor, _Vs&&... __vs) {
+constexpr void __throw_if_valueless(_Vs&&... __vs) {
   const bool __valueless = (... || __vs.valueless_by_exception());
   if (__valueless) {
   __throw_bad_variant_access();
@@ -1650,8 +1650,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
 constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
   using __variant_detail::__visitation::__variant;
-  _VSTD::__throw_if_valueless(_VSTD::forward<_Visitor>(__visitor),
-  _VSTD::forward<_Vs>(__vs)...);
+  _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...);
   return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor),
   _VSTD::forward<_Vs>(__vs)...);
 }
@@ -1662,8 +1661,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
 constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) {
   using __variant_detail::__visitation::__variant;
-  _VSTD::__throw_if_valueless(_VSTD::forward<_Visitor>(__visitor),
-  _VSTD::forward<_Vs>(__vs)...);
+  _VSTD::__throw_if_valueless(_VSTD::forward<_Vs>(__vs)...);
   return __variant::__visit_value<_Rp>(_VSTD::forward<_Visitor>(__visitor),
_VSTD::forward<_Vs>(__vs)...);
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 239cfbc - [RISCV] Custom type legalize i8/i16 UDIV/UREM/SDIV on RV64 so we can use divuw/remuw/divw.

2021-01-25 Thread Craig Topper via llvm-branch-commits

Author: Craig Topper
Date: 2021-01-25T10:47:22-08:00
New Revision: 239cfbccb0509da1a08d9e746706013b732e646b

URL: 
https://github.com/llvm/llvm-project/commit/239cfbccb0509da1a08d9e746706013b732e646b
DIFF: 
https://github.com/llvm/llvm-project/commit/239cfbccb0509da1a08d9e746706013b732e646b.diff

LOG: [RISCV] Custom type legalize i8/i16 UDIV/UREM/SDIV on RV64 so we can use 
divuw/remuw/divw.

This makes our i8/i16 codegen more similar to the i32 codegen.

I've also added computeKnownBits support for DIVUW/REMUW so
that we can remove zero extending ANDs from the output. Without
this we end up turning DIVUW/REMUW back into DIVU/REMU via some
isel patterns.

Reviewed By: frasercrmck, luismarques

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

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/test/CodeGen/RISCV/rv64m-exhaustive-w-insts.ll

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 54208fc187c9..7d2dae71fc00 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -199,6 +199,13 @@ RISCVTargetLowering::RISCVTargetLowering(const 
TargetMachine &TM,
 
   if (Subtarget.is64Bit() && Subtarget.hasStdExtM()) {
 setOperationAction(ISD::MUL, MVT::i32, Custom);
+
+setOperationAction(ISD::SDIV, MVT::i8, Custom);
+setOperationAction(ISD::UDIV, MVT::i8, Custom);
+setOperationAction(ISD::UREM, MVT::i8, Custom);
+setOperationAction(ISD::SDIV, MVT::i16, Custom);
+setOperationAction(ISD::UDIV, MVT::i16, Custom);
+setOperationAction(ISD::UREM, MVT::i16, Custom);
 setOperationAction(ISD::SDIV, MVT::i32, Custom);
 setOperationAction(ISD::UDIV, MVT::i32, Custom);
 setOperationAction(ISD::UREM, MVT::i32, Custom);
@@ -1436,11 +1443,12 @@ static RISCVISD::NodeType getRISCVWOpcode(unsigned 
Opcode) {
 // be promoted to i64, making it 
diff icult to select the SLLW/DIVUW/.../*W
 // later one because the fact the operation was originally of type i32 is
 // lost.
-static SDValue customLegalizeToWOp(SDNode *N, SelectionDAG &DAG) {
+static SDValue customLegalizeToWOp(SDNode *N, SelectionDAG &DAG,
+   unsigned ExtOpc = ISD::ANY_EXTEND) {
   SDLoc DL(N);
   RISCVISD::NodeType WOpcode = getRISCVWOpcode(N->getOpcode());
-  SDValue NewOp0 = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, 
N->getOperand(0));
-  SDValue NewOp1 = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, 
N->getOperand(1));
+  SDValue NewOp0 = DAG.getNode(ExtOpc, DL, MVT::i64, N->getOperand(0));
+  SDValue NewOp1 = DAG.getNode(ExtOpc, DL, MVT::i64, N->getOperand(1));
   SDValue NewRes = DAG.getNode(WOpcode, DL, MVT::i64, NewOp0, NewOp1);
   // ReplaceNodeResults requires we maintain the same type for the return 
value.
   return DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, NewRes);
@@ -1537,14 +1545,26 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
 break;
   case ISD::SDIV:
   case ISD::UDIV:
-  case ISD::UREM:
-assert(N->getValueType(0) == MVT::i32 && Subtarget.is64Bit() &&
-   Subtarget.hasStdExtM() && "Unexpected custom legalisation");
+  case ISD::UREM: {
+MVT VT = N->getSimpleValueType(0);
+assert((VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32) &&
+   Subtarget.is64Bit() && Subtarget.hasStdExtM() &&
+   "Unexpected custom legalisation");
 if (N->getOperand(0).getOpcode() == ISD::Constant ||
 N->getOperand(1).getOpcode() == ISD::Constant)
   return;
-Results.push_back(customLegalizeToWOp(N, DAG));
+
+// If the input is i32, use ANY_EXTEND since the W instructions don't read
+// the upper 32 bits. For other types we need to sign or zero extend
+// based on the opcode.
+unsigned ExtOpc = ISD::ANY_EXTEND;
+if (VT != MVT::i32)
+  ExtOpc = N->getOpcode() == ISD::SDIV ? ISD::SIGN_EXTEND
+   : ISD::ZERO_EXTEND;
+
+Results.push_back(customLegalizeToWOp(N, DAG, ExtOpc));
 break;
+  }
   case ISD::BITCAST: {
 assert(((N->getValueType(0) == MVT::i32 && Subtarget.is64Bit() &&
  Subtarget.hasStdExtF()) ||
@@ -2147,6 +2167,7 @@ void 
RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
 const APInt 
&DemandedElts,
 const SelectionDAG 
&DAG,
 unsigned Depth) const {
+  unsigned BitWidth = Known.getBitWidth();
   unsigned Opc = Op.getOpcode();
   assert((Opc >= ISD::BUILTIN_OP_END ||
   Opc == ISD::INTRINSIC_WO_CHAIN ||
@@ -2158,6 +2179,26 @@ void 
RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
   Known.resetAll();
   switch (Opc) {
   default: break;
+  c

[llvm-branch-commits] [clang-tools-extra] f05b492 - [clangd][NFC] Simplify handing on methods with no params

2021-01-25 Thread Nathan James via llvm-branch-commits

Author: Nathan James
Date: 2021-01-25T19:08:10Z
New Revision: f05b492aae4d4a741ec59f19518df91a3012824c

URL: 
https://github.com/llvm/llvm-project/commit/f05b492aae4d4a741ec59f19518df91a3012824c
DIFF: 
https://github.com/llvm/llvm-project/commit/f05b492aae4d4a741ec59f19518df91a3012824c.diff

LOG: [clangd][NFC] Simplify handing on methods with no params

Add bind methods handling the case when a method has an empty params interface 
and when it has no parameters.

Remove ShutdownParams and ExitParams from Protocol, In LSP they aren't defined, 
instead the methods are defined to have void as the params. This signature now 
better reflects that.

Reviewed By: sammccall

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/Protocol.h

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 24d3a3509ca8..930cc3f6c5d9 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -258,6 +258,15 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
 };
   }
 
+  template 
+  void bind(const char *Method,
+void (ClangdLSPServer::*Handler)(Callback)) {
+Calls[Method] = [Handler, this](llvm::json::Value RawParams,
+ReplyOnce Reply) {
+  (Server.*Handler)(std::move(Reply));
+};
+  }
+
   // Bind a reply callback to a request. The callback will be invoked when
   // clangd receives the reply from the LSP client.
   // Return a call id of the request.
@@ -301,6 +310,20 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
 };
   }
 
+  void bind(const char *Method, void (ClangdLSPServer::*Handler)()) {
+Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
+  (Server.*Handler)();
+};
+  }
+
+  template <>
+  void bind(const char *Method,
+  void (ClangdLSPServer::*Handler)(const NoParams &)) {
+Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
+  (Server.*Handler)(NoParams{});
+};
+  }
+
 private:
   // Function object to reply to an LSP call.
   // Each instance must be called exactly once, otherwise:
@@ -647,8 +670,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams 
&Params,
 
 void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
 
-void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
- Callback Reply) {
+void ClangdLSPServer::onShutdown(Callback Reply) {
   // Do essentially nothing, just say we're ready to exit.
   ShutdownRequestReceived = true;
   Reply(nullptr);
@@ -656,8 +678,7 @@ void ClangdLSPServer::onShutdown(const ShutdownParams 
&Params,
 
 // sync is a clangd extension: it blocks until all background work completes.
 // It blocks the calling thread, so no messages are processed until it returns!
-void ClangdLSPServer::onSync(const NoParams &Params,
- Callback Reply) {
+void ClangdLSPServer::onSync(Callback Reply) {
   if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
 Reply(nullptr);
   else
@@ -1445,8 +1466,7 @@ void ClangdLSPServer::onSemanticTokensDelta(
   });
 }
 
-void ClangdLSPServer::onMemoryUsage(const NoParams &,
-Callback Reply) {
+void ClangdLSPServer::onMemoryUsage(Callback Reply) {
   llvm::BumpPtrAllocator DetailAlloc;
   MemoryTree MT(&DetailAlloc);
   profile(MT);

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h 
b/clang-tools-extra/clangd/ClangdLSPServer.h
index 3a46bd7b1bea..d8ce2dbe53db 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -93,8 +93,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
   // Calls have signature void(const Params&, Callback).
   void onInitialize(const InitializeParams &, Callback);
   void onInitialized(const InitializedParams &);
-  void onShutdown(const ShutdownParams &, Callback);
-  void onSync(const NoParams &, Callback);
+  void onShutdown(Callback);
+  void onSync(Callback);
   void onDocumentDidOpen(const DidOpenTextDocumentParams &);
   void onDocumentDidChange(const DidChangeTextDocumentParams &);
   void onDocumentDidClose(const DidCloseTextDocumentParams &);
@@ -161,7 +161,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
  Callback);
   /// This is a clangd extension. Provides a json tree representing memory 
usage
   /// hierarchy.
-  void onMemoryUsage(const NoParams &, Callback);
+  void onMemoryUsage(Callback);
 
   std::vector getFixes(StringRef File, const clangd::Diagnostic &D);
 

diff  --git a/clang-tools-extra/clangd/Pr

[llvm-branch-commits] [openmp] 27cc4a8 - [OpenMP][NVPTX] Rewrite CUDA intrinsics with NVVM intrinsics

2021-01-25 Thread Shilei Tian via llvm-branch-commits

Author: Shilei Tian
Date: 2021-01-25T14:14:30-05:00
New Revision: 27cc4a8138d819f78bc4fc028e39772bbda84dbd

URL: 
https://github.com/llvm/llvm-project/commit/27cc4a8138d819f78bc4fc028e39772bbda84dbd
DIFF: 
https://github.com/llvm/llvm-project/commit/27cc4a8138d819f78bc4fc028e39772bbda84dbd.diff

LOG: [OpenMP][NVPTX] Rewrite CUDA intrinsics with NVVM intrinsics

This patch makes prep for dropping CUDA when compiling `deviceRTLs`.
CUDA intrinsics are replaced by NVVM intrinsics which refers to code in
`__clang_cuda_intrinsics.h`. We don't want to directly include it because in the
near future we're going to switch to OpenMP and by then the header cannot be
used anymore.

Reviewed By: JonChesterfield

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

Added: 


Modified: 
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu

Removed: 




diff  --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu 
b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
index 1e3ba7d664af..09bf45b005c8 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
@@ -16,20 +16,6 @@
 
 #include 
 
-// Forward declaration of CUDA primitives which will be evetually transformed
-// into LLVM intrinsics.
-extern "C" {
-unsigned int __activemask();
-unsigned int __ballot(unsigned);
-// The default argument here is based on NVIDIA's website
-// https://developer.nvidia.com/blog/using-cuda-warp-level-primitives/
-int __shfl_sync(unsigned mask, int val, int src_line, int width = WARPSIZE);
-int __shfl(int val, int src_line, int width = WARPSIZE);
-int __shfl_down(int var, unsigned detla, int width);
-int __shfl_down_sync(unsigned mask, int var, unsigned detla, int width);
-void __syncwarp(int mask);
-}
-
 DEVICE void __kmpc_impl_unpack(uint64_t val, uint32_t &lo, uint32_t &hi) {
   asm volatile("mov.b64 {%0,%1}, %2;" : "=r"(lo), "=r"(hi) : "l"(val));
 }
@@ -71,10 +57,12 @@ DEVICE double __kmpc_impl_get_wtime() {
 
 // In Cuda 9.0, __ballot(1) from Cuda 8.0 is replaced with __activemask().
 DEVICE __kmpc_impl_lanemask_t __kmpc_impl_activemask() {
-#if CUDA_VERSION >= 9000
-  return __activemask();
+#if CUDA_VERSION < 9020
+  return __nvvm_vote_ballot(1);
 #else
-  return __ballot(1);
+  unsigned int Mask;
+  asm volatile("activemask.b32 %0;" : "=r"(Mask));
+  return Mask;
 #endif
 }
 
@@ -82,19 +70,20 @@ DEVICE __kmpc_impl_lanemask_t __kmpc_impl_activemask() {
 DEVICE int32_t __kmpc_impl_shfl_sync(__kmpc_impl_lanemask_t Mask, int32_t Var,
  int32_t SrcLane) {
 #if CUDA_VERSION >= 9000
-  return __shfl_sync(Mask, Var, SrcLane);
+  return __nvvm_shfl_sync_idx_i32(Mask, Var, SrcLane, 0x1f);
 #else
-  return __shfl(Var, SrcLane);
+  return __nvvm_shfl_idx_i32(Var, SrcLane, 0x1f);
 #endif // CUDA_VERSION
 }
 
 DEVICE int32_t __kmpc_impl_shfl_down_sync(__kmpc_impl_lanemask_t Mask,
   int32_t Var, uint32_t Delta,
   int32_t Width) {
+  int32_t T = ((WARPSIZE - Width) << 8) | 0x1f;
 #if CUDA_VERSION >= 9000
-  return __shfl_down_sync(Mask, Var, Delta, Width);
+  return __nvvm_shfl_sync_down_i32(Mask, Var, Delta, T);
 #else
-  return __shfl_down(Var, Delta, Width);
+  return __nvvm_shfl_down_i32(Var, Delta, T);
 #endif // CUDA_VERSION
 }
 
@@ -102,7 +91,7 @@ DEVICE void __kmpc_impl_syncthreads() { __syncthreads(); }
 
 DEVICE void __kmpc_impl_syncwarp(__kmpc_impl_lanemask_t Mask) {
 #if CUDA_VERSION >= 9000
-  __syncwarp(Mask);
+  __nvvm_bar_warp_sync(Mask);
 #else
   // In Cuda < 9.0 no need to sync threads in warps.
 #endif // CUDA_VERSION



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] f5c7c03 - [mlir] Add C API for IntegerSet

2021-01-25 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2021-01-25T20:16:22+01:00
New Revision: f5c7c031e2493168b3c2cfea3219e2131cc01483

URL: 
https://github.com/llvm/llvm-project/commit/f5c7c031e2493168b3c2cfea3219e2131cc01483
DIFF: 
https://github.com/llvm/llvm-project/commit/f5c7c031e2493168b3c2cfea3219e2131cc01483.diff

LOG: [mlir] Add C API for IntegerSet

Depends On D95357

Reviewed By: stellaraccident

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

Added: 
mlir/include/mlir-c/IntegerSet.h
mlir/include/mlir/CAPI/IntegerSet.h
mlir/lib/CAPI/IR/IntegerSet.cpp

Modified: 
mlir/include/mlir/IR/IntegerSet.h
mlir/lib/CAPI/IR/CMakeLists.txt
mlir/test/CAPI/ir.c

Removed: 




diff  --git a/mlir/include/mlir-c/IntegerSet.h 
b/mlir/include/mlir-c/IntegerSet.h
new file mode 100644
index ..058be414d2ee
--- /dev/null
+++ b/mlir/include/mlir-c/IntegerSet.h
@@ -0,0 +1,131 @@
+//===-- mlir-c/IntegerSet.h - C API for MLIR Affine maps --*- C 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
+// Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef MLIR_C_INTEGERSET_H
+#define MLIR_C_INTEGERSET_H
+
+#include "mlir-c/AffineExpr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//===--===//
+// Opaque type declarations.
+//
+// Types are exposed to C bindings as structs containing opaque pointers. They
+// are not supposed to be inspected from C. This allows the underlying
+// representation to change without affecting the API users. The use of structs
+// instead of typedefs enables some type safety as structs are not implicitly
+// convertible to each other.
+//
+// Instances of these types may or may not own the underlying object. The
+// ownership semantics is defined by how an instance of the type was obtained.
+//===--===//
+
+#define DEFINE_C_API_STRUCT(name, storage) 
\
+  struct name {
\
+storage *ptr;  
\
+  };   
\
+  typedef struct name name
+
+DEFINE_C_API_STRUCT(MlirIntegerSet, const void);
+
+#undef DEFINE_C_API_STRUCT
+
+/// Gets the context in which the given integer set lives.
+MLIR_CAPI_EXPORTED MlirContext mlirIntegerSetGetContext(MlirIntegerSet set);
+
+/// Checks whether an integer set is a null object.
+static inline bool mlirIntegerSetIsNull(MlirIntegerSet set) { return !set.ptr; 
}
+
+/// Checks if two integer set objects are equal. This is a "shallow" comparison
+/// of two objects. Only the sets with some small number of constraints are
+/// uniqued and compare equal here. Set objects that represent the same integer
+/// set with 
diff erent constraints may be considered non-equal by this check.
+/// Set 
diff erence followed by an (expensive) emptiness check should be used to
+/// check equivalence of the underlying integer sets.
+MLIR_CAPI_EXPORTED bool mlirIntegerSetEqual(MlirIntegerSet s1,
+MlirIntegerSet s2);
+
+/// Prints an integer set by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
+MLIR_CAPI_EXPORTED void mlirIntegerSetPrint(MlirIntegerSet set,
+MlirStringCallback callback,
+void *userData);
+
+/// Prints an integer set to the standard error stream.
+MLIR_CAPI_EXPORTED void mlirIntegerSetDump(MlirIntegerSet set);
+
+/// Gets or creates a new canonically empty integer set with the give number of
+/// dimensions and symbols in the given context.
+MLIR_CAPI_EXPORTED MlirIntegerSet mlirIntegerSetEmptyGet(MlirContext context,
+ intptr_t numDims,
+ intptr_t numSymbols);
+
+/// Gets or creates a new integer set in the given context. The set is defined
+/// by a list of affine constraints, with the given number of input dimensions
+/// and symbols, which are treated as either equalities (eqFlags is 1) or
+/// inequalities (eqFlags is 0). Both `constraints` and `eqFlags` are expected
+/// to point to at least `numConstraint` consecutive values.
+MLIR_CAPI_EXPORTED MlirIntegerSet
+mlirIntegerSetGet(MlirContext context, intptr_t numDims, intptr_t numSymbols,
+  intptr_t numConstraints, const MlirAffineExpr *constraints,
+ 

[llvm-branch-commits] [llvm] d368128 - [GVN] do not repeat PRE on failure to split critical edge

2021-01-25 Thread Nick Desaulniers via llvm-branch-commits

Author: Nick Desaulniers
Date: 2021-01-25T11:23:44-08:00
New Revision: d36812892c16b551f058774babbc8727737f80cd

URL: 
https://github.com/llvm/llvm-project/commit/d36812892c16b551f058774babbc8727737f80cd
DIFF: 
https://github.com/llvm/llvm-project/commit/d36812892c16b551f058774babbc8727737f80cd.diff

LOG: [GVN] do not repeat PRE on failure to split critical edge

Fixes an infinite loop encountered in GVN.

GVN will delay PRE if it encounters critical edges, attempt to split
them later via calls to SplitCriticalEdge(), then restart.

The caller of GVN::splitCriticalEdges() assumed a return value of true
meant that critical edges were split, that the IR had changed, and that
PRE should be re-attempted, upon which we loop infinitely.

This was exposed after D88438, by compiling the Linux kernel for s390,
but the test case is reproducible on x86.

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1261

Reviewed By: void

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

Added: 
llvm/test/Transforms/GVN/critical-edge-split-failure.ll

Modified: 
llvm/lib/Transforms/Scalar/GVN.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/GVN.cpp 
b/llvm/lib/Transforms/Scalar/GVN.cpp
index 72248babba7e..c6b6d75aefe8 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -2673,9 +2673,11 @@ BasicBlock *GVN::splitCriticalEdges(BasicBlock *Pred, 
BasicBlock *Succ) {
   BasicBlock *BB = SplitCriticalEdge(
   Pred, Succ,
   CriticalEdgeSplittingOptions(DT, LI, MSSAU).unsetPreserveLoopSimplify());
-  if (MD)
-MD->invalidateCachedPredecessors();
-  InvalidBlockRPONumbers = true;
+  if (BB) {
+if (MD)
+  MD->invalidateCachedPredecessors();
+InvalidBlockRPONumbers = true;
+  }
   return BB;
 }
 
@@ -2684,14 +2686,20 @@ BasicBlock *GVN::splitCriticalEdges(BasicBlock *Pred, 
BasicBlock *Succ) {
 bool GVN::splitCriticalEdges() {
   if (toSplit.empty())
 return false;
+
+  bool Changed = false;
   do {
 std::pair Edge = toSplit.pop_back_val();
-SplitCriticalEdge(Edge.first, Edge.second,
-  CriticalEdgeSplittingOptions(DT, LI, MSSAU));
+Changed |= SplitCriticalEdge(Edge.first, Edge.second,
+ CriticalEdgeSplittingOptions(DT, LI, MSSAU)) 
!=
+   nullptr;
   } while (!toSplit.empty());
-  if (MD) MD->invalidateCachedPredecessors();
-  InvalidBlockRPONumbers = true;
-  return true;
+  if (Changed) {
+if (MD)
+  MD->invalidateCachedPredecessors();
+InvalidBlockRPONumbers = true;
+  }
+  return Changed;
 }
 
 /// Executes one iteration of GVN

diff  --git a/llvm/test/Transforms/GVN/critical-edge-split-failure.ll 
b/llvm/test/Transforms/GVN/critical-edge-split-failure.ll
new file mode 100644
index ..662efd45bf25
--- /dev/null
+++ b/llvm/test/Transforms/GVN/critical-edge-split-failure.ll
@@ -0,0 +1,49 @@
+; RUN: opt -gvn -S -o - %s | FileCheck %s
+; RUN: opt -passes=gvn -S -o - %s | FileCheck %s
+
+%struct.sk_buff = type opaque
+
+@l2tp_recv_dequeue_session = external dso_local local_unnamed_addr global i32, 
align 4
+@l2tp_recv_dequeue_skb = external dso_local local_unnamed_addr global 
%struct.sk_buff*, align 8
+@l2tp_recv_dequeue_session_2 = external dso_local local_unnamed_addr global 
i32, align 4
+@l2tp_recv_dequeue_session_0 = external dso_local local_unnamed_addr global 
i32, align 4
+
+declare void @llvm.assume(i1 noundef)
+
+define dso_local void @l2tp_recv_dequeue() local_unnamed_addr {
+entry:
+  %0 = load i32, i32* @l2tp_recv_dequeue_session, align 4
+  %conv = sext i32 %0 to i64
+  %1 = inttoptr i64 %conv to %struct.sk_buff*
+  %2 = load i32, i32* @l2tp_recv_dequeue_session_2, align 4
+  %tobool.not = icmp eq i32 %2, 0
+  br label %for.cond
+
+for.cond: ; preds = %if.end, %entry
+  %storemerge = phi %struct.sk_buff* [ %1, %entry ], [ null, %if.end ]
+  store %struct.sk_buff* %storemerge, %struct.sk_buff** 
@l2tp_recv_dequeue_skb, align 8
+  br i1 %tobool.not, label %if.end, label %if.then
+
+if.then:  ; preds = %for.cond
+  %ns = bitcast %struct.sk_buff* %storemerge to i32*
+  %3 = load i32, i32* %ns, align 4
+  store i32 %3, i32* @l2tp_recv_dequeue_session_0, align 4
+; Splitting the critical edge from if.then to if.end will fail, but should not
+; cause an infinite loop in GVN. If we can one day split edges of callbr
+; indirect targets, great!
+; CHECK: callbr void asm sideeffect "", "X,~{dirflag},~{fpsr},~{flags}"(i8* 
blockaddress(@l2tp_recv_dequeue, %if.end))
+; CHECK-NEXT: to label %asm.fallthrough.i [label %if.end]
+  callbr void asm sideeffect "", "X,~{dirflag},~{fpsr},~{flags}"(i8* 
blockaddress(@l2tp_recv_dequeue, %if.end))
+  to label %asm.fallthrough.i [label %if.end]
+
+asm.fallthrough.i:; preds = %if.then
+  br label %if.end
+

[llvm-branch-commits] [lldb] 4bb6244 - [ThreadPlan] fix exec on Linux

2021-01-25 Thread Walter Erquinigo via llvm-branch-commits

Author: Walter Erquinigo
Date: 2021-01-25T11:30:48-08:00
New Revision: 4bb6244871c6914517a21f56830b3765495792f2

URL: 
https://github.com/llvm/llvm-project/commit/4bb6244871c6914517a21f56830b3765495792f2
DIFF: 
https://github.com/llvm/llvm-project/commit/4bb6244871c6914517a21f56830b3765495792f2.diff

LOG: [ThreadPlan] fix exec on Linux

Added: 


Modified: 
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Target/ProcessTrace.h
lldb/include/lldb/Target/ThreadPlan.h
lldb/include/lldb/Target/ThreadPlanStack.h
lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.h
lldb/source/Target/Process.cpp
lldb/source/Target/ProcessTrace.cpp
lldb/source/Target/ThreadPlan.cpp
lldb/source/Target/ThreadPlanStack.cpp
lldb/test/API/functionalities/exec/TestExec.py
lldb/unittests/Process/ProcessEventDataTest.cpp
lldb/unittests/Target/ExecutionContextTest.cpp
lldb/unittests/Thread/ThreadTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 5ca5dd28fd8f..fbdb5069b39f 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2014,8 +2014,17 @@ class Process : public 
std::enable_shared_from_this,
   virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true);
 
   // Thread Queries
-  virtual bool UpdateThreadList(ThreadList &old_thread_list,
-ThreadList &new_thread_list) = 0;
+
+  /// Update the thread list.
+  ///
+  /// This method performs some general clean up before invoking
+  /// \a DoUpdateThreadList, which should be implemented by each
+  /// process plugin.
+  ///
+  /// \return
+  /// \b true if the new thread list could be generated, \b false 
otherwise.
+  bool UpdateThreadList(ThreadList &old_thread_list,
+ThreadList &new_thread_list);
 
   void UpdateThreadListIfNeeded();
 
@@ -2514,6 +2523,15 @@ void PruneThreadPlans();
 bool trap_exceptions = false);
 
 protected:
+  /// Update the thread list following process plug-in's specific logic.
+  ///
+  /// This method should only be invoked by \a UpdateThreadList.
+  ///
+  /// \return
+  /// \b true if the new thread list could be generated, \b false 
otherwise.
+  virtual bool DoUpdateThreadList(ThreadList &old_thread_list,
+  ThreadList &new_thread_list) = 0;
+
   /// Actually do the reading of memory from a process.
   ///
   /// Subclasses must override this function and can return fewer bytes than

diff  --git a/lldb/include/lldb/Target/ProcessTrace.h 
b/lldb/include/lldb/Target/ProcessTrace.h
index 53b3e704c17b..55faba1576d0 100644
--- a/lldb/include/lldb/Target/ProcessTrace.h
+++ b/lldb/include/lldb/Target/ProcessTrace.h
@@ -71,8 +71,8 @@ class ProcessTrace : public PostMortemProcess {
 protected:
   void Clear();
 
-  bool UpdateThreadList(ThreadList &old_thread_list,
-ThreadList &new_thread_list) override;
+  bool DoUpdateThreadList(ThreadList &old_thread_list,
+  ThreadList &new_thread_list) override;
 
 private:
   static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,

diff  --git a/lldb/include/lldb/Target/ThreadPlan.h 
b/lldb/include/lldb/Target/ThreadPlan.h
index f4cd2b18f01a..242a4d3c2d6c 100644
--- a/lldb/include/lldb/Target/ThreadPlan.h
+++ b/lldb/include/lldb/Target/ThreadPlan.h
@@ -325,6 +325,12 @@ class ThreadPlan : public 
std::enable_shared_from_this,
 
   const Target &GetTarget() const;
 
+  /// Clear the Thread* cache.
+  ///
+  /// This is useful in situations like when a new Thread list is being
+  /// generated.
+  void ClearThreadCache();
+
   /// Print a description of this thread to the stream \a s.
   /// \a thread.  Don't expect that the result of GetThread is valid in
   /// the description method.  This might get called when the underlying

diff  --git a/lldb/include/lldb/Target/ThreadPlanStack.h 
b/lldb/include/lldb/Target/ThreadPlanStack.h
index f1874136cad8..2d2ab2cbaefe 100644
--- a/lldb/include/lldb/Target/ThreadPlanStack

[llvm-branch-commits] [llvm] 76afbf6 - [VPlan] Replace uses with new value in VPInstructionsToVPRecipe (NFC).

2021-01-25 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2021-01-25T19:38:08Z
New Revision: 76afbf60ed7fb48233c9af9f74f2e8399fd38214

URL: 
https://github.com/llvm/llvm-project/commit/76afbf60ed7fb48233c9af9f74f2e8399fd38214
DIFF: 
https://github.com/llvm/llvm-project/commit/76afbf60ed7fb48233c9af9f74f2e8399fd38214.diff

LOG: [VPlan] Replace uses with new value in VPInstructionsToVPRecipe (NFC).

Now that VPRecipeBase inherits from VPDef, we can always use the new
VPValue for replacement, if the recipe defines one. Given the recipes
that are supported at the moment, all new recipes must have either 0 or
1 defined values.

Added: 


Modified: 
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp 
b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index f5565c1e0feb..1a54603faf22 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -35,7 +35,6 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
   Plan->addCBV(NCondBit);
 }
   }
-  VPValue DummyValue;
   for (VPBlockBase *Base : RPOT) {
 // Do not widen instructions in pre-header and exit blocks.
 if (Base->getNumPredecessors() == 0 || Base->getNumSuccessors() == 0)
@@ -49,6 +48,7 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
   VPInstruction *VPInst = cast(Ingredient);
   Instruction *Inst = cast(VPInst->getUnderlyingValue());
   if (DeadInstructions.count(Inst)) {
+VPValue DummyValue;
 VPInst->replaceAllUsesWith(&DummyValue);
 Ingredient->eraseFromParent();
 continue;
@@ -80,7 +80,11 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
 new VPWidenRecipe(*Inst, Plan->mapToVPValues(Inst->operands()));
 
   NewRecipe->insertBefore(Ingredient);
-  VPInst->replaceAllUsesWith(&DummyValue);
+  if (NewRecipe->getNumDefinedValues() == 1)
+VPInst->replaceAllUsesWith(NewRecipe->getVPValue());
+  else
+assert(NewRecipe->getNumDefinedValues() == 0 &&
+   "Only recpies with zero or one defined values expected");
   Ingredient->eraseFromParent();
 }
   }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9946b16 - [lit] Use os.cpu_count() to cleanup TODO

2021-01-25 Thread Julian Lettner via llvm-branch-commits

Author: Julian Lettner
Date: 2021-01-25T11:44:18-08:00
New Revision: 9946b169c379daee603436a4753acfef8be373dd

URL: 
https://github.com/llvm/llvm-project/commit/9946b169c379daee603436a4753acfef8be373dd
DIFF: 
https://github.com/llvm/llvm-project/commit/9946b169c379daee603436a4753acfef8be373dd.diff

LOG: [lit] Use os.cpu_count() to cleanup TODO

We can now use Python3.  Let's use `os.cpu_count()` to cleanup this
helper.

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

Added: 


Modified: 
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/run.py
llvm/utils/lit/lit/util.py

Removed: 




diff  --git a/llvm/utils/lit/lit/cl_arguments.py 
b/llvm/utils/lit/lit/cl_arguments.py
index ce49c3c48a97..ddb4d25cbba1 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -23,7 +23,7 @@ def parse_args():
 metavar="N",
 help="Number of workers used for testing",
 type=_positive_int,
-default=lit.util.detectCPUs())
+default=lit.util.usable_core_count())
 parser.add_argument("--config-prefix",
 dest="configPrefix",
 metavar="NAME",

diff  --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index 5aef77e5f605..255e63329432 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -110,7 +110,7 @@ def _update_test(self, local_test, remote_test):
 # threads counts toward the current process limit. Try to raise the (soft)
 # process limit so that tests don't fail due to resource exhaustion.
 def _increase_process_limit(self):
-ncpus = lit.util.detectCPUs()
+ncpus = lit.util.usable_core_count()
 desired_limit = self.workers * ncpus * 2 # the 2 is a safety factor
 
 # Importing the resource module will likely fail on Windows.

diff  --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index d7afbdabcff9..0d8f0040f41c 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -109,32 +109,23 @@ def to_unicode(s):
 return s
 
 
-# TODO(yln): multiprocessing.cpu_count()
-# TODO(python3): len(os.sched_getaffinity(0)) and os.cpu_count()
-def detectCPUs():
-"""Detects the number of CPUs on a system.
-
-Cribbed from pp.
+def usable_core_count():
+"""Return the number of cores the current process can use, if supported.
+Otherwise, return the total number of cores (like `os.cpu_count()`).
+Default to 1 if undetermined.
 
 """
-# Linux, Unix and MacOS:
-if hasattr(os, 'sysconf'):
-if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
-# Linux & Unix:
-ncpus = os.sysconf('SC_NPROCESSORS_ONLN')
-if isinstance(ncpus, int) and ncpus > 0:
-return ncpus
-else:  # OSX:
-return int(subprocess.check_output(['sysctl', '-n', 'hw.ncpu'],
-   stderr=subprocess.STDOUT))
-# Windows:
-if 'NUMBER_OF_PROCESSORS' in os.environ:
-ncpus = int(os.environ['NUMBER_OF_PROCESSORS'])
-if ncpus > 0:
-# With more than 32 processes, process creation often fails with
-# "Too many open files".  FIXME: Check if there's a better fix.
-return min(ncpus, 32)
-return 1  # Default
+try:
+n = len(os.sched_getaffinity(0))
+except AttributeError:
+n = os.cpu_count() or 1
+
+# On Windows, with more than 32 processes, process creation often fails 
with
+# "Too many open files".  FIXME: Check if there's a better fix.
+if platform.system() == 'Windows':
+return min(n, 32)
+
+return n
 
 
 def mkdir(path):



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] 9d9ceb3 - Revert "[clangd][NFC] Simplify handing on methods with no params"

2021-01-25 Thread Keith Smiley via llvm-branch-commits

Author: Keith Smiley
Date: 2021-01-25T11:56:18-08:00
New Revision: 9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57

URL: 
https://github.com/llvm/llvm-project/commit/9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57
DIFF: 
https://github.com/llvm/llvm-project/commit/9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57.diff

LOG: Revert "[clangd][NFC] Simplify handing on methods with no params"

This broke the build http://lab.llvm.org:8011/#/builders/7/builds/1405

This reverts commit f05b492aae4d4a741ec59f19518df91a3012824c.

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/Protocol.h

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 930cc3f6c5d9..24d3a3509ca8 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -258,15 +258,6 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
 };
   }
 
-  template 
-  void bind(const char *Method,
-void (ClangdLSPServer::*Handler)(Callback)) {
-Calls[Method] = [Handler, this](llvm::json::Value RawParams,
-ReplyOnce Reply) {
-  (Server.*Handler)(std::move(Reply));
-};
-  }
-
   // Bind a reply callback to a request. The callback will be invoked when
   // clangd receives the reply from the LSP client.
   // Return a call id of the request.
@@ -310,20 +301,6 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
 };
   }
 
-  void bind(const char *Method, void (ClangdLSPServer::*Handler)()) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)();
-};
-  }
-
-  template <>
-  void bind(const char *Method,
-  void (ClangdLSPServer::*Handler)(const NoParams &)) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)(NoParams{});
-};
-  }
-
 private:
   // Function object to reply to an LSP call.
   // Each instance must be called exactly once, otherwise:
@@ -670,7 +647,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams 
&Params,
 
 void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
 
-void ClangdLSPServer::onShutdown(Callback Reply) {
+void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
+ Callback Reply) {
   // Do essentially nothing, just say we're ready to exit.
   ShutdownRequestReceived = true;
   Reply(nullptr);
@@ -678,7 +656,8 @@ void ClangdLSPServer::onShutdown(Callback 
Reply) {
 
 // sync is a clangd extension: it blocks until all background work completes.
 // It blocks the calling thread, so no messages are processed until it returns!
-void ClangdLSPServer::onSync(Callback Reply) {
+void ClangdLSPServer::onSync(const NoParams &Params,
+ Callback Reply) {
   if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
 Reply(nullptr);
   else
@@ -1466,7 +1445,8 @@ void ClangdLSPServer::onSemanticTokensDelta(
   });
 }
 
-void ClangdLSPServer::onMemoryUsage(Callback Reply) {
+void ClangdLSPServer::onMemoryUsage(const NoParams &,
+Callback Reply) {
   llvm::BumpPtrAllocator DetailAlloc;
   MemoryTree MT(&DetailAlloc);
   profile(MT);

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h 
b/clang-tools-extra/clangd/ClangdLSPServer.h
index d8ce2dbe53db..3a46bd7b1bea 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -93,8 +93,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
   // Calls have signature void(const Params&, Callback).
   void onInitialize(const InitializeParams &, Callback);
   void onInitialized(const InitializedParams &);
-  void onShutdown(Callback);
-  void onSync(Callback);
+  void onShutdown(const ShutdownParams &, Callback);
+  void onSync(const NoParams &, Callback);
   void onDocumentDidOpen(const DidOpenTextDocumentParams &);
   void onDocumentDidChange(const DidChangeTextDocumentParams &);
   void onDocumentDidClose(const DidCloseTextDocumentParams &);
@@ -161,7 +161,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
  Callback);
   /// This is a clangd extension. Provides a json tree representing memory 
usage
   /// hierarchy.
-  void onMemoryUsage(Callback);
+  void onMemoryUsage(const NoParams &, Callback);
 
   std::vector getFixes(StringRef File, const clangd::Diagnostic &D);
 

diff  --git a/clang-tools-extra/clangd/Protocol.h 
b/clang-tools-extra/clangd/Protocol.h
index 43c95686868b..9f0e50fe863f 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -265,6 +

[llvm-branch-commits] [clang] 53176c1 - [ObjC][ARC] Annotate calls with attributes instead of emitting retainRV

2021-01-25 Thread Akira Hatanaka via llvm-branch-commits

Author: Akira Hatanaka
Date: 2021-01-25T11:57:08-08:00
New Revision: 53176c168061d6f26dcf3ce4fa59288b7d67255e

URL: 
https://github.com/llvm/llvm-project/commit/53176c168061d6f26dcf3ce4fa59288b7d67255e
DIFF: 
https://github.com/llvm/llvm-project/commit/53176c168061d6f26dcf3ce4fa59288b7d67255e.diff

LOG: [ObjC][ARC] Annotate calls with attributes instead of emitting retainRV
or claimRV calls in the IR

Background:

This patch makes changes to the front-end and middle-end that are
needed to fix a longstanding problem where llvm breaks ARC's autorelease
optimization (see the link below) by separating calls from the marker
instructions or retainRV/claimRV calls. The backend changes are in
https://reviews.llvm.org/D92569.

https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue

What this patch does to fix the problem:

- The front-end annotates calls with attribute "clang.arc.rv"="retain"
  or "clang.arc.rv"="claim", which indicates the call is implicitly
  followed by a marker instruction and a retainRV/claimRV call that
  consumes the call result. This is currently done only when the target
  is arm64 and the optimization level is higher than -O0.

- ARC optimizer temporarily emits retainRV/claimRV calls after the
  annotated calls in the IR and removes the inserted calls after
  processing the function.

- ARC contract pass emits retainRV/claimRV calls after the annotated
  calls. It doesn't remove the attribute on the call since the backend
  needs it to emit the marker instruction. The retainRV/claimRV calls
  are emitted late in the pipeline to prevent optimization passes from
  transforming the IR in a way that makes it harder for the ARC
  middle-end passes to figure out the def-use relationship between the
  call and the retainRV/claimRV calls (which is the cause of PR31925).

- The function inliner removes the autoreleaseRV call in the callee that
  returns the result if nothing in the callee prevents it from being
  paired up with the calls annotated with "clang.arc.rv"="retain/claim"
  in the caller. If the call is annotated with "claim", a release call
  is inserted since autoreleaseRV+claimRV is equivalent to a release. If
  it cannot find an autoreleaseRV call, it tries to transfer the
  attributes to a function call in the callee. This is important since
  ARC optimizer can remove the autoreleaseRV call returning the callee
  result, which makes it impossible to pair it up with the retainRV or
  claimRV call in the caller. If that fails, it simply emits a retain
  call in the IR if the call is annotated with "retain" and does nothing
  if it's annotated with "claim".

- This patch teaches dead argument elimination pass not to change the
  return type of a function if any of the calls to the function are
  annotated with attribute "clang.arc.rv". This is necessary since the
  pass can incorrectly determine nothing in the IR uses the function
  return, which can happen since the front-end no longer explicitly
  emits retainRV/claimRV calls in the IR, and change its return type to
  'void'.

Future work:

- Use the attribute on x86-64.

- Fix the auto upgrader to convert call+retainRV/claimRV pairs into
  calls annotated with the attributes.

rdar://71443534

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

Added: 
clang/test/CodeGenObjC/arc-rv-attr.m
llvm/include/llvm/Analysis/ObjCARCRVAttr.h
llvm/test/Transforms/Inline/inline-retainRV-call.ll
llvm/test/Transforms/ObjCARC/contract-rv-attr.ll

Modified: 
clang/lib/CodeGen/CGObjC.cpp
clang/test/CodeGenObjC/arc-unsafeclaim.m
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/IR/Instruction.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
llvm/lib/Transforms/ObjCARC/ObjCARC.h
llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
llvm/lib/Transforms/ObjCARC/PtrState.cpp
llvm/lib/Transforms/ObjCARC/PtrState.h
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/CodeGen/AArch64/call-rv-marker.ll
llvm/test/Transforms/DeadArgElim/deadretval.ll
llvm/test/Transforms/ObjCARC/contract-marker-funclet.ll
llvm/test/Transforms/ObjCARC/rv.ll

Removed: 




diff  --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 3f930c76fe0a..84744fb029b6 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -23,6 +23,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Analysis/ObjCARCRVAttr.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/InlineAsm.h"
@@ -2304,10 +2305,11 @@ static void 
emitAutoreleasedReturnValueMark

[llvm-branch-commits] [clang] 6cb2887 - [clang-format] [NFC] Use some constexpr StringRef

2021-01-25 Thread Björn Schäpers via llvm-branch-commits

Author: Björn Schäpers
Date: 2021-01-25T21:02:40+01:00
New Revision: 6cb288797122ad931aba91e05030c24984e1031c

URL: 
https://github.com/llvm/llvm-project/commit/6cb288797122ad931aba91e05030c24984e1031c
DIFF: 
https://github.com/llvm/llvm-project/commit/6cb288797122ad931aba91e05030c24984e1031c.diff

LOG: [clang-format] [NFC] Use some constexpr StringRef

Instead of const char*.

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

Added: 


Modified: 
clang/lib/Format/BreakableToken.cpp

Removed: 




diff  --git a/clang/lib/Format/BreakableToken.cpp 
b/clang/lib/Format/BreakableToken.cpp
index c5edc670393c..d5167c01dc23 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -25,7 +25,7 @@
 namespace clang {
 namespace format {
 
-static const char *const Blanks = " \t\v\f\r";
+static constexpr StringRef Blanks = " \t\v\f\r";
 static bool IsBlank(char C) {
   switch (C) {
   case ' ':
@@ -41,11 +41,11 @@ static bool IsBlank(char C) {
 
 static StringRef getLineCommentIndentPrefix(StringRef Comment,
 const FormatStyle &Style) {
-  static const char *const KnownCStylePrefixes[] = {"///<", "//!<", "///",
-"//",   "//!",  "//:"};
-  static const char *const KnownTextProtoPrefixes[] = {"//", "#", "##", "###",
-   ""};
-  ArrayRef KnownPrefixes(KnownCStylePrefixes);
+  static constexpr StringRef KnownCStylePrefixes[] = {"///<", "//!<", "///",
+  "//",   "//!",  "//:"};
+  static constexpr StringRef KnownTextProtoPrefixes[] = {"//", "#", "##", 
"###",
+ ""};
+  ArrayRef KnownPrefixes(KnownCStylePrefixes);
   if (Style.Language == FormatStyle::LK_TextProto)
 KnownPrefixes = KnownTextProtoPrefixes;
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 7c8b9c1 - [clang-format] [NFC] Restructure getLineCommentIndentPrefix

2021-01-25 Thread Björn Schäpers via llvm-branch-commits

Author: Björn Schäpers
Date: 2021-01-25T21:02:40+01:00
New Revision: 7c8b9c102f38a4d29ac56ef7bd1da003f03900d0

URL: 
https://github.com/llvm/llvm-project/commit/7c8b9c102f38a4d29ac56ef7bd1da003f03900d0
DIFF: 
https://github.com/llvm/llvm-project/commit/7c8b9c102f38a4d29ac56ef7bd1da003f03900d0.diff

LOG: [clang-format] [NFC] Restructure getLineCommentIndentPrefix

When sorting the known prefixes after length the if in the loop will hit
at most once, so we can return from there.

Also replace the inner loop with an algorithm, that makes it more
readable.

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

Added: 


Modified: 
clang/lib/Format/BreakableToken.cpp

Removed: 




diff  --git a/clang/lib/Format/BreakableToken.cpp 
b/clang/lib/Format/BreakableToken.cpp
index d5167c01dc23..0ec00e039f33 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -42,24 +42,26 @@ static bool IsBlank(char C) {
 static StringRef getLineCommentIndentPrefix(StringRef Comment,
 const FormatStyle &Style) {
   static constexpr StringRef KnownCStylePrefixes[] = {"///<", "//!<", "///",
-  "//",   "//!",  "//:"};
-  static constexpr StringRef KnownTextProtoPrefixes[] = {"//", "#", "##", 
"###",
- ""};
+  "//!",  "//:",  "//"};
+  static constexpr StringRef KnownTextProtoPrefixes[] = {"", "###", "##",
+ "//", "#"};
   ArrayRef KnownPrefixes(KnownCStylePrefixes);
   if (Style.Language == FormatStyle::LK_TextProto)
 KnownPrefixes = KnownTextProtoPrefixes;
 
-  StringRef LongestPrefix;
+  assert(std::is_sorted(KnownPrefixes.begin(), KnownPrefixes.end(),
+[](StringRef Lhs, StringRef Rhs) noexcept {
+  return Lhs.size() > Rhs.size();
+}));
+
   for (StringRef KnownPrefix : KnownPrefixes) {
 if (Comment.startswith(KnownPrefix)) {
-  size_t PrefixLength = KnownPrefix.size();
-  while (PrefixLength < Comment.size() && Comment[PrefixLength] == ' ')
-++PrefixLength;
-  if (PrefixLength > LongestPrefix.size())
-LongestPrefix = Comment.substr(0, PrefixLength);
+  const auto PrefixLength =
+  Comment.find_first_not_of(' ', KnownPrefix.size());
+  return Comment.substr(0, PrefixLength);
 }
   }
-  return LongestPrefix;
+  return {};
 }
 
 static BreakableToken::Split



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 9aa38a0 - [clang-format] [NFC] Remove unsued arguments

2021-01-25 Thread Björn Schäpers via llvm-branch-commits

Author: Björn Schäpers
Date: 2021-01-25T21:02:41+01:00
New Revision: 9aa38a0615119a7a9f3bee33a2b8915c45f1cab9

URL: 
https://github.com/llvm/llvm-project/commit/9aa38a0615119a7a9f3bee33a2b8915c45f1cab9
DIFF: 
https://github.com/llvm/llvm-project/commit/9aa38a0615119a7a9f3bee33a2b8915c45f1cab9.diff

LOG: [clang-format] [NFC] Remove unsued arguments

Added: 


Modified: 
clang/lib/Format/BreakableToken.cpp
clang/lib/Format/BreakableToken.h
clang/lib/Format/ContinuationIndenter.cpp

Removed: 




diff  --git a/clang/lib/Format/BreakableToken.cpp 
b/clang/lib/Format/BreakableToken.cpp
index 0ec00e039f33..f179ac64de17 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -751,8 +751,7 @@ bool BreakableBlockComment::mayReflow(
 }
 
 BreakableLineCommentSection::BreakableLineCommentSection(
-const FormatToken &Token, unsigned StartColumn,
-unsigned OriginalStartColumn, bool FirstInLine, bool InPPDirective,
+const FormatToken &Token, unsigned StartColumn, bool InPPDirective,
 encoding::Encoding Encoding, const FormatStyle &Style)
 : BreakableComment(Token, StartColumn, InPPDirective, Encoding, Style) {
   assert(Tok.is(TT_LineComment) &&

diff  --git a/clang/lib/Format/BreakableToken.h 
b/clang/lib/Format/BreakableToken.h
index a6691300de3b..41b19f82e9df 100644
--- a/clang/lib/Format/BreakableToken.h
+++ b/clang/lib/Format/BreakableToken.h
@@ -436,7 +436,6 @@ class BreakableBlockComment : public BreakableComment {
 class BreakableLineCommentSection : public BreakableComment {
 public:
   BreakableLineCommentSection(const FormatToken &Token, unsigned StartColumn,
-  unsigned OriginalStartColumn, bool FirstInLine,
   bool InPPDirective, encoding::Encoding Encoding,
   const FormatStyle &Style);
 

diff  --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index 9db42b6c4a70..7198671901f3 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1974,8 +1974,7 @@ ContinuationIndenter::createBreakableToken(const 
FormatToken &Current,
 switchesFormatting(Current))
   return nullptr;
 return std::make_unique(
-Current, StartColumn, Current.OriginalColumn, !Current.Previous,
-/*InPPDirective=*/false, Encoding, Style);
+Current, StartColumn, /*InPPDirective=*/false, Encoding, Style);
   }
   return nullptr;
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] f02eca0 - [clang-format] [NFC] Rerun dump_format_style.py

2021-01-25 Thread Björn Schäpers via llvm-branch-commits

Author: Björn Schäpers
Date: 2021-01-25T21:02:41+01:00
New Revision: f02eca0f3feffc5e1afb92eeb4cfc23b9f28aa25

URL: 
https://github.com/llvm/llvm-project/commit/f02eca0f3feffc5e1afb92eeb4cfc23b9f28aa25
DIFF: 
https://github.com/llvm/llvm-project/commit/f02eca0f3feffc5e1afb92eeb4cfc23b9f28aa25.diff

LOG: [clang-format] [NFC] Rerun dump_format_style.py

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index f6ff57156177..c12ecf4d907f 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2360,14 +2360,15 @@ the configuration (without a prefix: ``Auto``).
   When ``true``, includes are sorted in an alphabetical
   fashion with case used as a tie-breaker.
 
+
   .. code-block:: c++
 
- false:   true:
- #include "A/B.h"   vs.   #include "A/B.h"
- #include "A/b.h" #include "A/b.h"
- #include "B/A.h" #include "a/b.h"
- #include "B/a.h" #include "B/A.h"
- #include "a/b.h" #include "B/a.h"
+false:   true:
+#include "A/B.h"   vs.   #include "A/B.h"
+#include "A/b.h" #include "A/b.h"
+#include "B/A.h" #include "a/b.h"
+#include "B/a.h" #include "B/A.h"
+#include "a/b.h" #include "B/a.h"
 
   This option is off by default.
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 60bf582 - [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-25 Thread Björn Schäpers via llvm-branch-commits

Author: Albertas Vyšniauskas
Date: 2021-01-25T21:02:41+01:00
New Revision: 60bf5826cfd3629b5200a8ab743d701c90f66af0

URL: 
https://github.com/llvm/llvm-project/commit/60bf5826cfd3629b5200a8ab743d701c90f66af0
DIFF: 
https://github.com/llvm/llvm-project/commit/60bf5826cfd3629b5200a8ab743d701c90f66af0.diff

LOG: [clang-format] PR16518 Add flag to suppress empty line insertion before 
access modifier

Add new option called InsertEmptyLineBeforeAccessModifier. Empty line
before access modifier is inerted if this option is set to true (which
is the default value, because clang-format always inserts empty lines
before access modifiers), otherwise empty lines are removed.

Fixes issue #16518.

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

Added: 
clang/test/Format/access-modifiers.cpp

Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index d5ce1b7b2e8e..f6ff57156177 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2119,6 +2119,75 @@ the configuration (without a prefix: ``Auto``).
 **DisableFormat** (``bool``)
   Disables formatting completely.
 
+**EmptyLineBeforeAccessModifier** (``EmptyLineBeforeAccessModifierStyle``)
+  Defines in which cases to put empty line before access modifiers.
+
+  Possible values:
+
+  * ``ELBAMS_Never`` (in configuration: ``Never``)
+Remove all empty lines before access modifiers.
+
+.. code-block:: c++
+
+  struct foo {
+  private:
+int i;
+  protected:
+int j;
+/* comment */
+  public:
+foo() {}
+  private:
+  protected:
+  };
+
+  * ``ELBAMS_Leave`` (in configuration: ``Leave``)
+Keep existing empty lines before access modifiers.
+
+  * ``ELBAMS_LogicalBlock`` (in configuration: ``LogicalBlock``)
+Add empty line only when access modifier starts a new logical block.
+Logical block is a group of one or more member fields or functions.
+
+.. code-block:: c++
+
+  struct foo {
+  private:
+int i;
+
+  protected:
+int j;
+/* comment */
+  public:
+foo() {}
+
+  private:
+  protected:
+  };
+
+  * ``ELBAMS_Always`` (in configuration: ``Always``)
+Always add empty line before access modifiers unless access modifier
+is at the start of struct or class definition.
+
+.. code-block:: c++
+
+  struct foo {
+  private:
+int i;
+
+  protected:
+int j;
+/* comment */
+
+  public:
+foo() {}
+
+  private:
+
+  protected:
+  };
+
+
+
 **ExperimentalAutoDetectBinPacking** (``bool``)
   If ``true``, clang-format detects whether function calls and
   definitions are formatted with one parameter per line.

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fcc38e25542f..96c2a74e97db 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1885,6 +1885,68 @@ struct FormatStyle {
   /// Disables formatting completely.
   bool DisableFormat;
 
+  /// Different styles for empty line before access modifiers.
+  enum EmptyLineBeforeAccessModifierStyle : unsigned char {
+/// Remove all empty lines before access modifiers.
+/// \code
+///   struct foo {
+///   private:
+/// int i;
+///   protected:
+/// int j;
+/// /* comment */
+///   public:
+/// foo() {}
+///   private:
+///   protected:
+///   };
+/// \endcode
+ELBAMS_Never,
+/// Keep existing empty lines before access modifiers.
+ELBAMS_Leave,
+/// Add empty line only when access modifier starts a new logical block.
+/// Logical block is a group of one or more member fields or functions.
+/// \code
+///   struct foo {
+///   private:
+/// int i;
+///
+///   protected:
+/// int j;
+/// /* comment */
+///   public:
+/// foo() {}
+///
+///   private:
+///   protected:
+///   };
+/// \endcode
+ELBAMS_LogicalBlock,
+/// Always add empty line before access modifiers unless access modifier
+/// is at the start of struct or class definition.
+/// \code
+///   struct foo {
+///   private:
+/// int i;
+///
+///   protected:
+/// int j;
+/// /* comment */
+///
+///   public:
+/// foo() {}
+///
+///   private:
+///
+///   protected:
+///   };
+/// \endcode
+ELBAMS_Always,
+  };
+
+  /// Defines in which cases to put empty line before access modifiers.
+  EmptyLineBeforeAccessModifierStyle Emp