[clang] 6dc863c - [clang, test, Darwin] Fix tests expecting Darwin target

2020-08-07 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2020-08-07T09:21:31+01:00
New Revision: 6dc863cd858f32ef0060c46edda2ab56a3cf76b4

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

LOG: [clang, test, Darwin] Fix tests expecting Darwin target

Clang tests Driver/apple-arm64-arch.c and
Driver/darwin-warning-options.c test Darwin driver functionality but
only require the host system to be Darwin. This leads the tests to fail
when building a cross-compiler on Darwin and to be marked unsupported
when cross-compiling to Darwin from another system. This commit changes
the requirements for those tests to require the target to be Darwin.

Reviewed By: steven_wu

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

Added: 


Modified: 
clang/test/Driver/apple-arm64-arch.c
clang/test/Driver/darwin-warning-options.c

Removed: 




diff  --git a/clang/test/Driver/apple-arm64-arch.c 
b/clang/test/Driver/apple-arm64-arch.c
index a37346b1a9bb..2c771ee40368 100644
--- a/clang/test/Driver/apple-arm64-arch.c
+++ b/clang/test/Driver/apple-arm64-arch.c
@@ -1,7 +1,7 @@
 // RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
 // RUN:   FileCheck %s
 //
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 // XFAIL: apple-silicon-mac
 //
 // CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"

diff  --git a/clang/test/Driver/darwin-warning-options.c 
b/clang/test/Driver/darwin-warning-options.c
index b0a591eac820..a3301b3fae9a 100644
--- a/clang/test/Driver/darwin-warning-options.c
+++ b/clang/test/Driver/darwin-warning-options.c
@@ -1,4 +1,4 @@
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 
 // Always error about undefined 'TARGET_OS_*' macros on Darwin.
 // RUN: %clang -### %s 2>&1 | FileCheck %s



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


[clang-tools-extra] [llvm] [clang] Add out-of-line-atomics support to GlobalISel (PR #74588)

2023-12-18 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

> Not an expert on atomics, but why would we have a libcall for -O0 but not for 
> O1 in the tests?

I looked at it for the u?(min|max) and it seemed to boil down to the atomic 
expand pass being run at -O1 and above.

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang-tools-extra] Add out-of-line-atomics support to GlobalISel (PR #74588)

2023-12-18 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

> > Not an expert on atomics, but why would we have a libcall for -O0 but not 
> > for O1 in the tests?
> 
> I looked at it for the u?(min|max) and it seemed to boil down to the atomic 
> expand pass being run at -O1 and above.

No sorry, it's not that it's only run at O1 and above, it's that the output is 
different. At O0 it keeps the cmpxchg whereas at O1 it changes the cmpxchg into 
a ldxr + stlxr intrinsics.

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [llvm] Add out-of-line-atomics support to GlobalISel (PR #74588)

2023-12-18 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

> > > Not an expert on atomics, but why would we have a libcall for -O0 but not 
> > > for O1 in the tests?
> > 
> > 
> > I looked at it for the u?(min|max) and it seemed to boil down to the atomic 
> > expand pass being run at -O1 and above.
> 
> No sorry, it's not that it's only run at O1 and above, it's that the output 
> is different. At O0 it keeps the cmpxchg whereas at O1 it changes the cmpxchg 
> into a ldxr + stlxr intrinsics.

@aemerson 
AArch64TargetLowering::shouldExpandAtomicRMWInIR() has:
  // Nand is not supported in LSE.
  // Leave 128 bits to LLSC or CmpXChg.
  if (AI->getOperation() != AtomicRMWInst::Nand && Size < 128) {
if (Subtarget->hasLSE())
  return AtomicExpansionKind::None;
if (Subtarget->outlineAtomics()) {
  // [U]Min/[U]Max RWM atomics are used in __sync_fetch_ libcalls so far.
  // Don't outline them unless
  // (1) high level  support approved:
  //   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0493r1.pdf
  // (2) low level libgcc and compiler-rt support implemented by:
  //   min/max outline atomics helpers
  if (AI->getOperation() != AtomicRMWInst::Min &&
  AI->getOperation() != AtomicRMWInst::Max &&
  AI->getOperation() != AtomicRMWInst::UMin &&
  AI->getOperation() != AtomicRMWInst::UMax) {
return AtomicExpansionKind::None;
  }
}
  }

  // At -O0, fast-regalloc cannot cope with the live vregs necessary to
  // implement atomicrmw without spilling. If the target address is also on the
  // stack and close enough to the spill slot, this can lead to a situation
  // where the monitor always gets cleared and the atomic operation can never
  // succeed. So at -O0 lower this operation to a CAS loop. Also worthwhile if
  // we have a single CAS instruction that can replace the loop.
  if (getTargetMachine().getOptLevel() == CodeGenOptLevel::None ||
  Subtarget->hasLSE())
return AtomicExpansionKind::CmpXChg;

That explains why -O0 differs from -O1 for nand and u?(min|max)

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [clang] Add out-of-line-atomics support to GlobalISel (PR #74588)

2023-12-21 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

> > // At -O0, fast-regalloc cannot cope with the live vregs necessary to
> 
> This sounds extremely unsound

Just to clarify, is the expectation for me to solve this in this patch or can 
this be done in a separate patch? Note that this is existing code exercised 
when compiling at -O1 or above (i.e. when not using GlobalISel) for some of the 
atomics.

Best regards,
Thomas

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang-tools-extra] Add out-of-line-atomics support to GlobalISel (PR #74588)

2024-01-02 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

My apologies @arsenm, I had missed your review comments. All fixed now.

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [clang-tools-extra] [clang] Add out-of-line-atomics support to GlobalISel (PR #74588)

2024-01-04 Thread Thomas Preud'homme via cfe-commits

https://github.com/RoboTux closed 
https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] Add out-of-line-atomics support to GlobalISel (PR #74588)

2024-01-04 Thread Thomas Preud'homme via cfe-commits

RoboTux wrote:

Thanks for fixing the unused variable @DamonFool , I was about to revert and 
push a new patch.

https://github.com/llvm/llvm-project/pull/74588
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7e65ffa - [test, x86] Fix spurious x86-target-features.c failure

2022-05-18 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-05-18T09:27:32+01:00
New Revision: 7e65ffaa8bb65adc0324ccbea1fef56cab6eafe1

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

LOG: [test, x86] Fix spurious x86-target-features.c failure

x86-target-features.c can spuriously fail when checking for absence of
the string "lvi" in the compiler output due to the temporary path used
for the output file. For example:
"-o" "/tmp/lit-tmp-981j7lvi/x86-target-features-670b86.o"
will make the test fail. This commit checks specifically for lvi as a
target feature, in a similar way to the positive CHECK directive just
above.

Test Plan: fails when using -mlvi-hardening and pass otherwise

Reviewed By: pengfei

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

Added: 


Modified: 
clang/test/Driver/x86-target-features.c

Removed: 




diff  --git a/clang/test/Driver/x86-target-features.c 
b/clang/test/Driver/x86-target-features.c
index 42385dd5f0a48..078680c1ea81b 100644
--- a/clang/test/Driver/x86-target-features.c
+++ b/clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'



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


[clang] 150fe05 - [Test] Fix undef var in catch-undef-behavior.c

2020-12-16 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2020-12-16T22:39:41Z
New Revision: 150fe05db4417c3ed9e4470b7bbd1a6aee7fe505

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

LOG: [Test] Fix undef var in catch-undef-behavior.c

Commit 9e52c43090f8cd980167bbd2719878ae36bcf6b5 removed the directive
defining LINE_1600 but left a string substitution to that variable in a
CHECK-NOT directive. This will make that CHECK-NOT directive always fail
to match, no matter the string.

This commit follows the pattern done in
9e52c43090f8cd980167bbd2719878ae36bcf6b5 of simplifying the CHECK-NOT to
only look for the function name and the opening parenthesis, thereby not
requiring the LINE_1600 variable.

Reviewed By: rnk

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

Added: 


Modified: 
clang/test/CodeGen/catch-undef-behavior.c

Removed: 




diff  --git a/clang/test/CodeGen/catch-undef-behavior.c 
b/clang/test/CodeGen/catch-undef-behavior.c
index be185f925b19..55f6e420a4fc 100644
--- a/clang/test/CodeGen/catch-undef-behavior.c
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -275,7 +275,7 @@ signed char fp16_char_overflow(__fp16 *p) {
 
 // CHECK-COMMON-LABEL: @float_float_overflow
 float float_float_overflow(double f) {
-  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(i8* 
bitcast ({{.*}} @[[LINE_1600]] to i8*),
+  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(
   // CHECK-TRAP-NOT:  call {{.*}} @llvm.ubsantrap(i8 19) [[NR_NUW]]
   // CHECK-COMMON: }
   return f;



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


[clang] 507bbc4 - [AST][NFC] Silence GCC warning about broken strict aliasing rules

2020-12-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2020-12-04T14:34:51Z
New Revision: 507bbc45bba90fab3f1a2b42e94ae4fbebdd6498

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

LOG: [AST][NFC] Silence GCC warning about broken strict aliasing rules

The deserialize() method would trigger the following warning on GCC <7:

   warning: dereferencing type-punned pointer will break
   strict-aliasing rules [-Wstrict-aliasing]

   ParamIdx P(*reinterpret_cast(&S));
  ^

&S was previously reinterpret_casted from a ParamIdx into a SerialType,
it is therefore safe to cast back into a ParamIdx. Similar to what was
done in D50608, we replace it with two static_cast via void * which
silences the warning and presumably makes GCC understand that no
strict-aliasing violation is happening.

No functional change intended.

Reviewed By: aaron.ballman

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

Added: 


Modified: 
clang/include/clang/AST/Attr.h

Removed: 




diff  --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 545dc992c5ed..8d9fb8f2bf27 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -259,7 +259,10 @@ class ParamIdx {
 
   /// Construct from a result from \c serialize.
   static ParamIdx deserialize(SerialType S) {
-ParamIdx P(*reinterpret_cast(&S));
+// Using this two-step static_cast via void * instead of reinterpret_cast
+// silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+void *ParamIdxPtr = static_cast(&S);
+ParamIdx P(*static_cast(ParamIdxPtr));
 assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
 return P;
   }



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


[clang] 305ac81 - Fix macos target assumption in test

2021-01-29 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-01-29T10:22:04Z
New Revision: 305ac81e1d4bbd037587190175e4d0b5631300e1

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

LOG: Fix macos target assumption in test

Clang test Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
assumes the target is darwin when the host is darwin which is not
necessarily the case, causing the test to fail when it is not. This
commit adds a -triple argument to the clang invocation to ensure the
target is darwin.

Reviewed By: hans

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

Added: 


Modified: 
clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp

Removed: 




diff  --git 
a/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp 
b/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
index ec3b710c4da8..f622016e2b16 100644
--- a/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
+++ b/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang -### -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
-// RUN: %clang -### -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck 
-check-prefix=x86_64-10_7 %s
+// RUN: %clang -### -target arm64-apple-darwin -arch arm64 
-mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -arch x86_64 
-mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
 // REQUIRES: system-darwin
 
 // ARM64-10_7-NOT: -lcrt1.10.6.o



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


[clang] 00a6254 - Stop traping on sNaN in __builtin_isnan

2021-02-05 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-02-05T18:28:48Z
New Revision: 00a62547da7e609d1641c107d01d95504883921f

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

LOG: Stop traping on sNaN in __builtin_isnan

__builtin_isnan currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.

Reviewed By: kpn

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

Added: 
clang/test/CodeGen/X86/strictfp_builtins.c
clang/test/CodeGen/aarch64-strictfp-builtins.c
clang/test/CodeGen/strictfp_builtins.c

Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
llvm/include/llvm/ADT/APFloat.h
llvm/include/llvm/IR/Type.h

Removed: 
clang/test/CodeGen/strictfp_fpclassify.c



diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index d8bb1bc84daa..4ff84ce8b79f 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -26,6 +26,8 @@
 #include "clang/Basic/TargetBuiltins.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
+#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/APInt.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Analysis/ValueTracking.h"
@@ -2985,10 +2987,32 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
   }
   case Builtin::BI__builtin_isnan: {
 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
-// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
-V = Builder.CreateFCmpUNO(V, V, "cmp");
-return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
+llvm::Type *Ty = V->getType();
+const llvm::fltSemantics &Semantics = Ty->getFltSemantics();
+if (!Builder.getIsFPConstrained() ||
+Builder.getDefaultConstrainedExcept() == fp::ebIgnore ||
+!Ty->isIEEE()) {
+  V = Builder.CreateFCmpUNO(V, V, "cmp");
+  return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
+}
+
+// NaN has all exp bits set and a non zero significand. Therefore:
+// isnan(V) == ((exp mask - (abs(V) & exp mask)) < 0)
+unsigned bitsize = Ty->getScalarSizeInBits();
+llvm::IntegerType *IntTy = Builder.getIntNTy(bitsize);
+Value *IntV = Builder.CreateBitCast(V, IntTy);
+APInt AndMask = APInt::getSignedMaxValue(bitsize);
+Value *AbsV =
+Builder.CreateAnd(IntV, llvm::ConstantInt::get(IntTy, AndMask));
+APInt ExpMask = APFloat::getInf(Semantics).bitcastToAPInt();
+Value *Sub =
+Builder.CreateSub(llvm::ConstantInt::get(IntTy, ExpMask), AbsV);
+// V = sign bit (Sub) <=> V = (Sub < 0)
+V = Builder.CreateLShr(Sub, llvm::ConstantInt::get(IntTy, bitsize - 1));
+if (bitsize > 32)
+  V = Builder.CreateTrunc(V, ConvertType(E->getType()));
+return RValue::get(V);
   }
 
   case Builtin::BI__builtin_matrix_transpose: {

diff  --git a/clang/test/CodeGen/X86/strictfp_builtins.c 
b/clang/test/CodeGen/X86/strictfp_builtins.c
new file mode 100644
index ..d7eda34fb45e
--- /dev/null
+++ b/clang/test/CodeGen/X86/strictfp_builtins.c
@@ -0,0 +1,46 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple 
x86_64-unknown-unknown | FileCheck %s
+
+// Test that the constrained intrinsics are picking up the exception
+// metadata from the AST instead of the global default from the command line.
+// FIXME: these functions shouldn't trap on SNaN.
+
+#pragma float_control(except, on)
+
+int printf(const char *, ...);
+
+// CHECK-LABEL: @p(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[STR_ADDR:%.*]] = alloca i8*, align 8
+// CHECK-NEXT:[[X_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i8* [[STR:%.*]], i8** [[STR_ADDR]], align 8
+// CHECK-NEXT:store i32 [[X:%.*]], i32* [[X_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** [[STR_ADDR]], align 8
+// CHECK-NEXT:[[TMP1:%.*]] = load i32, i32* [[X_ADDR]], align 4
+// CHECK-NEXT:[[CALL:%.*]] = call i32 (i8*, ...) @printf(i8* getelementptr 
inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* [[TMP0]], i32 [[TMP1]]) 
[[ATTR4:#.*]]
+// CHECK-NEXT:ret void
+//
+void p(char *str, int x) {
+  printf("%s: %d\n", str, x);
+}
+
+#define P(n,args) p(#n #args, __builtin_##n args)
+
+// CHECK-LABEL: @test_long_double_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
+// CHECK-NEXT:store x86_fp80 [[D:%.*]], x86_fp80* [[LD_ADDR]], align 16
+// CHECK-NEXT:[[TMP0:%.*]] = load x86_fp80, x86_fp8

[clang] 005fc11 - [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-16 Thread Thomas Preud'homme via cfe-commits

Author: Sherwin da Cruz
Date: 2021-09-16T11:13:16+01:00
New Revision: 005fc11ebdd6e1af29efee3d7c5da86f56138414

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

LOG: [PGO] Change ThinLTO test for targets with loop unrolling disabled

I am working on a target in a downstream LLVM repo, and it seems that if a 
target backend chooses to disable loop unrolling this test would fail. A 
solution would be to modify the test to search for a different string instead.

The specific test checks for `if.true.direct_targ` which appears in the output 
when thinlto is not used (ie samplepgo). The same is true for 
`if.false.orig_indirect`.

However, if a target disables loop unrolling in the backend, the test fails as  
`if.true.direct_targ` no longer appears, though `if.false.orig_indirect` still 
does. This can be seen by using a clang pragma to disable loop unrolling in the 
`unroll()` function.

For reference, the following files are the outputs of the last 2 test functions 
being compiled as the test case does, with and without thinlto, and with and 
without loop unrolling on the latest x86 clang build. The loop unrolling pragma 
was used to simulate the loop unrolling being disabled in a backend.
```
// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
out.ll
// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o out.ll
```

Reviewed By: tejohnson

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

Added: 


Modified: 
clang/test/CodeGen/pgo-sample-thinlto-summary.c

Removed: 




diff  --git a/clang/test/CodeGen/pgo-sample-thinlto-summary.c 
b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
index eae35a040e5f8..1de2298320e50 100644
--- a/clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,27 @@ void foo(int n) {
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. The second one is skipped by ThinLTO.
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +39,4 @@ void foo(int n) {
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if

[clang] 8a7a280 - Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

2021-09-17 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-09-17T15:21:22+01:00
New Revision: 8a7a28075b7fa70d56b131c10a4d1add777d5830

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

LOG: Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

Re-add -fexperimental-new-pass-manager to
Clang::CodeGen/pgo-sample-thinlto-summary.c for the test to work on
builds that still default to the old pass manager.

Reviewed By: tejohnson

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

Added: 


Modified: 
clang/test/CodeGen/pgo-sample-thinlto-summary.c

Removed: 




diff  --git a/clang/test/CodeGen/pgo-sample-thinlto-summary.c 
b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
index 1de2298320e5..9eee0f6df457 100644
--- a/clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ b/clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +37,4 @@ void foo(int n) {
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}



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


[clang] 1397e19 - Set supported target for asan-use-callbacks test

2021-08-10 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-08-10T15:01:44+01:00
New Revision: 1397e19129ef7aa6c2ba6f6018ff172a5022a1eb

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

LOG: Set supported target for asan-use-callbacks test

Explicitely set x86_64-linux-gnu as a target for asan-use-callbacks
clang test since some target do not support -fsanitize=address (e.g.
i386-pc-openbsd). Also remove redundant -fsanitize=address and move
-emit-llvm right after -S.

Reviewed By: vitalybuka

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

Added: 


Modified: 
clang/test/CodeGen/asan-use-callbacks.cpp

Removed: 




diff  --git a/clang/test/CodeGen/asan-use-callbacks.cpp 
b/clang/test/CodeGen/asan-use-callbacks.cpp
index 280b51701e07..5805507e0a5c 100644
--- a/clang/test/CodeGen/asan-use-callbacks.cpp
+++ b/clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4



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


[clang] 1e11cca - [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86

2021-08-12 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-08-12T21:38:35+01:00
New Revision: 1e11ccad837c2d0d848349e7bc8f5800e5d365fc

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

LOG: [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86

Clang test CodeGen/thinlto-clang-diagnostic-handler-in-be.c fails on
some non x86 targets, e.g. hexagon. Since the test already requires x86
to be available as a target this commit forces the target to x86_64.

Reviewed By: steven_wu

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

Added: 


Modified: 
clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c

Removed: 




diff  --git a/clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c 
b/clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
index 32489694289f6..1223cd9a5411b 100644
--- a/clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ b/clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g 
-fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64-linux-gnu -O2 -fexperimental-new-pass-manager 
-flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck 
%s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata 
-emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s 
-allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {



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


[clang] 1b6eb56 - Stop traping on sNaN in __builtin_isinf

2021-03-02 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-02T15:54:56Z
New Revision: 1b6eb56aa0ea2931866455a21a138fc09c08e905

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

LOG: Stop traping on sNaN in __builtin_isinf

__builtin_isinf currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.

Reviewed By: mibintc

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

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/X86/strictfp_builtins.c
clang/test/CodeGen/aarch64-strictfp-builtins.c
clang/test/CodeGen/builtin_float_strictfp.c
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 5409a12698c4..1a5dfdedc037 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -3078,15 +3078,37 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 // isfinite(x) --> fabs(x) != infinity
 // x != NaN via the ordered compare in either case.
 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
-// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
-Value *Fabs = EmitFAbs(*this, V);
-Constant *Infinity = ConstantFP::getInfinity(V->getType());
-CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
-  ? CmpInst::FCMP_OEQ
-  : CmpInst::FCMP_ONE;
-Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
-return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
+llvm::Type *Ty = V->getType();
+if (!Builder.getIsFPConstrained() ||
+Builder.getDefaultConstrainedExcept() == fp::ebIgnore ||
+!Ty->isIEEE()) {
+  Value *Fabs = EmitFAbs(*this, V);
+  Constant *Infinity = ConstantFP::getInfinity(V->getType());
+  CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
+? CmpInst::FCMP_OEQ
+: CmpInst::FCMP_ONE;
+  Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
+  return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
+}
+
+if (Value *Result = getTargetHooks().testFPKind(V, BuiltinID, Builder, 
CGM))
+  return RValue::get(Result);
+
+// Inf values have all exp bits set and a zero significand. Therefore:
+// isinf(V) == ((V << 1) == ((exp mask) << 1))
+unsigned bitsize = Ty->getScalarSizeInBits();
+llvm::IntegerType *IntTy = Builder.getIntNTy(bitsize);
+Value *IntV = Builder.CreateBitCast(V, IntTy);
+Value *Shl1 = Builder.CreateShl(IntV, 1);
+const llvm::fltSemantics &Semantics = Ty->getFltSemantics();
+APInt ExpMask = APFloat::getInf(Semantics).bitcastToAPInt();
+Value *ExpMaskShl1 = llvm::ConstantInt::get(IntTy, ExpMask.shl(1));
+if (BuiltinID == Builtin::BI__builtin_isinf)
+  V = Builder.CreateICmpEQ(Shl1, ExpMaskShl1);
+else
+  V = Builder.CreateICmpNE(Shl1, ExpMaskShl1);
+return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
   }
 
   case Builtin::BI__builtin_isinf_sign: {

diff  --git a/clang/test/CodeGen/X86/strictfp_builtins.c 
b/clang/test/CodeGen/X86/strictfp_builtins.c
index d7eda34fb45e..4be64a6fafd7 100644
--- a/clang/test/CodeGen/X86/strictfp_builtins.c
+++ b/clang/test/CodeGen/X86/strictfp_builtins.c
@@ -26,6 +26,24 @@ void p(char *str, int x) {
 
 #define P(n,args) p(#n #args, __builtin_##n args)
 
+// CHECK-LABEL: @test_long_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
+// CHECK-NEXT:store x86_fp80 [[D:%.*]], x86_fp80* [[LD_ADDR]], align 16
+// CHECK-NEXT:[[TMP0:%.*]] = load x86_fp80, x86_fp80* [[LD_ADDR]], align 16
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast x86_fp80 [[TMP0]] to i80
+// CHECK-NEXT:[[SHL1:%.*]] = shl i80 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i80 [[SHL1]], -18446744073709551616
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([10 x i8], [10 x 
i8]* @.str.1, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_long_double_isinf(long double ld) {
+  P(isinf, (ld));
+
+  return;
+}
+
 // CHECK-LABEL: @test_long_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
@@ -36,7 +54,7 @@ void p(char *str, int x) {
 // CHECK-NEXT:[[TMP1:%.*]] = sub i80 604453686435277732577280, [[ABS]]
 // CHECK-NE

[clang] e77b5c4 - Add __builtin_isnan(__fp16) testcase

2021-03-02 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-02T21:01:51Z
New Revision: e77b5c40d57633a66842e75410585696895ecf4d

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

LOG: Add __builtin_isnan(__fp16) testcase

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/test/CodeGen/strictfp_builtins.c 
b/clang/test/CodeGen/strictfp_builtins.c
index 618bb70d5ed3d..3afc9d8c8a402 100644
--- a/clang/test/CodeGen/strictfp_builtins.c
+++ b/clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@ void test_isinf_sign(double d) {
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4



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


[clang] b7aeece - Revert "Stop traping on sNaN in __builtin_isinf"

2021-03-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-04T12:07:35Z
New Revision: b7aeece47ce58fc44d699979f1ce80ab42837fd6

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

LOG: Revert "Stop traping on sNaN in __builtin_isinf"

This reverts commit 1b6eb56aa0ea2931866455a21a138fc09c08e905 because the
invert logic for isfinite is incorrect.

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/X86/strictfp_builtins.c
clang/test/CodeGen/aarch64-strictfp-builtins.c
clang/test/CodeGen/builtin_float_strictfp.c
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 6b3d385c411e..35717168b2e0 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -3078,37 +3078,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 // isfinite(x) --> fabs(x) != infinity
 // x != NaN via the ordered compare in either case.
 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
+// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
-llvm::Type *Ty = V->getType();
-if (!Builder.getIsFPConstrained() ||
-Builder.getDefaultConstrainedExcept() == fp::ebIgnore ||
-!Ty->isIEEE()) {
-  Value *Fabs = EmitFAbs(*this, V);
-  Constant *Infinity = ConstantFP::getInfinity(V->getType());
-  CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
-? CmpInst::FCMP_OEQ
-: CmpInst::FCMP_ONE;
-  Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
-  return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
-}
-
-if (Value *Result = getTargetHooks().testFPKind(V, BuiltinID, Builder, 
CGM))
-  return RValue::get(Result);
-
-// Inf values have all exp bits set and a zero significand. Therefore:
-// isinf(V) == ((V << 1) == ((exp mask) << 1))
-unsigned bitsize = Ty->getScalarSizeInBits();
-llvm::IntegerType *IntTy = Builder.getIntNTy(bitsize);
-Value *IntV = Builder.CreateBitCast(V, IntTy);
-Value *Shl1 = Builder.CreateShl(IntV, 1);
-const llvm::fltSemantics &Semantics = Ty->getFltSemantics();
-APInt ExpMask = APFloat::getInf(Semantics).bitcastToAPInt();
-Value *ExpMaskShl1 = llvm::ConstantInt::get(IntTy, ExpMask.shl(1));
-if (BuiltinID == Builtin::BI__builtin_isinf)
-  V = Builder.CreateICmpEQ(Shl1, ExpMaskShl1);
-else
-  V = Builder.CreateICmpNE(Shl1, ExpMaskShl1);
-return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
+Value *Fabs = EmitFAbs(*this, V);
+Constant *Infinity = ConstantFP::getInfinity(V->getType());
+CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
+  ? CmpInst::FCMP_OEQ
+  : CmpInst::FCMP_ONE;
+Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
+return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
   }
 
   case Builtin::BI__builtin_isinf_sign: {

diff  --git a/clang/test/CodeGen/X86/strictfp_builtins.c 
b/clang/test/CodeGen/X86/strictfp_builtins.c
index 4be64a6fafd7..d7eda34fb45e 100644
--- a/clang/test/CodeGen/X86/strictfp_builtins.c
+++ b/clang/test/CodeGen/X86/strictfp_builtins.c
@@ -26,24 +26,6 @@ void p(char *str, int x) {
 
 #define P(n,args) p(#n #args, __builtin_##n args)
 
-// CHECK-LABEL: @test_long_double_isinf(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
-// CHECK-NEXT:store x86_fp80 [[D:%.*]], x86_fp80* [[LD_ADDR]], align 16
-// CHECK-NEXT:[[TMP0:%.*]] = load x86_fp80, x86_fp80* [[LD_ADDR]], align 16
-// CHECK-NEXT:[[BITCAST:%.*]] = bitcast x86_fp80 [[TMP0]] to i80
-// CHECK-NEXT:[[SHL1:%.*]] = shl i80 [[BITCAST]], 1
-// CHECK-NEXT:[[CMP:%.*]] = icmp eq i80 [[SHL1]], -18446744073709551616
-// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([10 x i8], [10 x 
i8]* @.str.1, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
-// CHECK-NEXT:ret void
-//
-void test_long_double_isinf(long double ld) {
-  P(isinf, (ld));
-
-  return;
-}
-
 // CHECK-LABEL: @test_long_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
@@ -54,7 +36,7 @@ void test_long_double_isinf(long double ld) {
 // CHECK-NEXT:[[TMP1:%.*]] = sub i80 604453686435277732577280, [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i80 [[TMP1]], 79
 // CHECK-NEXT:[[RES:%.*]] = trunc i80 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds (

[clang] 6d6e713 - Revert "Add __builtin_isnan(__fp16) testcase"

2021-03-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-04T12:18:03Z
New Revision: 6d6e7132f9c7bb1fc7b6771ae90ccf8810e9f22e

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

LOG: Revert "Add __builtin_isnan(__fp16) testcase"

This reverts commit e77b5c40d57633a66842e75410585696895ecf4d because it
fails without 1b6eb56aa0ea2931866455a21a138fc09c08e905.

Added: 


Modified: 
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/test/CodeGen/strictfp_builtins.c 
b/clang/test/CodeGen/strictfp_builtins.c
index 6f7d2f3f91d3..131c9406fab6 100644
--- a/clang/test/CodeGen/strictfp_builtins.c
+++ b/clang/test/CodeGen/strictfp_builtins.c
@@ -92,25 +92,6 @@ void test_isinf_sign(double d) {
   return;
 }
 
-// CHECK-LABEL: @test_fp16_isnan(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
-// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
-// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
-// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
-// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
-// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
-// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
-// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
-// CHECK-NEXT:ret void
-//
-void test_fp16_isnan(__fp16 h) {
-  P(isnan, (h));
-
-  return;
-}
-
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4



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


[clang] 52bfe66 - Add __builtin_isnan(__fp16) testcase

2021-03-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-04T13:03:48Z
New Revision: 52bfe6605ab735bfe353682a5ced78aee6bacdbd

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

LOG: Add __builtin_isnan(__fp16) testcase

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/test/CodeGen/strictfp_builtins.c 
b/clang/test/CodeGen/strictfp_builtins.c
index 131c9406fab6..2d55b07ccc11 100644
--- a/clang/test/CodeGen/strictfp_builtins.c
+++ b/clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple 
x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap 
-fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | 
FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -92,6 +92,25 @@ void test_isinf_sign(double d) {
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
@@ -101,7 +120,7 @@ void test_isinf_sign(double d) {
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_float_isnan(float f) {
@@ -120,7 +139,7 @@ void test_float_isnan(float f) {
 // CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
 // CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.6, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_double_isnan(double d) {
@@ -141,7 +160,7 @@ void test_double_isnan(double d) {
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.7, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {



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


[clang] f60b353 - Stop traping on sNaN in __builtin_isinf

2021-03-15 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-15T15:38:08Z
New Revision: f60b35340fd70acb3c8003349931f085305886ad

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

LOG: Stop traping on sNaN in __builtin_isinf

__builtin_isinf currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.

Reviewed By: mibintc

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

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/X86/strictfp_builtins.c
clang/test/CodeGen/aarch64-strictfp-builtins.c
clang/test/CodeGen/builtin_float_strictfp.c
clang/test/CodeGen/strictfp_builtins.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index ed43e5fd091f4..29886b57a81f9 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -3078,15 +3078,38 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 // isfinite(x) --> fabs(x) != infinity
 // x != NaN via the ordered compare in either case.
 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
-// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
-Value *Fabs = EmitFAbs(*this, V);
-Constant *Infinity = ConstantFP::getInfinity(V->getType());
-CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
-  ? CmpInst::FCMP_OEQ
-  : CmpInst::FCMP_ONE;
-Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
-return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
+llvm::Type *Ty = V->getType();
+if (!Builder.getIsFPConstrained() ||
+Builder.getDefaultConstrainedExcept() == fp::ebIgnore ||
+!Ty->isIEEE()) {
+  Value *Fabs = EmitFAbs(*this, V);
+  Constant *Infinity = ConstantFP::getInfinity(V->getType());
+  CmpInst::Predicate Pred = (BuiltinID == Builtin::BI__builtin_isinf)
+? CmpInst::FCMP_OEQ
+: CmpInst::FCMP_ONE;
+  Value *FCmp = Builder.CreateFCmp(Pred, Fabs, Infinity, "cmpinf");
+  return RValue::get(Builder.CreateZExt(FCmp, ConvertType(E->getType(;
+}
+
+if (Value *Result = getTargetHooks().testFPKind(V, BuiltinID, Builder, 
CGM))
+  return RValue::get(Result);
+
+// Inf values have all exp bits set and a zero significand. Therefore:
+// isinf(V) == ((V << 1) == ((exp mask) << 1))
+// isfinite(V) == ((V << 1) < ((exp mask) << 1)) using unsigned comparison
+unsigned bitsize = Ty->getScalarSizeInBits();
+llvm::IntegerType *IntTy = Builder.getIntNTy(bitsize);
+Value *IntV = Builder.CreateBitCast(V, IntTy);
+Value *Shl1 = Builder.CreateShl(IntV, 1);
+const llvm::fltSemantics &Semantics = Ty->getFltSemantics();
+APInt ExpMask = APFloat::getInf(Semantics).bitcastToAPInt();
+Value *ExpMaskShl1 = llvm::ConstantInt::get(IntTy, ExpMask.shl(1));
+if (BuiltinID == Builtin::BI__builtin_isinf)
+  V = Builder.CreateICmpEQ(Shl1, ExpMaskShl1);
+else
+  V = Builder.CreateICmpULT(Shl1, ExpMaskShl1);
+return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
   }
 
   case Builtin::BI__builtin_isinf_sign: {

diff  --git a/clang/test/CodeGen/X86/strictfp_builtins.c 
b/clang/test/CodeGen/X86/strictfp_builtins.c
index d7eda34fb45ef..c3c94164e04f9 100644
--- a/clang/test/CodeGen/X86/strictfp_builtins.c
+++ b/clang/test/CodeGen/X86/strictfp_builtins.c
@@ -26,6 +26,42 @@ void p(char *str, int x) {
 
 #define P(n,args) p(#n #args, __builtin_##n args)
 
+// CHECK-LABEL: @test_long_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
+// CHECK-NEXT:store x86_fp80 [[D:%.*]], x86_fp80* [[LD_ADDR]], align 16
+// CHECK-NEXT:[[TMP0:%.*]] = load x86_fp80, x86_fp80* [[LD_ADDR]], align 16
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast x86_fp80 [[TMP0]] to i80
+// CHECK-NEXT:[[SHL1:%.*]] = shl i80 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i80 [[SHL1]], -18446744073709551616
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([10 x i8], [10 x 
i8]* @.str.[[#STRID:1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_long_double_isinf(long double ld) {
+  P(isinf, (ld));
+
+  return;
+}
+
+// CHECK-LABEL: @test_long_double_isfinite(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca x86_fp80, align 16
+// CHECK-NEXT:store x86_fp80 

[clang] f3a86a2 - [Test] Fix driverkit-path.c with lib64 dir

2022-11-08 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-11-08T09:54:47Z
New Revision: f3a86a23c10db44cbcb432d56201475721c64bdc

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

LOG: [Test] Fix driverkit-path.c with lib64 dir

Reviewed By: yln

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

Added: 


Modified: 
clang/test/Driver/driverkit-path.c

Removed: 




diff  --git a/clang/test/Driver/driverkit-path.c 
b/clang/test/Driver/driverkit-path.c
index 690145b240dc..9699b9c01f4e 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -29,6 +29,6 @@ int main() { return 0; }
 // INC:   -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
 // INC-LABEL: #include <...> search starts here:
 // INC:   [[PATH]]/System/DriverKit/usr/local/include
-// INC:   /lib/clang/{{[^/ ]+}}/include
+// INC:   /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:   [[PATH]]/System/DriverKit/usr/include
 // INC:   [[PATH]]/System/DriverKit/System/Library/Frameworks (framework 
directory)



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


[clang] [update_cc_test_checks] Use lit's shell to run commands (PR #65333)

2023-09-11 Thread Thomas Preud'homme via cfe-commits


@@ -34,29 +35,22 @@
 }
 
 
-def get_line2func_list(args, clang_args):
+def get_line2func_list(clang_cmd: Command):
 ret = collections.defaultdict(list)
 # Use clang's JSON AST dump to get the mangled name
-json_dump_args = [args.clang] + clang_args + ["-fsyntax-only", "-o", "-"]
+json_dump_args = clang_cmd.args + ["-fsyntax-only", "-o", "/dev/null"]

RoboTux wrote:

Ok

https://github.com/llvm/llvm-project/pull/65333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [update_cc_test_checks] Use lit's shell to run commands (PR #65333)

2023-09-06 Thread Thomas Preud'homme via cfe-commits


@@ -306,52 +276,79 @@ def main():
 run_list = []
 line2func_list = collections.defaultdict(list)
 
-subs = {
-"%s": ti.path,
-"%t": tempfile.NamedTemporaryFile().name,
-"%S": os.path.dirname(ti.path),
-}
+subs = [
+("%s", ti.path),
+("%t", tempfile.NamedTemporaryFile().name),
+("%S", os.path.dirname(ti.path)),
+]
 
 for l in ti.run_lines:
-commands = [cmd.strip() for cmd in l.split("|")]
-
+pipeline = ShParser(l, win32Escapes=False, pipefail=False).parse()
+if not isinstance(pipeline, Pipeline):
+# Could be a sequence separated by &&/||/; but we don't handle 
that yet.
+print(
+"WARNING: RUN: line is too complex for this script: ",
+pipeline,
+file=sys.stderr,
+)
+continue
 triple_in_cmd = None
-m = common.TRIPLE_ARG_RE.search(commands[0])
+clang_cmd: Command = pipeline.commands[0]
+m = common.TRIPLE_ARG_RE.search(" ".join(clang_cmd.args))
 if m:
 triple_in_cmd = m.groups()[0]
 
+# Do lit-like substitutions on the command and redirects.
+for cmd in pipeline.commands:
+if cmd.args[0] == "opt":
+if ti.args.opt is None:
+sys.exit(
+ti.path + " needs to run opt. "
+"Please specify --llvm-bin or --opt"
+)
+cmd.args[0] = ti.args.opt
+cmd.args = [common.applySubstitutions(i, subs) for i in 
cmd.args]
+for i, redirect in enumerate(cmd.redirects):
+cmd.redirects[i] = redirect[0], common.applySubstitutions(
+redirect[1], subs
+)
+
 # Parse executable args.
-exec_args = shlex.split(commands[0])
 # Execute non-clang runline.
-if exec_args[0] not in SUBST:
-# Do lit-like substitutions.
-for s in subs:
-exec_args = [
-i.replace(s, subs[s]) if s in i else i for i in 
exec_args
-]
-run_list.append((None, exec_args, None, None))
+if clang_cmd.args[0] not in SUBST:
+# Ignore FileCheck-only 'RUN: lines'
+if pipeline.commands[0].args[0] == "FileCheck":
+print(
+"NOTE: Skipping FileCheck-only RUN line: ",
+pipeline,
+file=sys.stderr,
+)
+continue
+run_list.append((None, pipeline, None))
 continue
 # This is a clang runline, apply %clang substitution rule, do 
lit-like substitutions,
 # and append args.clang_args
-clang_args = exec_args
-clang_args[0:1] = SUBST[clang_args[0]]
-for s in subs:
-clang_args = [
-i.replace(s, subs[s]) if s in i else i for i in clang_args
-]
-clang_args += ti.args.clang_args
+clang_cmd.args[0:1] = SUBST[clang_cmd.args[0]]
+print(clang_cmd)

RoboTux wrote:

Is that a forgotten debug print statement?

https://github.com/llvm/llvm-project/pull/65333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [update_cc_test_checks] Use lit's shell to run commands (PR #65333)

2023-09-06 Thread Thomas Preud'homme via cfe-commits


@@ -34,29 +35,22 @@
 }
 
 
-def get_line2func_list(args, clang_args):
+def get_line2func_list(clang_cmd: Command):
 ret = collections.defaultdict(list)
 # Use clang's JSON AST dump to get the mangled name
-json_dump_args = [args.clang] + clang_args + ["-fsyntax-only", "-o", "-"]
+json_dump_args = clang_cmd.args + ["-fsyntax-only", "-o", "/dev/null"]

RoboTux wrote:

I don't understand the change from stdout to /dev/null output. How can you get 
an output from that command when doing execute_pipeline?

https://github.com/llvm/llvm-project/pull/65333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [update_cc_test_checks] Use lit's shell to run commands (PR #65333)

2023-09-06 Thread Thomas Preud'homme via cfe-commits


@@ -306,52 +276,79 @@ def main():
 run_list = []
 line2func_list = collections.defaultdict(list)
 
-subs = {
-"%s": ti.path,
-"%t": tempfile.NamedTemporaryFile().name,
-"%S": os.path.dirname(ti.path),
-}
+subs = [
+("%s", ti.path),
+("%t", tempfile.NamedTemporaryFile().name),
+("%S", os.path.dirname(ti.path)),
+]
 
 for l in ti.run_lines:
-commands = [cmd.strip() for cmd in l.split("|")]
-
+pipeline = ShParser(l, win32Escapes=False, pipefail=False).parse()
+if not isinstance(pipeline, Pipeline):
+# Could be a sequence separated by &&/||/; but we don't handle 
that yet.
+print(
+"WARNING: RUN: line is too complex for this script: ",
+pipeline,
+file=sys.stderr,
+)
+continue
 triple_in_cmd = None
-m = common.TRIPLE_ARG_RE.search(commands[0])
+clang_cmd: Command = pipeline.commands[0]
+m = common.TRIPLE_ARG_RE.search(" ".join(clang_cmd.args))
 if m:
 triple_in_cmd = m.groups()[0]
 
+# Do lit-like substitutions on the command and redirects.
+for cmd in pipeline.commands:
+if cmd.args[0] == "opt":
+if ti.args.opt is None:
+sys.exit(
+ti.path + " needs to run opt. "
+"Please specify --llvm-bin or --opt"
+)
+cmd.args[0] = ti.args.opt
+cmd.args = [common.applySubstitutions(i, subs) for i in 
cmd.args]
+for i, redirect in enumerate(cmd.redirects):
+cmd.redirects[i] = redirect[0], common.applySubstitutions(
+redirect[1], subs
+)
+
 # Parse executable args.
-exec_args = shlex.split(commands[0])
 # Execute non-clang runline.
-if exec_args[0] not in SUBST:
-# Do lit-like substitutions.
-for s in subs:
-exec_args = [
-i.replace(s, subs[s]) if s in i else i for i in 
exec_args
-]
-run_list.append((None, exec_args, None, None))
+if clang_cmd.args[0] not in SUBST:
+# Ignore FileCheck-only 'RUN: lines'
+if pipeline.commands[0].args[0] == "FileCheck":
+print(
+"NOTE: Skipping FileCheck-only RUN line: ",
+pipeline,
+file=sys.stderr,
+)
+continue
+run_list.append((None, pipeline, None))
 continue
 # This is a clang runline, apply %clang substitution rule, do 
lit-like substitutions,
 # and append args.clang_args
-clang_args = exec_args
-clang_args[0:1] = SUBST[clang_args[0]]
-for s in subs:
-clang_args = [
-i.replace(s, subs[s]) if s in i else i for i in clang_args
-]
-clang_args += ti.args.clang_args
+clang_cmd.args[0:1] = SUBST[clang_cmd.args[0]]
+print(clang_cmd)
+clang_cmd.args.insert(0, ti.args.clang)
+clang_cmd.args += ti.args.clang_args
+# Remove all -verify arguments since they could cause the IR 
generation to fail
+clang_cmd.args = [x for x in clang_cmd.args if not 
x.startswith("-verify")]

RoboTux wrote:

Wouldn't you want the tool to fail then?

https://github.com/llvm/llvm-project/pull/65333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [update_cc_test_checks] Use lit's shell to run commands (PR #65333)

2023-09-06 Thread Thomas Preud'homme via cfe-commits


@@ -306,52 +276,79 @@ def main():
 run_list = []
 line2func_list = collections.defaultdict(list)
 
-subs = {
-"%s": ti.path,
-"%t": tempfile.NamedTemporaryFile().name,
-"%S": os.path.dirname(ti.path),
-}
+subs = [
+("%s", ti.path),
+("%t", tempfile.NamedTemporaryFile().name),
+("%S", os.path.dirname(ti.path)),
+]
 
 for l in ti.run_lines:
-commands = [cmd.strip() for cmd in l.split("|")]
-
+pipeline = ShParser(l, win32Escapes=False, pipefail=False).parse()
+if not isinstance(pipeline, Pipeline):
+# Could be a sequence separated by &&/||/; but we don't handle 
that yet.
+print(
+"WARNING: RUN: line is too complex for this script: ",
+pipeline,
+file=sys.stderr,
+)
+continue
 triple_in_cmd = None
-m = common.TRIPLE_ARG_RE.search(commands[0])
+clang_cmd: Command = pipeline.commands[0]
+m = common.TRIPLE_ARG_RE.search(" ".join(clang_cmd.args))
 if m:
 triple_in_cmd = m.groups()[0]
 
+# Do lit-like substitutions on the command and redirects.
+for cmd in pipeline.commands:
+if cmd.args[0] == "opt":
+if ti.args.opt is None:
+sys.exit(
+ti.path + " needs to run opt. "
+"Please specify --llvm-bin or --opt"
+)
+cmd.args[0] = ti.args.opt
+cmd.args = [common.applySubstitutions(i, subs) for i in 
cmd.args]
+for i, redirect in enumerate(cmd.redirects):
+cmd.redirects[i] = redirect[0], common.applySubstitutions(
+redirect[1], subs
+)
+
 # Parse executable args.

RoboTux wrote:

This comment should be removed.

https://github.com/llvm/llvm-project/pull/65333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ad485b7 - Add version to all LLVM cmake package

2022-11-20 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-11-20T21:09:50Z
New Revision: ad485b71b51168ce13282ae159bd8feff48baf84

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

LOG: Add version to all LLVM cmake package

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.

Reviewed By: arsenm, stellaraccident

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

Added: 
clang/cmake/modules/ClangConfigVersion.cmake.in
flang/cmake/modules/FlangConfigVersion.cmake.in
lld/cmake/modules/LLDConfigVersion.cmake.in
mlir/cmake/modules/MLIRConfigVersion.cmake.in
polly/cmake/PollyConfigVersion.cmake.in

Modified: 
clang/cmake/modules/CMakeLists.txt
clang/cmake/modules/ClangConfig.cmake.in
flang/cmake/modules/CMakeLists.txt
flang/cmake/modules/FlangConfig.cmake.in
lld/cmake/modules/CMakeLists.txt
lld/cmake/modules/LLDConfig.cmake.in
mlir/cmake/modules/CMakeLists.txt
mlir/cmake/modules/MLIRConfig.cmake.in
polly/cmake/CMakeLists.txt
polly/cmake/PollyConfig.cmake.in

Removed: 




diff  --git a/clang/cmake/modules/CMakeLists.txt 
b/clang/cmake/modules/CMakeLists.txt
index 880d51f5aef71..749ef672c34f7 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -32,6 +32,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${clang_cmake_builddir}/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${clang_cmake_builddir}/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CMAKE_DIR)
 set(CLANG_CONFIG_LLVM_CMAKE_DIR)
 
@@ -59,6 +63,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CODE)
 set(CLANG_CONFIG_CMAKE_DIR)
 
@@ -67,6 +75,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 
   install(FILES
 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
+${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
 ${CMAKE_CURRENT_SOURCE_DIR}/AddClang.cmake
 DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}
 COMPONENT clang-cmake-exports)

diff  --git a/clang/cmake/modules/ClangConfig.cmake.in 
b/clang/cmake/modules/ClangConfig.cmake.in
index 2a254463d6f5e..5596ad669e209 100644
--- a/clang/cmake/modules/ClangConfig.cmake.in
+++ b/clang/cmake/modules/ClangConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @CLANG_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION 
${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")
 
 set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")

diff  --git a/clang/cmake/modules/ClangConfigVersion.cmake.in 
b/clang/cmake/modules/ClangConfigVersion.cmake.in
new file mode 100644
index 0..e9ac4ed2da786
--- /dev/null
+++ b/clang/cmake/modules/ClangConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()

diff  --git a/flang/cmake/modules/CMakeLists.txt 
b/flang/cmake/modules/CMakeLists.txt
index 31a6c3c83e48b..bf50bcaa18d52 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -28,8 +28,8 @@ set(FLANG_CONFIG_INCLUDE_DIRS
   "${FLANG_BINARY_DIR}/include"
   )
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
-  ${flang_cmake_builddir}/FlangConfig.cmake
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${flang_cmake_builddir}/FlangConfigVersion.cmake
   @ONLY)
 set(FLANG_CONFIG_CMAKE_DIR)
 set(FLANG_CONFIG_LLVM_CMAKE_DIR)
@@ -46,6 +46,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfigVersion.cmake
+  @ONLY)
 
 set(FLANG_CONFIG_CODE)
 set(FLANG_CONFIG_CMAKE_DIR)
@@ -56,6 +60,7 @@ i

[clang] b62c8d3 - Revert: Add version to all LLVM cmake package

2022-11-25 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-11-25T10:54:58Z
New Revision: b62c8d396f7dbef61122e169ef143276e74eff05

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

LOG: Revert: Add version to all LLVM cmake package

Summary: This reverts commit ad485b71b51168ce13282ae159bd8feff48baf84.

Reviewers:

Subscribers:

Added: 


Modified: 
clang/cmake/modules/CMakeLists.txt
clang/cmake/modules/ClangConfig.cmake.in
flang/cmake/modules/CMakeLists.txt
flang/cmake/modules/FlangConfig.cmake.in
lld/cmake/modules/CMakeLists.txt
lld/cmake/modules/LLDConfig.cmake.in
mlir/cmake/modules/CMakeLists.txt
mlir/cmake/modules/MLIRConfig.cmake.in
polly/cmake/CMakeLists.txt
polly/cmake/PollyConfig.cmake.in

Removed: 
clang/cmake/modules/ClangConfigVersion.cmake.in
flang/cmake/modules/FlangConfigVersion.cmake.in
lld/cmake/modules/LLDConfigVersion.cmake.in
mlir/cmake/modules/MLIRConfigVersion.cmake.in
polly/cmake/PollyConfigVersion.cmake.in



diff  --git a/clang/cmake/modules/CMakeLists.txt 
b/clang/cmake/modules/CMakeLists.txt
index 749ef672c34f7..880d51f5aef71 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -32,10 +32,6 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${clang_cmake_builddir}/ClangConfig.cmake
   @ONLY)
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
-  ${clang_cmake_builddir}/ClangConfigVersion.cmake
-  @ONLY)
 set(CLANG_CONFIG_CMAKE_DIR)
 set(CLANG_CONFIG_LLVM_CMAKE_DIR)
 
@@ -63,10 +59,6 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
   @ONLY)
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
-  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
-  @ONLY)
 set(CLANG_CONFIG_CODE)
 set(CLANG_CONFIG_CMAKE_DIR)
 
@@ -75,7 +67,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 
   install(FILES
 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
-${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
 ${CMAKE_CURRENT_SOURCE_DIR}/AddClang.cmake
 DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}
 COMPONENT clang-cmake-exports)

diff  --git a/clang/cmake/modules/ClangConfig.cmake.in 
b/clang/cmake/modules/ClangConfig.cmake.in
index 5596ad669e209..2a254463d6f5e 100644
--- a/clang/cmake/modules/ClangConfig.cmake.in
+++ b/clang/cmake/modules/ClangConfig.cmake.in
@@ -2,8 +2,7 @@
 
 @CLANG_CONFIG_CODE@
 
-set(LLVM_VERSION 
${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
-find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
+find_package(LLVM REQUIRED CONFIG
  HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")
 
 set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")

diff  --git a/clang/cmake/modules/ClangConfigVersion.cmake.in 
b/clang/cmake/modules/ClangConfigVersion.cmake.in
deleted file mode 100644
index e9ac4ed2da786..0
--- a/clang/cmake/modules/ClangConfigVersion.cmake.in
+++ /dev/null
@@ -1,13 +0,0 @@
-set(PACKAGE_VERSION "@PACKAGE_VERSION@")
-
-# LLVM is API-compatible only with matching major.minor versions
-# and patch versions not less than that requested.
-if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
-"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
-   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
-  set(PACKAGE_VERSION_COMPATIBLE 1)
-  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
-  "${PACKAGE_FIND_VERSION_PATCH}")
-set(PACKAGE_VERSION_EXACT 1)
-  endif()
-endif()

diff  --git a/flang/cmake/modules/CMakeLists.txt 
b/flang/cmake/modules/CMakeLists.txt
index bf50bcaa18d52..31a6c3c83e48b 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -28,8 +28,8 @@ set(FLANG_CONFIG_INCLUDE_DIRS
   "${FLANG_BINARY_DIR}/include"
   )
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
-  ${flang_cmake_builddir}/FlangConfigVersion.cmake
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
+  ${flang_cmake_builddir}/FlangConfig.cmake
   @ONLY)
 set(FLANG_CONFIG_CMAKE_DIR)
 set(FLANG_CONFIG_LLVM_CMAKE_DIR)
@@ -46,10 +46,6 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake
   @ONLY)
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
-  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfigVersion.cmake
-  @ONLY)
 
 set(FLANG_CONFIG_CODE)
 set(FLANG_CONFIG_CMAKE_DIR)
@@ -60,7 +56,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 
   install(FILES
 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake
-${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfigVersion.cmake
 D

[clang] ecfa2d3 - Add version to all LLVM cmake package

2022-11-25 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-11-25T21:57:58Z
New Revision: ecfa2d3d9943a48411d04a4b3103c42b4653d9af

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

LOG: Add version to all LLVM cmake package

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.

Reviewed By: arsenm, stellaraccident, mceier

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

Added: 
clang/cmake/modules/ClangConfigVersion.cmake.in
flang/cmake/modules/FlangConfigVersion.cmake.in
lld/cmake/modules/LLDConfigVersion.cmake.in
mlir/cmake/modules/MLIRConfigVersion.cmake.in
polly/cmake/PollyConfigVersion.cmake.in

Modified: 
clang/cmake/modules/CMakeLists.txt
clang/cmake/modules/ClangConfig.cmake.in
flang/cmake/modules/CMakeLists.txt
flang/cmake/modules/FlangConfig.cmake.in
lld/cmake/modules/CMakeLists.txt
lld/cmake/modules/LLDConfig.cmake.in
mlir/cmake/modules/CMakeLists.txt
mlir/cmake/modules/MLIRConfig.cmake.in
polly/cmake/CMakeLists.txt
polly/cmake/PollyConfig.cmake.in

Removed: 




diff  --git a/clang/cmake/modules/CMakeLists.txt 
b/clang/cmake/modules/CMakeLists.txt
index 880d51f5aef7..749ef672c34f 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -32,6 +32,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${clang_cmake_builddir}/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${clang_cmake_builddir}/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CMAKE_DIR)
 set(CLANG_CONFIG_LLVM_CMAKE_DIR)
 
@@ -59,6 +63,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
+  @ONLY)
 set(CLANG_CONFIG_CODE)
 set(CLANG_CONFIG_CMAKE_DIR)
 
@@ -67,6 +75,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
 
   install(FILES
 ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
+${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
 ${CMAKE_CURRENT_SOURCE_DIR}/AddClang.cmake
 DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}
 COMPONENT clang-cmake-exports)

diff  --git a/clang/cmake/modules/ClangConfig.cmake.in 
b/clang/cmake/modules/ClangConfig.cmake.in
index 2a254463d6f5..5f67681649c6 100644
--- a/clang/cmake/modules/ClangConfig.cmake.in
+++ b/clang/cmake/modules/ClangConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @CLANG_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION 
@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
+find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
  HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")
 
 set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")

diff  --git a/clang/cmake/modules/ClangConfigVersion.cmake.in 
b/clang/cmake/modules/ClangConfigVersion.cmake.in
new file mode 100644
index ..e9ac4ed2da78
--- /dev/null
+++ b/clang/cmake/modules/ClangConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()

diff  --git a/flang/cmake/modules/CMakeLists.txt 
b/flang/cmake/modules/CMakeLists.txt
index 31a6c3c83e48..bf50bcaa18d5 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -28,8 +28,8 @@ set(FLANG_CONFIG_INCLUDE_DIRS
   "${FLANG_BINARY_DIR}/include"
   )
 configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
-  ${flang_cmake_builddir}/FlangConfig.cmake
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${flang_cmake_builddir}/FlangConfigVersion.cmake
   @ONLY)
 set(FLANG_CONFIG_CMAKE_DIR)
 set(FLANG_CONFIG_LLVM_CMAKE_DIR)
@@ -46,6 +46,10 @@ configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfigVersion.cmake
+  @ONLY)
 
 set(FLANG_CONFIG_CODE)
 set(FLANG_CONFIG_CMAKE_DIR)
@@ -56,6 +60,7 @@ if 

[clang] b81cc60 - [clang][NFC] Make various uses of Regex const

2019-11-19 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2019-11-19T16:15:21Z
New Revision: b81cc6032902c810e0fde485d3092a947dc38541

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

LOG: [clang][NFC] Make various uses of Regex const

The const-correctness of match() was fixed in rL372764, which allows
uses of Regex objects to be const in cases they couldn't be before. This
patch tightens up the const-ness of Regex in various such cases.

Reviewers: thopre

Reviewed By: thopre

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
clang/lib/Format/BreakableToken.cpp
clang/lib/Format/BreakableToken.h
clang/lib/Format/NamespaceEndCommentsFixer.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/tools/clang-refactor/TestSupport.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h 
b/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
index 6e6d6d8fb024..18374ad46a9c 100644
--- a/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
+++ b/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
@@ -42,8 +42,7 @@ class IncludeCategoryManager {
   std::string FileName;
   // This refers to a substring in FileName.
   StringRef FileStem;
-  // Regex is not thread-safe.
-  mutable SmallVector CategoryRegexs;
+  SmallVector CategoryRegexs;
 };
 
 /// Generates replacements for inserting or deleting #include directives in a

diff  --git a/clang/lib/Format/BreakableToken.cpp 
b/clang/lib/Format/BreakableToken.cpp
index 09ea5473c0c1..cd0eb0b4324a 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -88,11 +88,11 @@ getCommentSplit(StringRef Text, unsigned ContentStartColumn,
 
   StringRef::size_type SpaceOffset = Text.find_last_of(Blanks, MaxSplitBytes);
 
-  static auto *const kNumberedListRegexp = new llvm::Regex("^[1-9][0-9]?\\.");
+  static const auto kNumberedListRegexp = llvm::Regex("^[1-9][0-9]?\\.");
   while (SpaceOffset != StringRef::npos) {
 // Do not split before a number followed by a dot: this would be 
interpreted
 // as a numbered list, which would prevent re-flowing in subsequent passes.
-if (kNumberedListRegexp->match(Text.substr(SpaceOffset).ltrim(Blanks)))
+if (kNumberedListRegexp.match(Text.substr(SpaceOffset).ltrim(Blanks)))
   SpaceOffset = Text.find_last_of(Blanks, SpaceOffset);
 // In JavaScript, some @tags can be followed by {, and machinery that 
parses
 // these comments will fail to understand the comment if followed by a line
@@ -245,7 +245,7 @@ BreakableStringLiteral::BreakableStringLiteral(
 
 BreakableToken::Split BreakableStringLiteral::getSplit(
 unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
-unsigned ContentStartColumn, llvm::Regex &CommentPragmasRegex) const {
+unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const 
{
   return getStringSplit(Line.substr(TailOffset), ContentStartColumn,
 ColumnLimit - Postfix.size(), Style.TabWidth, 
Encoding);
 }
@@ -271,7 +271,7 @@ unsigned BreakableComment::getLineCount() const { return 
Lines.size(); }
 BreakableToken::Split
 BreakableComment::getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit, unsigned ContentStartColumn,
-   llvm::Regex &CommentPragmasRegex) const {
+   const llvm::Regex &CommentPragmasRegex) const {
   // Don't break lines matching the comment pragmas regex.
   if (CommentPragmasRegex.match(Content[LineIndex]))
 return Split(StringRef::npos, 0);
@@ -316,9 +316,9 @@ static bool mayReflowContent(StringRef Content) {
   // Numbered lists may also start with a number followed by '.'
   // To avoid issues if a line starts with a number which is actually the end
   // of a previous line, we only consider numbers with up to 2 digits.
-  static auto *const kNumberedListRegexp = new llvm::Regex("^[1-9][0-9]?\\. ");
+  static const auto kNumberedListRegexp = llvm::Regex("^[1-9][0-9]?\\. ");
   hasSpecialMeaningPrefix =
-  hasSpecialMeaningPrefix || kNumberedListRegexp->match(Content);
+  hasSpecialMeaningPrefix || kNumberedListRegexp.match(Content);
 
   // Simple heuristic for what to reflow: content should contain at least two
   // characters and either the first or second character must be
@@ -458,7 +458,7 @@ BreakableBlockComment::BreakableBlockComment(
 
 BreakableToken::Split BreakableBlockComment::getSplit(
 unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
-unsigned ContentStartColumn, llvm::Regex &CommentPragmasRegex) const {
+unsigned ContentStartColumn, const llvm::Regex 

[clang] 717140a - [clang test] Do not assume default target

2019-12-02 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2019-12-02T22:57:30Z
New Revision: 717140a0dcc651ca2fec23248d1675fb2d388b9c

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

LOG: [clang test] Do not assume default target

Summary:
clang test Driver/darwin-opt-record.c assumes the default target is
x86_64 by its uses of the -arch x86_64 and -arch x86_64h and thus fail
on systems where it is not the case. Adding a target
x86_64-apple-darwin10 reveals another problem: the driver refuses 2
-arch for an assembly output so this commit also changes the output to
be an object file.

Reviewers: thegameg

Reviewed By: thegameg

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/test/Driver/darwin-opt-record.c

Removed: 




diff  --git a/clang/test/Driver/darwin-opt-record.c 
b/clang/test/Driver/darwin-opt-record.c
index ca0fad7ee16d..7c674819663a 100644
--- a/clang/test/Driver/darwin-opt-record.c
+++ b/clang/test/Driver/darwin-opt-record.c
@@ -1,6 +1,6 @@
 // REQUIRES: system-darwin
 
-// RUN: %clang -### -S -o FOO -fsave-optimization-record -arch x86_64 -arch 
x86_64h %s 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-ARCH
+// RUN: %clang -target x86_64-apple-darwin10 -### -c -o FOO 
-fsave-optimization-record -arch x86_64 -arch x86_64h %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-MULTIPLE-ARCH
 //
 // CHECK-MULTIPLE-ARCH: "-cc1"
 // CHECK-MULTIPLE-ARCH: "-opt-record-file" "FOO-x86_64.opt.yaml"



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


[clang] ddd0bb8 - [lit] Remove lit's REQUIRES-ANY directive

2019-12-17 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2019-12-17T10:36:36Z
New Revision: ddd0bb8dba2a367c6aa8a25e98915509847745ce

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

LOG: [lit] Remove lit's REQUIRES-ANY directive

Summary:
Remove REQUIRES-ANY alias lit directive since it is hardly used and can
be easily implemented using an OR expression using REQUIRES. Fixup
remaining testcases still using REQUIRES-ANY.

Reviewers: probinson, jdenny, gparker42

Reviewed By: gparker42

Subscribers: eugenis, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, 
delcypher, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, 
the_o, PkmX, jocewei, lenary, s.egerton, pzheng, sameer.abuasal, apazos, 
luismarques, cfe-commits, #sanitizers, llvm-commits

Tags: #llvm, #clang, #sanitizers

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

Added: 


Modified: 
clang/test/Driver/XRay/xray-instrument-macos.c
clang/test/Driver/XRay/xray-instrument-os.c
clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
clang/test/Driver/XRay/xray-mode-flags.cpp
clang/test/Driver/XRay/xray-nolinkdeps.cpp
compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_cdcmple_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_cfcmple_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_drsub_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_frsub_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_idivmod_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
llvm/utils/lit/lit/TestRunner.py

Removed: 
llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt



diff  --git a/clang/test/Driver/XRay/xray-instrument-macos.c 
b/clang/test/Driver/XRay/xray-instrument-macos.c
index afccc625832b..ce68345ed019 100644
--- a/clang/test/Driver/XRay/xray-instrument-macos.c
+++ b/clang/test/Driver/XRay/xray-instrument-macos.c
@@ -1,4 +1,4 @@
 // RUN: %clang -o /dev/null -v -fxray-instrument -target 
x86_64-apple-macos10.11 -c %s
 // RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-darwin15 
-c %s
-// REQUIRES-ANY: x86_64, x86_64h
+// REQUIRES: x86_64 || x86_64h
 typedef int a;

diff  --git a/clang/test/Driver/XRay/xray-instrument-os.c 
b/clang/test/Driver/XRay/xray-instrument-os.c
index 3a0c428ce19c..ba97328b54a6 100644
--- a/clang/test/Driver/XRay/xray-instrument-os.c
+++ b/clang/test/Driver/XRay/xray-instrument-os.c
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
 // XFAIL: -linux-, -freebsd, -darwin, -macos
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
+// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64
 typedef int a;

diff  --git a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp 
b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
index da2535509b99..b68dca235525 100644
--- a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
+++ b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -7,5 +7,5 @@
 // RUN: | FileCheck %s
 // CHECK:  -fxray-instrumentation-bundle=function
 //
-// REQUIRES-ANY: linux, freebsd
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
+// REQUIRES: linux || freebsd
+// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64

diff  --git a/clang/test/Driver/XRay/xray-mode-flags.cpp 
b/clang/test/Driver/XRay/xray-mode-flags.cpp
index 281cf0b547fa..e95053a4c684 100644
--- a/clang/test/Driver/XRay/xray-mode-flags.cpp
+++ b/clang/test/Driver/XRay/xray-mode-flags.cpp
@@ -45,5 +45,5 @@
 // FDR: libclang_rt.xray-fdr
 // NONE-NOT: libclang_rt.xray-basic
 // NONE-NOT: libclang_rt.xray-fdr
-// REQUIRES-ANY: linux, freebsd
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
+// REQUIRES: linux || freebsd
+// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64

diff  --git a/clang/test/Driver/XRay/xray-nolinkdeps.cpp 
b/clang/test/Driver/XRay/xray-nolinkdeps.cpp
index 5a79e362e356..5461fc325a24 100644
--- a/clang/test/Driver/XRay/xray-nolinkdeps.cpp
+++ b/clang/test/Driver/XRay/xray-nolinkdeps.cpp
@@ -4,5 +4,5 @@
 // RUN: 2>&1 | FileCheck --check-prefix ENABLE %s
 // ENABLE: clang_rt.xray
 // DISABLE-NOT: clang_rt.xray
-// REQUIRES-ANY: linux, freebsd
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
+// REQUIRES: linux || freebsd
+// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64

diff  --git a/compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c 
b/compiler-rt/test/buil

[clang] [clang-tools-extra] [flang] [llvm] [mlir] [polly] [test]: fix filecheck annotation typos (PR #91854)

2024-05-13 Thread Thomas Preud'homme via cfe-commits


@@ -58,7 +58,7 @@ CHECK-CNT3-NOT: {{^}}this is duplicate
 CHECK-CNT4-COUNT-5: this is duplicate
 CHECK-CNT4-EMPTY:
 
-Many-label:
+Many-LABEL:

RoboTux wrote:

IMO this makes it harder to spot that this is *not* a FileCheck directive. I 
think we should drop all the changes in this file.

https://github.com/llvm/llvm-project/pull/91854
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 2426b1f - [Test] Fix undef var in attr-speculative-load-hardening.c

2021-03-17 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-17T19:12:25Z
New Revision: 2426b1fa66f95d2b6b874e422edceccdf6431162

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

LOG: [Test] Fix undef var in attr-speculative-load-hardening.c

Fix use of undefined variable in CHECK-NOT directive in clang test
CodeGen/attr-speculative-load-hardening.c.

Reviewed By: kristof.beyls

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

Added: 


Modified: 
clang/test/CodeGen/attr-speculative-load-hardening.c

Removed: 




diff  --git a/clang/test/CodeGen/attr-speculative-load-hardening.c 
b/clang/test/CodeGen/attr-speculative-load-hardening.c
index 97bccd03585c..784640f93932 100644
--- a/clang/test/CodeGen/attr-speculative-load-hardening.c
+++ b/clang/test/CodeGen/attr-speculative-load-hardening.c
@@ -12,4 +12,4 @@ int test1() {
 
 // NOSLH: @{{.*}}test1{{.*}}[[NOSLH:#[0-9]+]]
 
-// NOSLH-NOT: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }
+// NOSLH-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }



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


[clang] e5cd5b3 - [test] Fix variable definition in acle_sve_ld1.sh

2021-03-18 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-03-18T12:15:45Z
New Revision: e5cd5b352ff481f02e1f4555033edf87112dcc0c

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

LOG: [test] Fix variable definition in acle_sve_ld1.sh

Clang test acle_sve_ld1.sh is missing the colon in one of the string
variable definition separating the variable name from the regex. This
leads the substitution block to be parsed as a numeric variable use.

Reviewed By: sdesmalen

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

Added: 


Modified: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
index 6475b19ab653..6e3b32e1cc19 100644
--- a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
+++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
@@ -114,7 +114,7 @@ svint32_t test_svld1sh_gather_u32base_s32(svbool_t pg, 
svuint32_t bases) {
 
 svint64_t test_svld1sh_gather_u64base_s64(svbool_t pg, svuint64_t bases) {
   // CHECK-LABEL: test_svld1sh_gather_u64base_s64
-  // CHECK: %[[PG.*]] = call  
@llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
+  // CHECK: %[[PG:.*]] = call  
@llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
   // CHECK: %[[LOAD:.*]] = call  
@llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64( 
%[[PG]],  %bases, i64 0)
   // CHECK: %[[SEXT:.*]] = sext  %[[LOAD]] to 
   // CHECK: ret  %[[SEXT]]



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


[clang] d222a07 - [OpenMP, test] Fix uses of undef S*VAR FileCheck var

2021-04-01 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-02T00:36:14+01:00
New Revision: d222a07d3023599b8090ed20ca9137b128f5af6c

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

LOG: [OpenMP, test] Fix uses of undef S*VAR FileCheck var

Fix the many cases of use of undefined SIVAR/SVAR/SFVAR in OpenMP
*private_codegen tests, due to a missing BLOCK directive to capture the
IR variable when it is declared. It also fixes a few typo in its use.

Reviewed By: MaskRay

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

Added: 


Modified: 
clang/test/OpenMP/for_firstprivate_codegen.cpp
clang/test/OpenMP/for_private_codegen.cpp
clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp
clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp
clang/test/OpenMP/master_taskloop_private_codegen.cpp
clang/test/OpenMP/master_taskloop_simd_firstprivate_codegen.cpp
clang/test/OpenMP/master_taskloop_simd_lastprivate_codegen.cpp
clang/test/OpenMP/master_taskloop_simd_private_codegen.cpp
clang/test/OpenMP/nvptx_target_firstprivate_codegen.cpp
clang/test/OpenMP/parallel_firstprivate_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_firstprivate_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_private_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_simd_firstprivate_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_simd_private_codegen.cpp
clang/test/OpenMP/parallel_private_codegen.cpp
clang/test/OpenMP/sections_firstprivate_codegen.cpp
clang/test/OpenMP/sections_lastprivate_codegen.cpp
clang/test/OpenMP/sections_private_codegen.cpp
clang/test/OpenMP/single_firstprivate_codegen.cpp
clang/test/OpenMP/single_private_codegen.cpp
clang/test/OpenMP/task_firstprivate_codegen.cpp
clang/test/OpenMP/task_private_codegen.cpp
clang/test/OpenMP/taskloop_firstprivate_codegen.cpp
clang/test/OpenMP/taskloop_lastprivate_codegen.cpp
clang/test/OpenMP/taskloop_private_codegen.cpp
clang/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp
clang/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp
clang/test/OpenMP/taskloop_simd_private_codegen.cpp

Removed: 




diff  --git a/clang/test/OpenMP/for_firstprivate_codegen.cpp 
b/clang/test/OpenMP/for_firstprivate_codegen.cpp
index 510453afd2c7..d1fc55285044 100644
--- a/clang/test/OpenMP/for_firstprivate_codegen.cpp
+++ b/clang/test/OpenMP/for_firstprivate_codegen.cpp
@@ -147,6 +147,7 @@ int main() {
   return 0;
 #elif defined(BLOCKS)
   // BLOCKS: [[G:@.+]] ={{.*}} global i{{[0-9]+}} 1212,
+  // BLOCKS: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
   // BLOCKS-LABEL: @main
   // BLOCKS: call void {{%.+}}(i8
   ^{

diff  --git a/clang/test/OpenMP/for_private_codegen.cpp 
b/clang/test/OpenMP/for_private_codegen.cpp
index 63b7aab4e486..39052fb814a6 100644
--- a/clang/test/OpenMP/for_private_codegen.cpp
+++ b/clang/test/OpenMP/for_private_codegen.cpp
@@ -110,6 +110,8 @@ int main() {
   return 0;
 #elif defined(BLOCKS)
   // BLOCKS: [[G:@.+]] = {{(dso_local )?}}global double
+  // BLOCKS: [[SVAR:@.+]] = internal global i{{[0-9]+}} 0,
+  // BLOCKS: [[SFVAR:@.+]] = internal global float 0.00e+00,
   // BLOCKS-LABEL: @main
   // BLOCKS: call {{.*}}void {{%.+}}(i8
   ^{

diff  --git a/clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp 
b/clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp
index 9aa1affc4bb5..35e7e4902be3 100644
--- a/clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp
+++ b/clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp
@@ -109,6 +109,7 @@ int main() {
   return 0;
 #elif defined(BLOCKS)
   // BLOCKS: [[G:@.+]] ={{.*}} global double
+  // BLOCKS: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
   // BLOCKS-LABEL: @main
   // BLOCKS: call void {{%.+}}(i8
   ^{
@@ -137,7 +138,7 @@ int main() {
 // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
 // BLOCKS: store volatile double 2.0{{.+}}, double*
 // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
-// BLOCKS-NOT: [[ISVAR]]{{[[^:word:]]}}
+// BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
 // BLOCKS: store i{{[0-9]+}} 22, i{{[0-9]+}}*
 // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
 // BLOCKS: ret

diff  --git a/clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp 
b/clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp
index a7d2d792af89..6fc76077d5b1 100644
--- a/clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp
+++ b/clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp
@@ -103,6 +103,7 @@ int main() {
   return 0;
 #elif defined(BLOCKS)
   // BLOCKS: [[G:@.+]] ={{.*}} global double
+  // BLOCKS: [[SIVAR:@

[clang] 58e4589 - [OpenMP, test] Fix use of undef DECL FileCheck var

2021-04-01 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-02T00:36:56+01:00
New Revision: 58e458935ba6debed11edd9baa98862db0a12651

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

LOG: [OpenMP, test] Fix use of undef DECL FileCheck var

OpenMP test target_data_use_device_ptr_if_codegen contains a CHECK-NOT
directive using an undefined DECL FileCheck variable. It seems copied
from target_data_use_device_ptr_codegen where there's a CHECK for a load
that defined the variable. Since there is no corresponding load in this
testcase, the simplest is to simply forbid any store and get rid of the
variable altogether.

Reviewed By: ABataev

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

Added: 


Modified: 
clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp

Removed: 




diff  --git a/clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp 
b/clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp
index d423e212f05f..f25ca6babc11 100644
--- a/clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp
+++ b/clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp
@@ -29,7 +29,7 @@ void add_one(float *b, int dm)
   // CK1: store float* [[B_ADDR:%.+]], float** [[CBP]]
   // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE00]]
   // CK1: [[VAL:%.+]] = load float*, float** [[CBP]],
-  // CK1-NOT: store float* [[VAL]], float** [[DECL]],
+  // CK1-NOT: store float* [[VAL]], float** {{%.+}},
   // CK1: store float* [[VAL]], float** [[PVT:%.+]],
   // CK1: [[TT:%.+]] = load float*, float** [[PVT]],
   // CK1: call i32 @__tgt_target{{.+}}[[MTYPE01]]



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


[clang] 2c3db73 - [OpenMP, test] Fix use of undef VAR_PRIV FileCheck var

2021-04-01 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-02T00:39:21+01:00
New Revision: 2c3db73341aea084e44600400e9fe39690416923

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

LOG: [OpenMP, test] Fix use of undef VAR_PRIV FileCheck var

Remove the CHECK-NOT directive referring to as-of-yet undefined VAR_PRIV
variable since the pattern of the following CHECK-NOT in the same
CHECK-NOT block covers a superset of the case caught by the first
CHECK-NOT.

Reviewed By: ABataev

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

Added: 


Modified: 
clang/test/OpenMP/sections_reduction_codegen.cpp

Removed: 




diff  --git a/clang/test/OpenMP/sections_reduction_codegen.cpp 
b/clang/test/OpenMP/sections_reduction_codegen.cpp
index 44e18c929b33..8154cac2aeb8 100644
--- a/clang/test/OpenMP/sections_reduction_codegen.cpp
+++ b/clang/test/OpenMP/sections_reduction_codegen.cpp
@@ -210,7 +210,6 @@ int main() {
 // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** 
[[GTID_ADDR_ADDR]]
 // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]]
 
-// CHECK-NOT: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
 // CHECK-NOT: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]*
 
 // CHECK: call void @__kmpc_for_static_init_4(



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


[clang] 95f448a - [PGO, test] Fix typo in FileCheck var

2021-04-03 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-03T08:44:46+01:00
New Revision: 95f448aa86cd3680a9493b2311d9efb41c4d4c01

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

LOG: [PGO, test] Fix typo in FileCheck var

Reviewed By: xur

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

Added: 


Modified: 
clang/test/Profile/c-unreachable-after-switch.c

Removed: 




diff  --git a/clang/test/Profile/c-unreachable-after-switch.c 
b/clang/test/Profile/c-unreachable-after-switch.c
index 36a75449dbdf4..cfc111b2752e0 100644
--- a/clang/test/Profile/c-unreachable-after-switch.c
+++ b/clang/test/Profile/c-unreachable-after-switch.c
@@ -11,5 +11,5 @@ void foo() {
 return;
   }
   // We shouldn't emit the unreachable counter. This used to crash in 
GlobalDCE.
-  // CHECK-NOT: store {{.*}} @[[SWC]], i64 0, i64 1}
+  // CHECK-NOT: store {{.*}} @[[C]], i64 0, i64 1}
 }



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


[clang] 1cc9d94 - [C++20, test] Fix use of undef FileCheck variable

2021-04-03 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-04T00:05:48+01:00
New Revision: 1cc9d949a1233e8b17b3b345ccb67ca7296c1a6c

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

LOG: [C++20, test] Fix use of undef FileCheck variable

Commit f495de43bd5da50286da6020e508d106cfc60f57 forgot two lines when
removing checks for strong and weak equality, resulting in the use of an
undefined FileCheck variable.

Reviewed By: Quuxplusone

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

Added: 


Modified: 
clang/test/CodeGenCXX/cxx2a-compare.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/cxx2a-compare.cpp 
b/clang/test/CodeGenCXX/cxx2a-compare.cpp
index 262fead875797..48ce956d9d402 100644
--- a/clang/test/CodeGenCXX/cxx2a-compare.cpp
+++ b/clang/test/CodeGenCXX/cxx2a-compare.cpp
@@ -9,8 +9,6 @@
 // Ensure we don't emit definitions for the global variables
 // since the builtins shouldn't ODR use them.
 // CHECK-NOT: constant %[[SO]]
-// CHECK-NOT: constant %[[SE]]
-// CHECK-NOT: constant %[[WE]]
 // CHECK-NOT: constant %[[PO]]
 
 // CHECK-LABEL: @_Z11test_signedii



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


[clang] a41b510 - [HIP-Clang, test] Fix use of undef FileCheck var

2021-04-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-04T19:30:27+01:00
New Revision: a41b5100e43810694c09469bc725f560e7ef239f

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

LOG: [HIP-Clang, test] Fix use of undef FileCheck var

Commit 8129521318accc44c2a009647572f6ebd3fc56dd changed a line defining
PREFIX in clang test CodeGenCUDA/device-stub.cu into a CHECK-NOT
directive. All following lines using PREFIX are therefore using an
undefined variable since the pattern defining PREFIX is not supposed to
occur and CHECK-NOT are checked independently.

This commit replaces all uses of PREFIX by the regex used to define it,
thereby avoiding the problem.

Reviewed By: yaxunl

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

Added: 


Modified: 
clang/test/CodeGenCUDA/device-stub.cu

Removed: 




diff  --git a/clang/test/CodeGenCUDA/device-stub.cu 
b/clang/test/CodeGenCUDA/device-stub.cu
index e1fa931a13da9..9bac4e81a54a2 100644
--- a/clang/test/CodeGenCUDA/device-stub.cu
+++ b/clang/test/CodeGenCUDA/device-stub.cu
@@ -266,13 +266,13 @@ void hostfunc(void) { kernelfunc<<<1, 1>>>(1, 1, 1); }
 // CUDANOGLOBALS-NOT: @{{.*}} = private constant{{.*}}
 // HIPNOGLOBALS-NOT: @{{.*}} = internal constant{{.*}}
 // NOGLOBALS-NOT: define internal void @__{{.*}}_register_globals
-// NOGLOBALS-NOT: define internal void @__[[PREFIX:cuda|hip]]_module_ctor
-// NOGLOBALS-NOT: 
call{{.*}}[[PREFIX]]RegisterFatBinary{{.*}}__[[PREFIX]]_fatbin_wrapper
-// NOGLOBALS-NOT: call void @__[[PREFIX]]_register_globals
-// NOGLOBALS-NOT: define internal void @__[[PREFIX]]_module_dtor
-// NOGLOBALS-NOT: call void @__[[PREFIX]]UnregisterFatBinary
+// NOGLOBALS-NOT: define internal void @__{{cuda|hip}}_module_ctor
+// NOGLOBALS-NOT: 
call{{.*}}{{cuda|hip}}RegisterFatBinary{{.*}}__{{cuda|hip}}_fatbin_wrapper
+// NOGLOBALS-NOT: call void @__{{cuda|hip}}_register_globals
+// NOGLOBALS-NOT: define internal void @__{{cuda|hip}}_module_dtor
+// NOGLOBALS-NOT: call void @__{{cuda|hip}}UnregisterFatBinary
 
 // There should be no constructors/destructors if we have no GPU binary.
-// NOGPUBIN-NOT: define internal void @__[[PREFIX]]_register_globals
-// NOGPUBIN-NOT: define internal void @__[[PREFIX]]_module_ctor
-// NOGPUBIN-NOT: define internal void @__[[PREFIX]]_module_dtor
+// NOGPUBIN-NOT: define internal void @__{{cuda|hip}}_register_globals
+// NOGPUBIN-NOT: define internal void @__{{cuda|hip}}_module_ctor
+// NOGPUBIN-NOT: define internal void @__{{cuda|hip}}_module_dtor



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


[clang] 292726b - [HIP, test] Fix use of undef FileCheck var

2021-04-04 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-04T19:30:49+01:00
New Revision: 292726b6443c7d7be4bb03af40cd3f60188b2ff7

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

LOG: [HIP, test] Fix use of undef FileCheck var

Clang test CodeGenCUDA/kernel-stub-name.cu uses never defined DKERN
variable in a CHECK-NOT directive. This commit replace the variable by a
regex, thereby avoiding the issue.

Reviewed By: yaxunl

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

Added: 


Modified: 
clang/test/CodeGenCUDA/kernel-stub-name.cu

Removed: 




diff  --git a/clang/test/CodeGenCUDA/kernel-stub-name.cu 
b/clang/test/CodeGenCUDA/kernel-stub-name.cu
index 0c504b612ea72..460dd6010e835 100644
--- a/clang/test/CodeGenCUDA/kernel-stub-name.cu
+++ b/clang/test/CodeGenCUDA/kernel-stub-name.cu
@@ -126,4 +126,4 @@ void fun5() {
 // CHECK: call{{.*}}@__hipRegisterFunction{{.*}}@[[HCKERN]]{{.*}}@[[CKERN]]
 // CHECK: call{{.*}}@__hipRegisterFunction{{.*}}@[[HNSKERN]]{{.*}}@[[NSKERN]]
 // CHECK: call{{.*}}@__hipRegisterFunction{{.*}}@[[HTKERN]]{{.*}}@[[TKERN]]
-// CHECK-NOT: call{{.*}}@__hipRegisterFunction{{.*}}@[[HDKERN]]{{.*}}@[[DKERN]]
+// CHECK-NOT: 
call{{.*}}@__hipRegisterFunction{{.*}}@[[HDKERN]]{{.*}}@{{[0-9]*}}



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


[clang] 4dd3e0f - [DebugInfo, CallSites, test] Fix use of undef FileCheck var

2021-04-05 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-05T11:39:24+01:00
New Revision: 4dd3e0feca9295c615f06f9f96f1e7ccdd63bb3d

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

LOG: [DebugInfo, CallSites, test] Fix use of undef FileCheck var

Clang test CodeGen/debug-info-extern-call.c tries to check for the
absence of a sequence of instructions with several CHECK-NOT with one of
those directives using a variable defined in another. However CHECK-NOT
are checked independently so that is using a variable defined in a
pattern that should not occur in the input.

This commit removes the CHECK-NOT for the retained line attribute
definition since the CHECK-NOT on the compile unit will already check
that there is no retained lines.

Reviewed By: djtodoro

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

Added: 


Modified: 
clang/test/CodeGen/debug-info-extern-call.c

Removed: 




diff  --git a/clang/test/CodeGen/debug-info-extern-call.c 
b/clang/test/CodeGen/debug-info-extern-call.c
index 7ba115ad2ec9e..f9abb93efe865 100644
--- a/clang/test/CodeGen/debug-info-extern-call.c
+++ b/clang/test/CodeGen/debug-info-extern-call.c
@@ -21,8 +21,7 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o 
- \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
-// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: 
![[RETTYPES:[0-9]+]]
-// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: !{{[0-9]+}}
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"



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


[clang] 828ec9e - [OpenCL, test] Fix use of undef FileCheck var

2021-04-05 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-05T21:11:39+01:00
New Revision: 828ec9e9e5da8a2e7d1bfa523b9a712658ee6ffc

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

LOG: [OpenCL, test] Fix use of undef FileCheck var

Clang test CodeGenOpenCL/fpmath.cl uses a variable defined in an earlier
CHECK-NOT directive. However, by definition the pattern in that
directive is not supposed to occur so no variable will be defined. This
commit solves the issue by using a regex match with the same regex as in
the definition. It also changes the definition into a regex match since
no variable is going to be defined.

Reviewed By: yaxunl

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

Added: 


Modified: 
clang/test/CodeGenOpenCL/fpmath.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/fpmath.cl 
b/clang/test/CodeGenOpenCL/fpmath.cl
index 36cb8e68ea7c..374b58c9bc04 100644
--- a/clang/test/CodeGenOpenCL/fpmath.cl
+++ b/clang/test/CodeGenOpenCL/fpmath.cl
@@ -9,7 +9,7 @@ float spscalardiv(float a, float b) {
   // CHECK: @spscalardiv
   // CHECK: fdiv{{.*}},
   // NODIVOPT: !fpmath ![[MD:[0-9]+]]
-  // DIVOPT-NOT: !fpmath ![[MD:[0-9]+]]
+  // DIVOPT-NOT: !fpmath !{{[0-9]+}}
   return a / b;
 }
 
@@ -17,7 +17,7 @@ float4 spvectordiv(float4 a, float4 b) {
   // CHECK: @spvectordiv
   // CHECK: fdiv{{.*}},
   // NODIVOPT: !fpmath ![[MD]]
-  // DIVOPT-NOT: !fpmath ![[MD]]
+  // DIVOPT-NOT: !fpmath !{{[0-9]+}}
   return a / b;
 }
 



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


[clang] e018698 - [clang, test] Fix use of undef FileCheck var

2021-04-07 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-07T09:43:58+01:00
New Revision: e018698bec363637f0da25b68da9ba8c3192d1cb

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

LOG: [clang, test] Fix use of undef FileCheck var

Clang test CodeGen/libcalls.c contains CHECK-NOT directives using a
variable defined in a CHECK directive with a different prefix never
enabled together, therefore causing the variable to be undefined in that
CHECK-NOT.

The intent of the test is to check that some declaration do not have the
same attribute as when compiling the test without -fmath-errno. This
commits instead changes all CHECK-NOT to CHECK directive, checking that
they all use the same attribute. It also adds an extra CHECK for that
prefix to check the expected attributes these functions should have when
compiling with -fmath-errno.

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/test/CodeGen/libcalls.c

Removed: 




diff  --git a/clang/test/CodeGen/libcalls.c b/clang/test/CodeGen/libcalls.c
index 41ad6dc8e555..627732916f25 100644
--- a/clang/test/CodeGen/libcalls.c
+++ b/clang/test/CodeGen/libcalls.c
@@ -88,9 +88,9 @@ void test_builtins(double d, float f, long double ld) {
 // CHECK-NO: declare double @atan(double) [[NUW_RN:#[0-9]+]]
 // CHECK-NO: declare x86_fp80 @atanl(x86_fp80) [[NUW_RN]]
 // CHECK-NO: declare float @atanf(float) [[NUW_RN]]
-// CHECK-YES-NOT: declare double @atan(double) [[NUW_RN]]
-// CHECK-YES-NOT: declare x86_fp80 @atanl(x86_fp80) [[NUW_RN]]
-// CHECK-YES-NOT: declare float @atanf(float) [[NUW_RN]]
+// CHECK-YES: declare double @atan(double) [[NUW:#[0-9]+]]
+// CHECK-YES: declare x86_fp80 @atanl(x86_fp80) [[NUW]]
+// CHECK-YES: declare float @atanf(float) [[NUW]]
 
   double atan2_ = atan2(d, 2);
   long double atan2l_ = atan2l(ld, ld);
@@ -98,9 +98,9 @@ void test_builtins(double d, float f, long double ld) {
 // CHECK-NO: declare double @atan2(double, double) [[NUW_RN]]
 // CHECK-NO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NUW_RN]]
 // CHECK-NO: declare float @atan2f(float, float) [[NUW_RN]]
-// CHECK-YES-NOT: declare double @atan2(double, double) [[NUW_RN]]
-// CHECK-YES-NOT: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NUW_RN]]
-// CHECK-YES-NOT: declare float @atan2f(float, float) [[NUW_RN]]
+// CHECK-YES: declare double @atan2(double, double) [[NUW]]
+// CHECK-YES: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NUW]]
+// CHECK-YES: declare float @atan2f(float, float) [[NUW]]
 
   double exp_ = exp(d);
   long double expl_ = expl(ld);
@@ -108,9 +108,9 @@ void test_builtins(double d, float f, long double ld) {
 // CHECK-NO: declare double @llvm.exp.f64(double) [[NUW_RNI]]
 // CHECK-NO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[NUW_RNI]]
 // CHECK-NO: declare float @llvm.exp.f32(float) [[NUW_RNI]]
-// CHECK-YES-NOT: declare double @exp(double) [[NUW_RN]]
-// CHECK-YES-NOT: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]]
-// CHECK-YES-NOT: declare float @expf(float) [[NUW_RN]]
+// CHECK-YES: declare double @exp(double) [[NUW]]
+// CHECK-YES: declare x86_fp80 @expl(x86_fp80) [[NUW]]
+// CHECK-YES: declare float @expf(float) [[NUW]]
 
   double log_ = log(d);
   long double logl_ = logl(ld);
@@ -118,10 +118,11 @@ void test_builtins(double d, float f, long double ld) {
 // CHECK-NO: declare double @llvm.log.f64(double) [[NUW_RNI]]
 // CHECK-NO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[NUW_RNI]]
 // CHECK-NO: declare float @llvm.log.f32(float) [[NUW_RNI]]
-// CHECK-YES-NOT: declare double @log(double) [[NUW_RN]]
-// CHECK-YES-NOT: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]]
-// CHECK-YES-NOT: declare float @logf(float) [[NUW_RN]]
+// CHECK-YES: declare double @log(double) [[NUW]]
+// CHECK-YES: declare x86_fp80 @logl(x86_fp80) [[NUW]]
+// CHECK-YES: declare float @logf(float) [[NUW]]
 }
 
+// CHECK-YES: attributes [[NUW]] = { nounwind "frame-pointer"="none" 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-features"="+cx8,+x87" }
 // CHECK-NO-DAG: attributes [[NUW_RN]] = { nounwind readnone{{.*}} }
 // CHECK-NO-DAG: attributes [[NUW_RNI]] = { nofree nosync nounwind readnone 
speculatable willreturn }



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


[clang] 8cee150 - [C++, test] Fix typo in NSS* vars

2021-04-20 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-04-20T12:07:41+01:00
New Revision: 8cee150e9ac467dd93199722b8bd8af3024df697

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

LOG: [C++, test] Fix typo in NSS* vars

The NSS FileCheck variables at the end of the
CodeGenCXX/split-stacks.cpp clang testcase are off by 1, resulting in
the use of an undefined variable (NSS3). One of the CHECK-NOT is also
redundant because _Z8tnosplitIiEiv uses the same attribute as _Z3foov
without split stack. This commit fixes that.

Reviewed By: ChuanqiXu

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

Added: 


Modified: 
clang/test/CodeGenCXX/split-stacks.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/split-stacks.cpp 
b/clang/test/CodeGenCXX/split-stacks.cpp
index 2373bcc982f51..5f6a65557f4d7 100644
--- a/clang/test/CodeGenCXX/split-stacks.cpp
+++ b/clang/test/CodeGenCXX/split-stacks.cpp
@@ -27,7 +27,6 @@ int nosplit() {
 
 // CHECK-NOSEGSTK: define dso_local i32 @_Z3foov() [[NSS0:#[0-9]+]] {
 // CHECK-NOSEGSTK: define dso_local i32 @_Z7nosplitv() [[NSS1:#[0-9]+]] {
-// CHECK-NOSEGSTK: define linkonce_odr dso_local i32 @_Z8tnosplitIiEiv() 
[[NSS2:#[0-9]+]] comdat {
+// CHECK-NOSEGSTK: define linkonce_odr dso_local i32 @_Z8tnosplitIiEiv() 
[[NSS0]] comdat {
+// CHECK-NOSEGSTK-NOT: [[NSS0]] = { {{.*}} "split-stack" {{.*}} }
 // CHECK-NOSEGSTK-NOT: [[NSS1]] = { {{.*}} "split-stack" {{.*}} }
-// CHECK-NOSEGSTK-NOT: [[NSS2]] = { {{.*}} "split-stack" {{.*}} }
-// CHECK-NOSEGSTK-NOT: [[NSS3]] = { {{.*}} "split-stack" {{.*}} }



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


[clang] acbb365 - [AST][NFC] Silence GCC warning about multiline comments

2021-01-07 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-01-07T17:11:49Z
New Revision: acbb3652931a735a861b756075b1cc86fd041761

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

LOG: [AST][NFC] Silence GCC warning about multiline comments

Remove continuation line in code snippet to prevent GCC warning about
multiline comments (-Wcomment) when building a project using libclang
with GCC.

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/include/clang/AST/DeclOpenMP.h

Removed: 




diff  --git a/clang/include/clang/AST/DeclOpenMP.h 
b/clang/include/clang/AST/DeclOpenMP.h
index e595ec98d914c..4aa5bde92e123 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -163,7 +163,7 @@ class OMPThreadPrivateDecl final : public 
OMPDeclarativeDirective {
 /// 'float':
 ///
 /// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in)
 /// initializer (omp_priv = 0)
 /// \endcode
 ///



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