[PATCH] D108241: [hwasan] Flag stack safety check as requiring aarch64

2021-08-18 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2afb9394a745: [hwasan] Flag stack safety check as requiring 
aarch64 (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108241/new/

https://reviews.llvm.org/D108241

Files:
  clang/test/CodeGen/hwasan-stack-safety-analysis.c


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=NOSAFETY
 


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=NOSAFETY
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108241: [hwasan] Flag stack safety check as requiring aarch64

2021-08-17 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a subscriber: kristof.beyls.
ctetreau requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108241

Files:
  clang/test/CodeGen/hwasan-stack-safety-analysis.c


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=NOSAFETY
 


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=NOSAFETY
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98856: Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed.

2021-03-30 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau accepted this revision.
ctetreau added inline comments.



Comment at: llvm/lib/CodeGen/ValueTypes.cpp:17
 
+unsigned EVT::getVectorNumElements() const {
+  auto Error = []() {

sdesmalen wrote:
> ctetreau wrote:
> > Out of curiosity, what is the eventual plan for this function? Does it go 
> > away, or will it just assert if this is a scalable vector?
> The eventual plan is for this function to go away, so we just have a single 
> getElementCount interface, although this hasn't really been discussed yet.
> We could also end up renaming it to `getFixedVectorNumElements` for 
> convenience, at which point it always asserts if it is scalable.
ok, thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98856/new/

https://reviews.llvm.org/D98856

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


[PATCH] D98856: Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed.

2021-03-22 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: llvm/include/llvm/Support/TypeSize.h:31-35
+namespace TypeSizeClOpt {
+/// The ScalableErrorAsWarning is a temporary measure to suppress errors from
+/// using the wrong interface.
+extern cl::opt ScalableErrorAsWarning;
+} // namespace TypeSizeClOpt

paulwalker-arm wrote:
> Why is this need here? Can it just be externs where it's accessed?
It could, but that would be annoying. It would be nice if you could just 
include the header and have this symbol in scope.

Whether or not it should be convenient to use this option is a valid question 
though. I'm fine either way.



Comment at: llvm/lib/CodeGen/ValueTypes.cpp:28
+  if (isScalableVector()) {
+if (llvm::TypeSizeClOpt::ScalableErrorAsWarning)
+  WithColor::warning()

paulwalker-arm wrote:
> I guess related to my comment for TypeSize.h but I'm wondering if it's better 
> to move all error reporting into TypeSize.cpp. For example:
> ```
> if (isScalableVector())
>   reportInvalidSizeRequest("EVT::getVectorNumElements()", 
> "EVT::getVectorElementCount()")
> 
> reportInvalidSizeRequest(string bad_func, string good_fun) {
> #ifndef STRICT_FIXED_SIZE_VECTORS
>   if (ScalableErrorAsWarning)
> warning(don't use badfunc, use good_fun instead)
>   else
> #endif
> Error()
> }
> ```
I guess if we did this, then the definitions for EVT::getVectorNumElements and 
the TypeSize cast to unsigned to stay in the header. Then, if 
STRICT_FIXED_SIZE_VECTORS is defined, it would be easy to inline the function 
body as it's all in the header, resulting in a real "pro" to defining 
STRICT_FIXED_SIZE_VECTORS and having your code work with it. I'm fine either 
way.

It's only two functions, and unlikely to increase to more, so you could make 
the case that it's not worth bothering over.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98856/new/

https://reviews.llvm.org/D98856

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


[PATCH] D98856: Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed.

2021-03-19 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau accepted this revision.
ctetreau added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: llvm/lib/CodeGen/ValueTypes.cpp:17
 
+unsigned EVT::getVectorNumElements() const {
+  auto Error = []() {

Out of curiosity, what is the eventual plan for this function? Does it go away, 
or will it just assert if this is a scalable vector?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98856/new/

https://reviews.llvm.org/D98856

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


[PATCH] D95635: [CMake] Require python 3.6 if enabling LLVM test targets

2021-03-15 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG39970764af39: [CMake] Require python 3.6 if enabling LLVM 
test targets (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

Files:
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake
  mlir/CMakeLists.txt


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -106,7 +106,8 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1176,3 +1176,11 @@
   append_if(SUPPORTS_FFILE_PREFIX_MAP 
"-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS 
CMAKE_CXX_FLAGS)
   add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
 endif()
+
+if(LLVM_INCLUDE_TESTS)
+  # Lit test suite requires at least python 3.6
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
+else()
+  # FIXME: it is unknown if this is the actual minimum bound
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
+endif()
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -693,7 +693,8 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,8 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+  COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,8 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+  COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -106,7 +106,8 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: ${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1176,3 +1176,11 @@
   append_if(SUPPORTS_FFILE_PREFIX_MAP "-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
   add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
 endif()
+
+if(LLVM_INCLUDE_TESTS)
+  # Lit test suite requires at least python 3.6
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
+else()
+  # FIXME: it is unknown if this is the actual minimum bound
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
+endif()
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -693,7 +693,8 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt

[PATCH] D95635: [CMake] Require python 3.6 if enabling LLVM test targets

2021-03-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

In D95635#2619804 , @serge-sans-paille 
wrote:

> would it make sense to syndicate the minimal version in a single variable, 
> say `LLVM_MINIMAL_PYTHON_VERSION`, and use it in several place instead of 
> hard-coding the value across multiple files?

Done. That lets us just do the branch in one place as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

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


[PATCH] D95635: [CMake] Require python 3.6 if enabling LLVM test targets

2021-03-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 330078.
ctetreau added a comment.

set a var for the minimum bound


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

Files:
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake
  mlir/CMakeLists.txt


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,8 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1147,3 +1147,11 @@
   append_if(SUPPORTS_FFILE_PREFIX_MAP 
"-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS 
CMAKE_CXX_FLAGS)
   add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
 endif()
+
+if(LLVM_INCLUDE_TESTS)
+  # Lit test suite requires at least python 3.6
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
+else()
+  # FIXME: it is unknown if this is the actual minimum bound
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
+endif()
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,8 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,8 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+  COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,8 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+  COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,8 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: ${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1147,3 +1147,11 @@
   append_if(SUPPORTS_FFILE_PREFIX_MAP "-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
   add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
 endif()
+
+if(LLVM_INCLUDE_TESTS)
+  # Lit test suite requires at least python 3.6
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
+else()
+  # FIXME: it is unknown if this is the actual minimum bound
+  set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
+endif()
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,8 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
+COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,8 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-

[PATCH] D95635: [CMake] Require python 3.6 if enabling LLVM test targets

2021-03-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau requested review of this revision.
ctetreau added a comment.

Ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

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


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-03-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 329965.
ctetreau added a comment.
This revision is now accepted and ready to land.

Only require if adding test suite targets


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

Files:
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,12 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  if (LLVM_INCLUDE_TESTS)
+# Test suite uses features of 3.6
+find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
+  else()
+find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  endif()
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,12 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+if (LLVM_INCLUDE_TESTS)
+  # Test suite uses features of 3.6
+  find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
+else()
+  find_package(Python3 REQUIRED COMPONENTS Interpreter)
+endif()
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,12 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  if (LLVM_INCLUDE_TESTS)
+# Test suite uses features of 3.6
+find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
+  else()
+find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  endif()
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: ${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,12 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+if (LLVM_INCLUDE_TESTS)
+  # Test suite uses features of 3.6
+  find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
+else()
+  find_package(Python3 REQUIRED COMPONENTS Interpreter)
+endif()
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-03-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau planned changes to this revision.
ctetreau added a comment.
Herald added subscribers: dcaballe, cota.

I plan to revive this patch. I will try to rig it to only require 3.6 or above 
is testing is enabled using LLVM_INCLUDE_TESTS. Hopefully if any build bots 
haven't been fixed by now, they will not be setting this variable to ON (since 
they clearly aren't running tests)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

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


[PATCH] D96825: [AArch64] Adding Neon Polynomial vadd Intrinsics

2021-02-19 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG55448ab540de: [AArch64] Adding Neon Polynomial vadd 
Intrinsics (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96825/new/

https://reviews.llvm.org/D96825

Files:
  clang/include/clang/Basic/arm_neon.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-poly-add.c

Index: clang/test/CodeGen/aarch64-poly-add.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-poly-add.c
@@ -0,0 +1,85 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon \
+// RUN: -disable-O0-optnone -emit-llvm -o - %s | opt -S -mem2reg \
+// RUN:  | FileCheck %s
+
+#include 
+
+// CHECK-LABEL: @test_vadd_p8(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = xor <8 x i8> [[A:%.*]], [[B:%.*]]
+// CHECK-NEXT:ret <8 x i8> [[TMP0]]
+//
+poly8x8_t test_vadd_p8(poly8x8_t a, poly8x8_t b) {
+  return vadd_p8 (a, b);
+}
+
+// CHECK-LABEL: @test_vadd_p16(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x i16> [[A:%.*]] to <8 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
+// CHECK-NEXT:[[TMP2:%.*]] = xor <8 x i8> [[TMP0]], [[TMP1]]
+// CHECK-NEXT:[[TMP3:%.*]] = bitcast <8 x i8> [[TMP2]] to <4 x i16>
+// CHECK-NEXT:ret <4 x i16> [[TMP3]]
+//
+poly16x4_t test_vadd_p16(poly16x4_t a, poly16x4_t b) {
+  return vadd_p16 (a, b);
+}
+
+// CHECK-LABEL: @test_vadd_p64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <1 x i64> [[A:%.*]] to <8 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <1 x i64> [[B:%.*]] to <8 x i8>
+// CHECK-NEXT:[[TMP2:%.*]] = xor <8 x i8> [[TMP0]], [[TMP1]]
+// CHECK-NEXT:[[TMP3:%.*]] = bitcast <8 x i8> [[TMP2]] to <1 x i64>
+// CHECK-NEXT:ret <1 x i64> [[TMP3]]
+//
+poly64x1_t test_vadd_p64(poly64x1_t a, poly64x1_t b) {
+  return vadd_p64(a, b);
+}
+
+// CHECK-LABEL: @test_vaddq_p8(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = xor <16 x i8> [[A:%.*]], [[B:%.*]]
+// CHECK-NEXT:ret <16 x i8> [[TMP0]]
+//
+poly8x16_t test_vaddq_p8(poly8x16_t a, poly8x16_t b){
+  return vaddq_p8(a, b);
+}
+
+// CHECK-LABEL: @test_vaddq_p16(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <8 x i16> [[A:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <8 x i16> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
+// CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <8 x i16>
+// CHECK-NEXT:ret <8 x i16> [[TMP3]]
+//
+poly16x8_t test_vaddq_p16(poly16x8_t a, poly16x8_t b){
+  return vaddq_p16(a, b);
+}
+
+// CHECK-LABEL: @test_vaddq_p64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <2 x i64> [[A:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <2 x i64> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
+// CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <2 x i64>
+// CHECK-NEXT:ret <2 x i64> [[TMP3]]
+//
+poly64x2_t test_vaddq_p64(poly64x2_t a, poly64x2_t b){
+  return vaddq_p64(a, b);
+}
+
+// CHECK-LABEL: @test_vaddq_p128(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast i128 [[A:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast i128 [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
+// CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to i128
+// CHECK-NEXT:ret i128 [[TMP3]]
+//
+poly128_t test_vaddq_p128 (poly128_t a, poly128_t b){
+  return vaddq_p128(a, b);
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -5371,7 +5371,10 @@
   NEONMAP2(vabdq_v, arm_neon_vabdu, arm_neon_vabds, Add1ArgType | UnsignedAlts),
   NEONMAP1(vabs_v, arm_neon_vabs, 0),
   NEONMAP1(vabsq_v, arm_neon_vabs, 0),
+  NEONMAP0(vadd_v),
   NEONMAP0(vaddhn_v),
+  NEONMAP0(vaddq_p128),
+  NEONMAP0(vaddq_v),
   NEONMAP1(vaesdq_v, arm_neon_aesd, 0),
   NEONMAP1(vaeseq_v, arm_neon_aese, 0),
   NEONMAP1(vaesimcq_v, arm_neon_aesimc, 0),
@@ -5665,7 +5668,10 @@
   NEONMAP0(splatq_laneq_v),
   NEONMAP1(vabs_v, aarch64_neon_abs, 0),
   NEONMAP1(vabsq_v, aarch64_neon_abs, 0),
+  NEONMAP0(vadd_v),
   NEONMAP0(vaddhn_v),
+  NEONMAP0(vaddq_p128),
+  NEONMAP0(vaddq_v),
   NEONMAP1(vaesdq_v, aarch64_crypto_aesd, 0),
   NEONMAP1(vaeseq_v, aarch64_crypto_aese, 0),
   NEONMAP1(vaesimcq_v, aarch64_crypto_aesimc, 0),
@@ -6302,6 +6308,14 @@
 if (VTy->getElementType()->isFloatingPointTy())
   return EmitNeonCall(CGM.getIntrinsic(Intrinsic::fabs, Ty), Ops, "vabs");
 return EmitNeonCall(CGM.getIntrinsic(LLVMIntrinsic, Ty), Ops, 

[PATCH] D96825: [AArch64] Adding Neon Polynomial vadd Intrinsics

2021-02-19 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau accepted this revision.
ctetreau added a comment.

LGTM. I'll land it for you.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96825/new/

https://reviews.llvm.org/D96825

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


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-01-29 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

@JDevlieghere I personally have no skin in this game. This is actually quite an 
obnoxious development for me since my linux machine is stuck on an old version 
and Python 3.5 is the newest version in the repos. I sent a message to llvm-dev 
so hopefully this will get hashed out there. You are right though, that the 
linked page does not actually say "minimum requirement". I just assumed that 
since code was going in unchallenged that requires it, that it must be true.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

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


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-01-29 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0703b0753c40: [CMake] Actually require python 3.6 or greater 
(authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

Files:
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,7 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,7 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,7 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: ${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,7 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-01-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

In D95635#2528851 , @JDevlieghere 
wrote:

>> However, the project claims to require 3.6 or greater, and 3.6 features are 
>> being used.
>
> Can you link to where it says that? I'm not opposed to making 3.6 the 
> minimally required version, but at least for LLDB we don't have that 
> requirement and we have documentation mentioning Python 3.5.



In D95635#2528883 , @yln wrote:

> In D95635#2528851 , @JDevlieghere 
> wrote:
>
>>> However, the project claims to require 3.6 or greater, and 3.6 features are 
>>> being used.
>>
>> Can you link to where it says that? I'm not opposed to making 3.6 the 
>> minimally required version, but at least for LLDB we don't have that 
>> requirement and we have documentation mentioning Python 3.5.
>
> For LLVM: https://llvm.org/docs/GettingStarted.html#software

This is where I saw it. I got bit by @yln's cleanup patch. I can reduce the 
minimum version for LLDB if that's the officially required version, but llvm at 
the very least advertises 3.6


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95635/new/

https://reviews.llvm.org/D95635

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


[PATCH] D95635: [CMake] Actually require python 3.6 or greater

2021-01-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: teijeong, rdzhabarov, tatianashp, msifontes, jurahul, 
Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, 
antiagainst, shauheen, rriddle, mehdi_amini, mgorny.
ctetreau requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, stephenneuendorffer, 
nicolasvasilache.
Herald added projects: clang, MLIR, LLVM.

Previously, CMake would find any version of Python3. However, the project
claims to require 3.6 or greater, and 3.6 features are being used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95635

Files:
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,7 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,7 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}


Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -79,7 +79,7 @@
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
+  find_package(Python3 3.6 COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
   message(STATUS "Found numpy v${Python3_NumPy_VERSION}: ${Python3_NumPy_INCLUDE_DIRS}")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -697,7 +697,7 @@
 
 include(HandleLLVMOptions)
 
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 ##
 
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -57,7 +57,7 @@
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -131,7 +131,7 @@
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
+find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86065: [SVE] Make ElementCount members private

2020-08-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau accepted this revision.
ctetreau added a comment.

I think this is good to go as is. Assuming @paulwalker-arm is satisfied with 
leaving operator/ as is, then LGTM.




Comment at: llvm/include/llvm/Support/TypeSize.h:66
+
+  ElementCount /=(unsigned RHS) {
+Min /= RHS;

paulwalker-arm wrote:
> If you add an assert that the divide is lossless (i.e. MIN % RHS == 0) then 
> asserts like:
> ```
> assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
> ```
> are no longer required.  Plus those places which are not checking for 
> lossless division will be automatically protected.  This feels like a 
> sensible default to me.  If somebody wants a truncated result, they can do 
> the maths using getKnownMinValue().
I would prefer that this not be done. This would make this function non-total 
in an unrecoverable way, and would force everybody to write a bunch of tedious 
error handling code, even if the normal integer division behavior would have 
been fine:

```
ElementCount res = LHS.getKnownMinValue() % RHS.getKnownMinValue() == 0 ? LHS / 
RHS : SomeOtherThing;
```

Everybody knows how integer division works, so I think the lossy behavior will 
not surprise anybody. An assert might.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86065/new/

https://reviews.llvm.org/D86065

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


[PATCH] D86065: [SVE] Make ElementCount members private

2020-08-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

In D86065#2241146 , @david-arm wrote:

> Hi @ctetreau, ok for now I'm going to completely remove the operators and 
> revert the code using those operators to how it was before. ...

This is probably for the best.

In D86065#2241146 , @david-arm wrote:

> ... I'm not sure what you mean about the predicate functions ...

I'm referring to providing some built in way to std::sort a collection of 
ElementCount or have a std::set. By default, C++ wants to use 
operator< for this, which I believe was the original motivation for the 
operator being here in the first place. I think it's reasonable for 
ElementCount to provide a built-in function to establish an ordering for these 
purposes, but the function should be named such that nobody thinks the function 
is intended to be the mathematical relation.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86065/new/

https://reviews.llvm.org/D86065

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


[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-08-26 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG19e883fc5988: [SVE] Remove calls to 
VectorType::getNumElements from clang (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1320,7 +1320,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1553,12 +1553,12 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
 
-llvm::VectorType *MTy = cast(Mask->getType());
+auto *MTy = cast(Mask->getType());
 
 // Mask off the high bits of each shuffle index.
 Value *MaskBits =
@@ -1763,7 +1763,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1787,7 +1787,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1825,7 +1826,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1834,7 +1835,7 @@
 if (isa(IE)) {
   llvm::ShuffleVectorInst *SVI = cast(Init);
   Value *SVOp = SVI->getOperand(0);
-  llvm::VectorType *OpTy = cast(SVOp->getType());
+  auto *OpTy = cast(SVOp->getType());
 
   if (OpTy->getNumElements() == ResElts) {
 for (unsigned j = 0; j != CurIdx; ++j) {
@@ -2170,7 +2171,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = 

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-08-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 287755.
ctetreau marked 4 inline comments as done.
ctetreau added a comment.

address code review issues, rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1320,7 +1320,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1553,12 +1553,12 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
 
-llvm::VectorType *MTy = cast(Mask->getType());
+auto *MTy = cast(Mask->getType());
 
 // Mask off the high bits of each shuffle index.
 Value *MaskBits =
@@ -1763,7 +1763,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1787,7 +1787,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1825,7 +1826,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1834,7 +1835,7 @@
 if (isa(IE)) {
   llvm::ShuffleVectorInst *SVI = cast(Init);
   Value *SVOp = SVI->getOperand(0);
-  llvm::VectorType *OpTy = cast(SVOp->getType());
+  auto *OpTy = cast(SVOp->getType());
 
   if (OpTy->getNumElements() == ResElts) {
 for (unsigned j = 0; j != CurIdx; ++j) {
@@ -2170,7 +2171,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return 

[PATCH] D86065: [SVE] Make ElementCount members private

2020-08-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: llvm/include/llvm/Support/TypeSize.h:56
 
+  friend bool operator>(const ElementCount , const ElementCount ) {
+assert(LHS.Scalable == RHS.Scalable &&

fpetrogalli wrote:
> paulwalker-arm wrote:
> > david-arm wrote:
> > > ctetreau wrote:
> > > > fpetrogalli wrote:
> > > > > I think that @ctetreau is right on 
> > > > > https://reviews.llvm.org/D85794#inline-793909. We should not overload 
> > > > > a comparison operator on this class because the set it represent it 
> > > > > cannot be ordered.
> > > > > 
> > > > > Chris suggests an approach of writing a static function that can be 
> > > > > used as a comparison operator,  so that we can make it explicit of 
> > > > > what kind of comparison we  are doing. 
> > > > In C++, it's common to overload the comparison operators for the 
> > > > purposes of being able to std::sort and use ordered sets. Normally, I 
> > > > would be OK with such usages. However, since `ElementCount` is 
> > > > basically a numeric type, and they only have a partial ordering, I 
> > > > think this is dangerous. I'm concerned that this will result in more 
> > > > bugs whereby somebody didn't remember that vectors can be scalable.
> > > > 
> > > > I don't have a strong opinion what the comparator function should be 
> > > > called, but I strongly prefer that it not be a comparison operator.
> > > Hi @ctetreau, yeah I understand. The reason I chose to use operators was 
> > > simply to be consistent with what we have already in TypeSize. Also, we 
> > > have existing "==" and "!=" operators in ElementCount too, although these 
> > > are essentially testing that two ElementCounts are identically the same 
> > > or not, i.e. for 2 given polynomials (a + bx) and (c + dx) we're 
> > > essentially asking if both a==c and b==d.
> > > 
> > > If I introduce a new comparison function, I'll probably keep the asserts 
> > > in for now, but in general we can do better than simply asserting if 
> > > something is scalable or not. For example, we know that (vscale * 4) is 
> > > definitely >= 4 because vscale is at least 1. I'm just not sure if we 
> > > have that need yet.
> > I think we should treat the non-equality comparison functions more like 
> > floating point.  What we don't want is somebody writing !GreaterThan when 
> > they actually mean LessThan.
> > 
> > Perhaps we should name the functions accordingly (i.e. ogt for 
> > OrderedAndGreaterThan).  We will also need matching less than functions 
> > since I can see those being useful when analysing constant insert/extract 
> > element indices which stand a good chance to be a known comparison (with 0 
> > being the most common index).
> > 
> May I suggest the following name scheme? (my 2 c, will not hold the patch for 
> not addressing this comment)
> 
> ```
> static bool [Non]Total(...)
> ```
> 
> with `` being 
> 
> * `LT` -> less than, aka `<`
> * `LToE` -> less than or equal, aka "<="
> * `GT` -> greater than, aka ">"
> * `GToE` -> greater than or equal, aka ">="
> 
> and `Total` , `NonTotal` being the prefix that gives information about the 
> behavior on the value of scalable:
> 
> `Total` -> for example, all scalable ECs are bigger than fixed ECs.
> `NonTotal` -> asserting on `(LHS.Scalable == RHS.Scalable)` before returning 
> `LHS.Min  RHS.Min`.
> 
> Taking it further: it could also be a template on an enumeration that list 
> the type of comparisons?
> 
> ```
> enum CMPType {
>   TotalGT,
>   NonTotalLT,
>   fancy_one
> };
> 
> ...
> 
> template 
> static bool cmp(ElementCount , ElementCount  );
> 
> ...
> 
> static bool ElementCount::cmp(ElementCount 
> , ElementCount  ) {
>  /// implementation
> }
> static bool ElementCount::cmp(ElementCount 
> , ElementCount  ) {
>  /// implementation
> }
> ```
> 
> 
Honestly, I think this is actually worse. My issue is the fact that, from a 
mathematical perspective, `vscale_1 * min_1 < vscale_2 * min_2` is a function 
of `vscale_1` and `vscale_2`. In principle, we can know some ordering 
relationships between certain element counts (such as `vscale * min_1 >= min_2 
= true`), but in general, this function does not make sense. However, an 
`operator<` is useful because it allows you to put an `ElementCount` into an 
ordered set, and it will just work. Renaming the function to `olt` just makes 
it so that you can't put `ElementCount`s into an ordered set, but still implies 
that `ElementCount`s are comparable in general. This will also blow up if you 
actually try to mix fixed width and scalable `ElementCount`s in an ordered set, 
which should work IMO.

Here is what I propose:

1) Add a predicate for establishing an arbitrary ordering. The predicate would 
be completely arbitrary, because it's only useful for establishing an ordering 
for an ordered set or in a sorting algorithm. It could look something like this:

```
static bool orderedBefore(const ElementCount , const ElementCount ) {
  auto l = 

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-08-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau marked 8 inline comments as done.
ctetreau added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:1765
   }
   auto *VectorTy = dyn_cast(
   cast(Addr.getPointer()->getType())->getElementType());

c-rhodes wrote:
> cast here
that would be a behavior change because of the dyn_cast.



Comment at: clang/lib/CodeGen/CGExpr.cpp:1799
   llvm::Type *SrcTy = Value->getType();
   auto *VecTy = dyn_cast(SrcTy);
   // Handle vec3 special.

c-rhodes wrote:
> cast here
that would be a behavior change because of the dyn_cast



Comment at: clang/lib/CodeGen/CGExpr.cpp:2214
   if (const VectorType *VTy = Dst.getType()->getAs()) {
 unsigned NumSrcElts = VTy->getNumElements();
 unsigned NumDstElts =

c-rhodes wrote:
> missed one here
this VTy is a clang::VectorType



Comment at: clang/lib/CodeGen/SwiftCallingConv.cpp:321
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();

c-rhodes wrote:
> cast here
this would be a behavior change due to dyn_cast


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

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


[PATCH] D86065: [SVE] Make ElementCount members private

2020-08-17 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

Perhaps now would be a good time to combine TypeSize and ElementCount into a 
single Polynomial type? We don't have to implement the whole abstraction of 
`c*x^n` (since we currently don't use the exponent, and don't distinguish 
between X's) but if it's ever needed in the future it will be obvious where to 
add it, and it will Just Work.




Comment at: llvm/include/llvm/Support/TypeSize.h:56
 
+  friend bool operator>(const ElementCount , const ElementCount ) {
+assert(LHS.Scalable == RHS.Scalable &&

fpetrogalli wrote:
> I think that @ctetreau is right on 
> https://reviews.llvm.org/D85794#inline-793909. We should not overload a 
> comparison operator on this class because the set it represent it cannot be 
> ordered.
> 
> Chris suggests an approach of writing a static function that can be used as a 
> comparison operator,  so that we can make it explicit of what kind of 
> comparison we  are doing. 
In C++, it's common to overload the comparison operators for the purposes of 
being able to std::sort and use ordered sets. Normally, I would be OK with such 
usages. However, since `ElementCount` is basically a numeric type, and they 
only have a partial ordering, I think this is dangerous. I'm concerned that 
this will result in more bugs whereby somebody didn't remember that vectors can 
be scalable.

I don't have a strong opinion what the comparator function should be called, 
but I strongly prefer that it not be a comparison operator.



Comment at: llvm/include/llvm/Support/TypeSize.h:290
   static unsigned getHashValue(const ElementCount& EltCnt) {
-if (EltCnt.Scalable)
-  return (EltCnt.Min * 37U) - 1U;
+if (EltCnt.isScalable())
+  return (EltCnt.getKnownMinValue() * 37U) - 1U;

NIT: this can be rewritten without duplicating `EltCnt.getKnownMinValue() * 37U`



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:3522
+  DAG.getNode(ISD::EXTRACT_SUBVECTOR, Dl,
+  MemVT.getHalfNumVectorElementsVT(*DAG.getContext()),
+  StoreNode->getValue(),

What is this `>>` thing? Some indicator of whitespace change, or is this a hard 
tab?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86065/new/

https://reviews.llvm.org/D86065

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


[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-08-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 284926.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1323,7 +1323,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1630,7 +1630,7 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
@@ -1648,10 +1648,12 @@
 //   n = extract mask i
 //   x = extract val n
 //   newv = insert newv, x, i
-auto *RTy = llvm::FixedVectorType::get(LTy->getElementType(),
-   MTy->getNumElements());
+auto *RTy = llvm::FixedVectorType::get(
+LTy->getElementType(),
+cast(MTy)->getNumElements());
 Value* NewV = llvm::UndefValue::get(RTy);
-for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0, e = cast(MTy)->getNumElements();
+ i != e; ++i) {
   Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
   Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
 
@@ -1840,7 +1842,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1864,7 +1866,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1902,7 +1905,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1911,7 +1914,7 @@
 if (isa(IE)) {
   llvm::ShuffleVectorInst *SVI = cast(Init);
   Value *SVOp = SVI->getOperand(0);
-  llvm::VectorType *OpTy = 

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-08-05 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau planned changes to this revision.
ctetreau added a comment.

I plan to investigate the changes proposed by @c-rhodes. I'm a bit swamped 
right now so it may take a bit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

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


[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-07-23 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 280254.
ctetreau added a comment.

address code review issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1323,7 +1323,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1630,7 +1630,7 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
@@ -1648,10 +1648,12 @@
 //   n = extract mask i
 //   x = extract val n
 //   newv = insert newv, x, i
-auto *RTy = llvm::FixedVectorType::get(LTy->getElementType(),
-   MTy->getNumElements());
+auto *RTy = llvm::FixedVectorType::get(
+LTy->getElementType(),
+cast(MTy)->getNumElements());
 Value* NewV = llvm::UndefValue::get(RTy);
-for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0, e = cast(MTy)->getNumElements();
+ i != e; ++i) {
   Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
   Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
 
@@ -1840,7 +1842,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1864,7 +1866,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1902,7 +1905,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1911,7 +1914,7 @@
 if (isa(IE)) {
   llvm::ShuffleVectorInst *SVI = cast(Init);
   Value *SVOp = SVI->getOperand(0);
-  

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-07-23 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau marked an inline comment as done.
ctetreau added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:5612-5613
 
   llvm::VectorType *VTy = GetNeonType(this, Type, HasLegalHalfType, false,
   AllowBFloatArgsAndRet);
   llvm::Type *Ty = VTy;

c-rhodes wrote:
> Is there a reason you can't do a single cast here?
GetNeonType should probably just return a FixedVectorType.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582



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


[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-07-20 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 279370.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82582/new/

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1323,7 +1323,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1630,7 +1630,7 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
@@ -1648,10 +1648,12 @@
 //   n = extract mask i
 //   x = extract val n
 //   newv = insert newv, x, i
-auto *RTy = llvm::FixedVectorType::get(LTy->getElementType(),
-   MTy->getNumElements());
+auto *RTy = llvm::FixedVectorType::get(
+LTy->getElementType(),
+cast(MTy)->getNumElements());
 Value* NewV = llvm::UndefValue::get(RTy);
-for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0, e = cast(MTy)->getNumElements();
+ i != e; ++i) {
   Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
   Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
 
@@ -1840,7 +1842,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1864,7 +1866,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1902,7 +1905,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1911,7 +1914,7 @@
 if (isa(IE)) {
   llvm::ShuffleVectorInst *SVI = cast(Init);
   Value *SVOp = SVI->getOperand(0);
-  llvm::VectorType *OpTy = 

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-06-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
ctetreau added a child revision: D78127: [SVE] Mark 
VectorType::getNumElements() deprecated.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1323,7 +1323,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1630,7 +1630,7 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
@@ -1648,10 +1648,12 @@
 //   n = extract mask i
 //   x = extract val n
 //   newv = insert newv, x, i
-auto *RTy = llvm::FixedVectorType::get(LTy->getElementType(),
-   MTy->getNumElements());
+auto *RTy = llvm::FixedVectorType::get(
+LTy->getElementType(),
+cast(MTy)->getNumElements());
 Value* NewV = llvm::UndefValue::get(RTy);
-for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0, e = cast(MTy)->getNumElements();
+ i != e; ++i) {
   Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
   Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
 
@@ -1840,7 +1842,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1864,7 +1866,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1902,7 +1905,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1911,7 +1914,7 @@
 if (isa(IE)) {
   

[PATCH] D80342: [SVE] Deprecate default false variant of VectorType::get

2020-06-16 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb81c85afdcd: [SVE] Deprecate default false variant of 
VectorType::get (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80342/new/

https://reviews.llvm.org/D80342

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/unittests/Analysis/VectorUtilsTest.cpp
  llvm/unittests/CodeGen/LowLevelTypeTest.cpp
  llvm/unittests/FuzzMutate/OperationsTest.cpp
  llvm/unittests/IR/ConstantsTest.cpp
  llvm/unittests/IR/IRBuilderTest.cpp
  llvm/unittests/IR/InstructionsTest.cpp
  llvm/unittests/IR/PatternMatch.cpp
  llvm/unittests/IR/VectorTypesTest.cpp

Index: llvm/unittests/IR/VectorTypesTest.cpp
===
--- llvm/unittests/IR/VectorTypesTest.cpp
+++ llvm/unittests/IR/VectorTypesTest.cpp
@@ -43,15 +43,12 @@
   EXPECT_EQ(V16Int8Ty->getNumElements(), 16U);
   EXPECT_EQ(V16Int8Ty->getElementType()->getScalarSizeInBits(), 8U);
 
-  auto *V8Int32Ty = dyn_cast(VectorType::get(Int32Ty, 8));
+  auto *V8Int32Ty =
+  dyn_cast(VectorType::get(Int32Ty, 8, false));
   ASSERT_NE(nullptr, V8Int32Ty);
   EXPECT_EQ(V8Int32Ty->getNumElements(), 8U);
   EXPECT_EQ(V8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
 
-  auto *V8Int32TyExplicitFalse =
-  dyn_cast(VectorType::get(Int32Ty, 8, false));
-  EXPECT_VTY_EQ(V8Int32Ty, V8Int32TyExplicitFalse);
-
   auto *V8Int8Ty =
   dyn_cast(VectorType::get(Int8Ty, V8Int32Ty));
   EXPECT_VTY_NE(V8Int32Ty, V8Int8Ty);
Index: llvm/unittests/IR/PatternMatch.cpp
===
--- llvm/unittests/IR/PatternMatch.cpp
+++ llvm/unittests/IR/PatternMatch.cpp
@@ -928,9 +928,9 @@
   //
   //   SP1 = VectorSplat(2, i8 2)
   //   SP2 = VectorSplat(2, i8 %Val)
-  Type *VecTy = VectorType::get(IRB.getInt8Ty(), 2);
+  Type *VecTy = FixedVectorType::get(IRB.getInt8Ty(), 2);
   Type *i32 = IRB.getInt32Ty();
-  Type *i32VecTy = VectorType::get(i32, 2);
+  Type *i32VecTy = FixedVectorType::get(i32, 2);
 
   Value *Val = IRB.CreateAdd(IRB.getInt8(0), IRB.getInt8(1));
   Value *Val2 = IRB.CreateAdd(Val, IRB.getInt8(3));
@@ -1021,7 +1021,7 @@
 
 TEST_F(PatternMatchTest, VectorUndefInt) {
   Type *ScalarTy = IRB.getInt8Ty();
-  Type *VectorTy = VectorType::get(ScalarTy, 4);
+  Type *VectorTy = FixedVectorType::get(ScalarTy, 4);
   Constant *ScalarUndef = UndefValue::get(ScalarTy);
   Constant *VectorUndef = UndefValue::get(VectorTy);
   Constant *ScalarZero = Constant::getNullValue(ScalarTy);
@@ -1086,7 +1086,7 @@
 
 TEST_F(PatternMatchTest, VectorUndefFloat) {
   Type *ScalarTy = IRB.getFloatTy();
-  Type *VectorTy = VectorType::get(ScalarTy, 4);
+  Type *VectorTy = FixedVectorType::get(ScalarTy, 4);
   Constant *ScalarUndef = UndefValue::get(ScalarTy);
   Constant *VectorUndef = UndefValue::get(VectorTy);
   Constant *ScalarZero = Constant::getNullValue(ScalarTy);
Index: llvm/unittests/IR/InstructionsTest.cpp
===
--- llvm/unittests/IR/InstructionsTest.cpp
+++ llvm/unittests/IR/InstructionsTest.cpp
@@ -186,18 +186,18 @@
   Type *Int16Ty = Type::getInt16Ty(C);
   Type *Int32Ty = Type::getInt32Ty(C);
   Type *Int64Ty = Type::getInt64Ty(C);
-  Type *V8x8Ty = VectorType::get(Int8Ty, 8);
-  Type *V8x64Ty = VectorType::get(Int64Ty, 8);
+  Type *V8x8Ty = FixedVectorType::get(Int8Ty, 8);
+  Type *V8x64Ty = FixedVectorType::get(Int64Ty, 8);
   Type *X86MMXTy = Type::getX86_MMXTy(C);
 
   Type *HalfTy = Type::getHalfTy(C);
   Type *FloatTy = Type::getFloatTy(C);
   Type *DoubleTy = Type::getDoubleTy(C);
 
-  Type *V2Int32Ty = VectorType::get(Int32Ty, 2);
-  Type *V2Int64Ty = VectorType::get(Int64Ty, 2);
-  Type *V4Int16Ty = VectorType::get(Int16Ty, 4);
-  Type *V1Int16Ty = VectorType::get(Int16Ty, 1);
+  Type *V2Int32Ty = FixedVectorType::get(Int32Ty, 2);
+  Type *V2Int64Ty = FixedVectorType::get(Int64Ty, 2);
+  Type *V4Int16Ty = FixedVectorType::get(Int16Ty, 4);
+  Type *V1Int16Ty = FixedVectorType::get(Int16Ty, 1);
 
   Type *VScaleV2Int32Ty = VectorType::get(Int32Ty, 2, true);
   Type *VScaleV2Int64Ty = VectorType::get(Int64Ty, 2, true);
@@ -210,16 +210,16 @@
   Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
   Type *Int64PtrAS1Ty = PointerType::get(Int64Ty, 1);
 
-  Type *V2Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 2);
-  Type *V2Int64PtrAS1Ty = VectorType::get(Int64PtrAS1Ty, 2);
-  Type *V4Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 4);
+  Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
+  Type *V2Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 2);
+  Type *V4Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 4);
   Type *VScaleV4Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 4, true);
-  Type *V4Int64PtrAS1Ty = VectorType::get(Int64PtrAS1Ty, 4);
+  Type *V4Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 

[PATCH] D80342: [SVE] Deprecate default false variant of VectorType::get

2020-06-16 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 271217.
ctetreau added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

catch stragglers


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80342/new/

https://reviews.llvm.org/D80342

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/unittests/Analysis/VectorUtilsTest.cpp
  llvm/unittests/CodeGen/LowLevelTypeTest.cpp
  llvm/unittests/FuzzMutate/OperationsTest.cpp
  llvm/unittests/IR/ConstantsTest.cpp
  llvm/unittests/IR/IRBuilderTest.cpp
  llvm/unittests/IR/InstructionsTest.cpp
  llvm/unittests/IR/PatternMatch.cpp
  llvm/unittests/IR/VectorTypesTest.cpp

Index: llvm/unittests/IR/VectorTypesTest.cpp
===
--- llvm/unittests/IR/VectorTypesTest.cpp
+++ llvm/unittests/IR/VectorTypesTest.cpp
@@ -43,15 +43,12 @@
   EXPECT_EQ(V16Int8Ty->getNumElements(), 16U);
   EXPECT_EQ(V16Int8Ty->getElementType()->getScalarSizeInBits(), 8U);
 
-  auto *V8Int32Ty = dyn_cast(VectorType::get(Int32Ty, 8));
+  auto *V8Int32Ty =
+  dyn_cast(VectorType::get(Int32Ty, 8, false));
   ASSERT_NE(nullptr, V8Int32Ty);
   EXPECT_EQ(V8Int32Ty->getNumElements(), 8U);
   EXPECT_EQ(V8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
 
-  auto *V8Int32TyExplicitFalse =
-  dyn_cast(VectorType::get(Int32Ty, 8, false));
-  EXPECT_VTY_EQ(V8Int32Ty, V8Int32TyExplicitFalse);
-
   auto *V8Int8Ty =
   dyn_cast(VectorType::get(Int8Ty, V8Int32Ty));
   EXPECT_VTY_NE(V8Int32Ty, V8Int8Ty);
Index: llvm/unittests/IR/PatternMatch.cpp
===
--- llvm/unittests/IR/PatternMatch.cpp
+++ llvm/unittests/IR/PatternMatch.cpp
@@ -928,9 +928,9 @@
   //
   //   SP1 = VectorSplat(2, i8 2)
   //   SP2 = VectorSplat(2, i8 %Val)
-  Type *VecTy = VectorType::get(IRB.getInt8Ty(), 2);
+  Type *VecTy = FixedVectorType::get(IRB.getInt8Ty(), 2);
   Type *i32 = IRB.getInt32Ty();
-  Type *i32VecTy = VectorType::get(i32, 2);
+  Type *i32VecTy = FixedVectorType::get(i32, 2);
 
   Value *Val = IRB.CreateAdd(IRB.getInt8(0), IRB.getInt8(1));
   Value *Val2 = IRB.CreateAdd(Val, IRB.getInt8(3));
@@ -1021,7 +1021,7 @@
 
 TEST_F(PatternMatchTest, VectorUndefInt) {
   Type *ScalarTy = IRB.getInt8Ty();
-  Type *VectorTy = VectorType::get(ScalarTy, 4);
+  Type *VectorTy = FixedVectorType::get(ScalarTy, 4);
   Constant *ScalarUndef = UndefValue::get(ScalarTy);
   Constant *VectorUndef = UndefValue::get(VectorTy);
   Constant *ScalarZero = Constant::getNullValue(ScalarTy);
@@ -1086,7 +1086,7 @@
 
 TEST_F(PatternMatchTest, VectorUndefFloat) {
   Type *ScalarTy = IRB.getFloatTy();
-  Type *VectorTy = VectorType::get(ScalarTy, 4);
+  Type *VectorTy = FixedVectorType::get(ScalarTy, 4);
   Constant *ScalarUndef = UndefValue::get(ScalarTy);
   Constant *VectorUndef = UndefValue::get(VectorTy);
   Constant *ScalarZero = Constant::getNullValue(ScalarTy);
Index: llvm/unittests/IR/InstructionsTest.cpp
===
--- llvm/unittests/IR/InstructionsTest.cpp
+++ llvm/unittests/IR/InstructionsTest.cpp
@@ -186,18 +186,18 @@
   Type *Int16Ty = Type::getInt16Ty(C);
   Type *Int32Ty = Type::getInt32Ty(C);
   Type *Int64Ty = Type::getInt64Ty(C);
-  Type *V8x8Ty = VectorType::get(Int8Ty, 8);
-  Type *V8x64Ty = VectorType::get(Int64Ty, 8);
+  Type *V8x8Ty = FixedVectorType::get(Int8Ty, 8);
+  Type *V8x64Ty = FixedVectorType::get(Int64Ty, 8);
   Type *X86MMXTy = Type::getX86_MMXTy(C);
 
   Type *HalfTy = Type::getHalfTy(C);
   Type *FloatTy = Type::getFloatTy(C);
   Type *DoubleTy = Type::getDoubleTy(C);
 
-  Type *V2Int32Ty = VectorType::get(Int32Ty, 2);
-  Type *V2Int64Ty = VectorType::get(Int64Ty, 2);
-  Type *V4Int16Ty = VectorType::get(Int16Ty, 4);
-  Type *V1Int16Ty = VectorType::get(Int16Ty, 1);
+  Type *V2Int32Ty = FixedVectorType::get(Int32Ty, 2);
+  Type *V2Int64Ty = FixedVectorType::get(Int64Ty, 2);
+  Type *V4Int16Ty = FixedVectorType::get(Int16Ty, 4);
+  Type *V1Int16Ty = FixedVectorType::get(Int16Ty, 1);
 
   Type *VScaleV2Int32Ty = VectorType::get(Int32Ty, 2, true);
   Type *VScaleV2Int64Ty = VectorType::get(Int64Ty, 2, true);
@@ -210,16 +210,16 @@
   Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
   Type *Int64PtrAS1Ty = PointerType::get(Int64Ty, 1);
 
-  Type *V2Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 2);
-  Type *V2Int64PtrAS1Ty = VectorType::get(Int64PtrAS1Ty, 2);
-  Type *V4Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 4);
+  Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
+  Type *V2Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 2);
+  Type *V4Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 4);
   Type *VScaleV4Int32PtrAS1Ty = VectorType::get(Int32PtrAS1Ty, 4, true);
-  Type *V4Int64PtrAS1Ty = VectorType::get(Int64PtrAS1Ty, 4);
+  Type *V4Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 4);
 
-  Type 

[PATCH] D81041: Use existing path sep style in clang::FileManager::FixupRelativePath

2020-06-03 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau abandoned this revision.
ctetreau added a comment.

After some further investigation, I have come to believe that the root cause of 
the issue I am seeing is on line 783 of clang/lib/Lex/HeaderSearch.cpp. A path 
is constructed using string concatenation (dir + '/' + file), which is 
obviously not robust to the various issues in path construction. A fix had been 
committed and reverted back in 2015. Upon restoring the fix, I see that it 
causes several other test failures. Unfortunately, I do not have the bandwidth 
to fully resolve this issue myself, so I have opened a bug for it: 
https://bugs.llvm.org/show_bug.cgi?id=46187

While I still believe the issues I mentioned upthread should probably be 
addressed, they are much less pressing having discovered the root cause of my 
particular issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81041/new/

https://reviews.llvm.org/D81041



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


[PATCH] D81117: Fix path separator issue on Windows

2020-06-03 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The following 3 tests fail on Windows:
Clang :: ClangScanDeps/header_stat_before_open.m
Clang :: ClangScanDeps/static-analyzer.c
Clang :: ClangScanDeps/vfsoverlay.cpp

The issue is that bad filenames are being constructed. This change uses
llvm::sys::path::append to concatenate file paths rather than string
append with a '/' thrown in the middle.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81117

Files:
  clang/lib/Lex/HeaderSearch.cpp


Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -780,10 +780,8 @@
   const FileEntry *Includer = IncluderAndDir.first;
 
   // Concatenate the requested file onto the directory.
-  // FIXME: Portability.  Filename concatenation should be in sys::Path.
   TmpDir = IncluderAndDir.second->getName();
-  TmpDir.push_back('/');
-  TmpDir.append(Filename.begin(), Filename.end());
+  llvm::sys::path::append(TmpDir, Filename);
 
   // FIXME: We don't cache the result of getFileInfo across the call to
   // getFileAndSuggestModule, because it's a reference to an element of


Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -780,10 +780,8 @@
   const FileEntry *Includer = IncluderAndDir.first;
 
   // Concatenate the requested file onto the directory.
-  // FIXME: Portability.  Filename concatenation should be in sys::Path.
   TmpDir = IncluderAndDir.second->getName();
-  TmpDir.push_back('/');
-  TmpDir.append(Filename.begin(), Filename.end());
+  llvm::sys::path::append(TmpDir, Filename);
 
   // FIXME: We don't cache the result of getFileInfo across the call to
   // getFileAndSuggestModule, because it's a reference to an element of
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81041: Use existing path sep style in clang::FileManager::FixupRelativePath

2020-06-03 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

@amccarth

The assert that I am getting is at line 1701 of VirtualFileSystem.cpp:

  assert(!isTraversalComponent(*Start) &&
   !isTraversalComponent(From->getName()) &&
   "Paths should not contain traversal components");

path is 
`C:/[path]/[to]/[build]/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir\\.`
 (notice the trailing windows path separator)

The path is canonicalized on line 1688 of VirtualFileSystem.cpp in lookupPath. 
The canonicalization fails to remove the trailing '.' because it detects (using 
the same method I am using in my patch) that the file path has posix separators 
and it sees "vfsoverlay.cpp.tmp.dir\\." as one path component. Perhaps the real 
fix is to make canonicalize handle mixed separators? I'm guessing that 
canonicalize is implemented as it is for performance reasons? This comment in 
the body of canonicalize "Explicitly specifying the path style prevents the 
direction of the slashes from changing" leads me to believe that it is 
desirable that the path separators not be changed, so a new implementation 
would need to walk the entire string and fail if mixed separators are 
encountered, or llvm::sys::path::remove_dots needs to also be changed to have a 
mixed-separators version.

The test clang::test/ClangScanDeps/vfsoverlay.cpp causes this on my machine. It 
is unfortunate that for reasons beyond my comprehensions, I often get test 
failures on my machine that are not caught by the builders, so I have no idea 
why the builders don't see this. Perhaps they aren't running this test?

Regardless, I think that using even a flawed method to detect what the default 
path separator should be might be better than just assuming native. Either it 
will be correct, or the path already had mixed separators, and it doesn't 
actually matter.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81041/new/

https://reviews.llvm.org/D81041



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


[PATCH] D81041: Use existing path sep style in clang::FileManager::FixupRelativePath

2020-06-02 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ctetreau added reviewers: efriedma, apazos, zzheng, dexonsmith, rnk.

Modify clang::FileManager::FixupRelativePath to use the existing path
separator style, if one exists. Prior to this change, if a path is set
for the FileSystemOpts workingDir that does not match the native path
separator style, this can result in a path with mixed separators. This
was causing an assertion failure in
clang::test/ClangScanDeps/vfsoverlay.cpp on my machine.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81041

Files:
  clang/lib/Basic/FileManager.cpp


Index: clang/lib/Basic/FileManager.cpp
===
--- clang/lib/Basic/FileManager.cpp
+++ clang/lib/Basic/FileManager.cpp
@@ -423,6 +423,8 @@
 }
 
 bool FileManager::FixupRelativePath(SmallVectorImpl ) const {
+  using namespace llvm::sys::path;
+
   StringRef pathRef(path.data(), path.size());
 
   if (FileSystemOpts.WorkingDir.empty()
@@ -430,7 +432,19 @@
 return false;
 
   SmallString<128> NewPath(FileSystemOpts.WorkingDir);
-  llvm::sys::path::append(NewPath, pathRef);
+  Style sepStyle = Style::native;
+
+  for (char c : NewPath) {
+if (is_separator(c, Style::windows)) {
+  sepStyle = Style::windows;
+  break;
+} else if (is_separator(c, Style::posix)) {
+  sepStyle = Style::posix;
+  break;
+}
+  }
+
+  append(NewPath, sepStyle, pathRef);
   path = NewPath;
   return true;
 }


Index: clang/lib/Basic/FileManager.cpp
===
--- clang/lib/Basic/FileManager.cpp
+++ clang/lib/Basic/FileManager.cpp
@@ -423,6 +423,8 @@
 }
 
 bool FileManager::FixupRelativePath(SmallVectorImpl ) const {
+  using namespace llvm::sys::path;
+
   StringRef pathRef(path.data(), path.size());
 
   if (FileSystemOpts.WorkingDir.empty()
@@ -430,7 +432,19 @@
 return false;
 
   SmallString<128> NewPath(FileSystemOpts.WorkingDir);
-  llvm::sys::path::append(NewPath, pathRef);
+  Style sepStyle = Style::native;
+
+  for (char c : NewPath) {
+if (is_separator(c, Style::windows)) {
+  sepStyle = Style::windows;
+  break;
+} else if (is_separator(c, Style::posix)) {
+  sepStyle = Style::posix;
+  break;
+}
+  }
+
+  append(NewPath, sepStyle, pathRef);
   path = NewPath;
   return true;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-06-01 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG796898172c48: [SVE] Eliminate calls to default-false 
VectorType::get() from Clang (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80323/new/

https://reviews.llvm.org/D80323

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/utils/TableGen/MveEmitter.cpp

Index: clang/utils/TableGen/MveEmitter.cpp
===
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -300,7 +300,7 @@
 return Element->cNameBase() + "x" + utostr(Lanes);
   }
   std::string llvmName() const override {
-return "llvm::VectorType::get(" + Element->llvmName() + ", " +
+return "llvm::FixedVectorType::get(" + Element->llvmName() + ", " +
utostr(Lanes) + ")";
   }
 
@@ -354,7 +354,7 @@
 // explanation.
 unsigned ModifiedLanes = (Lanes == 2 ? 4 : Lanes);
 
-return "llvm::VectorType::get(Builder.getInt1Ty(), " +
+return "llvm::FixedVectorType::get(Builder.getInt1Ty(), " +
utostr(ModifiedLanes) + ")";
   }
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1478,8 +1478,8 @@
   // registers and we need to make sure to pick a type the LLVM
   // backend will like.
   if (Size == 128)
-return ABIArgInfo::getDirect(llvm::VectorType::get(
-  llvm::Type::getInt64Ty(getVMContext()), 2));
+return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+llvm::Type::getInt64Ty(getVMContext()), 2));
 
   // Always return in register if it fits in a general purpose
   // register, or if it is 64 bits and has a single element.
@@ -3122,8 +3122,8 @@
 cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
-  return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getInt64Ty(getVMContext()),
+Size / 64);
 }
 
 return IRType;
@@ -3138,8 +3138,8 @@
 
 
   // Return a LLVM IR vector type based on the size of 'Ty'.
-  return llvm::VectorType::get(llvm::Type::getDoubleTy(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getDoubleTy(getVMContext()),
+Size / 64);
 }
 
 /// BitsContainNoUserData - Return true if the specified [start,end) bit range
@@ -3273,7 +3273,8 @@
   // case.
   if (ContainsFloatAtOffset(IRType, IROffset, getDataLayout()) &&
   ContainsFloatAtOffset(IRType, IROffset+4, getDataLayout()))
-return llvm::VectorType::get(llvm::Type::getFloatTy(getVMContext()), 2);
+return llvm::FixedVectorType::get(llvm::Type::getFloatTy(getVMContext()),
+  2);
 
   return llvm::Type::getDoubleTy(getVMContext());
 }
@@ -4140,8 +4141,8 @@
 
   // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
   // Clang matches them for compatibility.
-  return ABIArgInfo::getDirect(
-  llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()), 2));
+  return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+  llvm::Type::getInt64Ty(getVMContext()), 2));
 
 default:
   break;
@@ -5478,13 +5479,13 @@
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 64) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 128) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
   return ABIArgInfo::getDirect(ResType);
 }
 return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
@@ -6209,7 +6210,7 @@
 return ABIArgInfo::getDirect(ResType);
   }
   if (Size == 64 || Size == 128) {
-llvm::Type *ResType = llvm::VectorType::get(
+auto *ResType = llvm::FixedVectorType::get(
 llvm::Type::getInt32Ty(getVMContext()), Size / 32);
 return ABIArgInfo::getDirect(ResType);
   }
@@ -6225,7 +6226,7 @@
 // FP16 vectors should be converted to integer vectors
 if (!getTarget().hasLegalHalfType() && containsAnyFP16Vectors(Ty)) {
   uint64_t Size = 

[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-05-29 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

@rjmccall Given the outcome of the call yesterday, may I merge this patch?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80323/new/

https://reviews.llvm.org/D80323



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


[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-05-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 267002.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80323/new/

https://reviews.llvm.org/D80323

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/utils/TableGen/MveEmitter.cpp

Index: clang/utils/TableGen/MveEmitter.cpp
===
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -300,7 +300,7 @@
 return Element->cNameBase() + "x" + utostr(Lanes);
   }
   std::string llvmName() const override {
-return "llvm::VectorType::get(" + Element->llvmName() + ", " +
+return "llvm::FixedVectorType::get(" + Element->llvmName() + ", " +
utostr(Lanes) + ")";
   }
 
@@ -354,7 +354,7 @@
 // explanation.
 unsigned ModifiedLanes = (Lanes == 2 ? 4 : Lanes);
 
-return "llvm::VectorType::get(Builder.getInt1Ty(), " +
+return "llvm::FixedVectorType::get(Builder.getInt1Ty(), " +
utostr(ModifiedLanes) + ")";
   }
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1478,8 +1478,8 @@
   // registers and we need to make sure to pick a type the LLVM
   // backend will like.
   if (Size == 128)
-return ABIArgInfo::getDirect(llvm::VectorType::get(
-  llvm::Type::getInt64Ty(getVMContext()), 2));
+return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+llvm::Type::getInt64Ty(getVMContext()), 2));
 
   // Always return in register if it fits in a general purpose
   // register, or if it is 64 bits and has a single element.
@@ -3122,8 +3122,8 @@
 cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
-  return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getInt64Ty(getVMContext()),
+Size / 64);
 }
 
 return IRType;
@@ -3138,8 +3138,8 @@
 
 
   // Return a LLVM IR vector type based on the size of 'Ty'.
-  return llvm::VectorType::get(llvm::Type::getDoubleTy(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getDoubleTy(getVMContext()),
+Size / 64);
 }
 
 /// BitsContainNoUserData - Return true if the specified [start,end) bit range
@@ -3273,7 +3273,8 @@
   // case.
   if (ContainsFloatAtOffset(IRType, IROffset, getDataLayout()) &&
   ContainsFloatAtOffset(IRType, IROffset+4, getDataLayout()))
-return llvm::VectorType::get(llvm::Type::getFloatTy(getVMContext()), 2);
+return llvm::FixedVectorType::get(llvm::Type::getFloatTy(getVMContext()),
+  2);
 
   return llvm::Type::getDoubleTy(getVMContext());
 }
@@ -4140,8 +4141,8 @@
 
   // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
   // Clang matches them for compatibility.
-  return ABIArgInfo::getDirect(
-  llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()), 2));
+  return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+  llvm::Type::getInt64Ty(getVMContext()), 2));
 
 default:
   break;
@@ -5478,13 +5479,13 @@
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 64) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 128) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
   return ABIArgInfo::getDirect(ResType);
 }
 return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
@@ -6209,7 +6210,7 @@
 return ABIArgInfo::getDirect(ResType);
   }
   if (Size == 64 || Size == 128) {
-llvm::Type *ResType = llvm::VectorType::get(
+auto *ResType = llvm::FixedVectorType::get(
 llvm::Type::getInt32Ty(getVMContext()), Size / 32);
 return ABIArgInfo::getDirect(ResType);
   }
@@ -6225,7 +6226,7 @@
 // FP16 vectors should be converted to integer vectors
 if (!getTarget().hasLegalHalfType() && containsAnyFP16Vectors(Ty)) {
   uint64_t Size = getContext().getTypeSize(VT);
-  llvm::Type *NewVecTy = llvm::VectorType::get(
+  auto *NewVecTy = 

[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-05-21 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 265542.
ctetreau added a comment.

address code review issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80323/new/

https://reviews.llvm.org/D80323

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/utils/TableGen/MveEmitter.cpp

Index: clang/utils/TableGen/MveEmitter.cpp
===
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -300,7 +300,7 @@
 return Element->cNameBase() + "x" + utostr(Lanes);
   }
   std::string llvmName() const override {
-return "llvm::VectorType::get(" + Element->llvmName() + ", " +
+return "llvm::FixedVectorType::get(" + Element->llvmName() + ", " +
utostr(Lanes) + ")";
   }
 
@@ -354,7 +354,7 @@
 // explanation.
 unsigned ModifiedLanes = (Lanes == 2 ? 4 : Lanes);
 
-return "llvm::VectorType::get(Builder.getInt1Ty(), " +
+return "llvm::FixedVectorType::get(Builder.getInt1Ty(), " +
utostr(ModifiedLanes) + ")";
   }
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1478,8 +1478,8 @@
   // registers and we need to make sure to pick a type the LLVM
   // backend will like.
   if (Size == 128)
-return ABIArgInfo::getDirect(llvm::VectorType::get(
-  llvm::Type::getInt64Ty(getVMContext()), 2));
+return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+llvm::Type::getInt64Ty(getVMContext()), 2));
 
   // Always return in register if it fits in a general purpose
   // register, or if it is 64 bits and has a single element.
@@ -3122,8 +3122,8 @@
 cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
-  return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getInt64Ty(getVMContext()),
+Size / 64);
 }
 
 return IRType;
@@ -3138,8 +3138,8 @@
 
 
   // Return a LLVM IR vector type based on the size of 'Ty'.
-  return llvm::VectorType::get(llvm::Type::getDoubleTy(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getDoubleTy(getVMContext()),
+Size / 64);
 }
 
 /// BitsContainNoUserData - Return true if the specified [start,end) bit range
@@ -3273,7 +3273,8 @@
   // case.
   if (ContainsFloatAtOffset(IRType, IROffset, getDataLayout()) &&
   ContainsFloatAtOffset(IRType, IROffset+4, getDataLayout()))
-return llvm::VectorType::get(llvm::Type::getFloatTy(getVMContext()), 2);
+return llvm::FixedVectorType::get(llvm::Type::getFloatTy(getVMContext()),
+  2);
 
   return llvm::Type::getDoubleTy(getVMContext());
 }
@@ -4140,8 +4141,8 @@
 
   // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
   // Clang matches them for compatibility.
-  return ABIArgInfo::getDirect(
-  llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()), 2));
+  return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+  llvm::Type::getInt64Ty(getVMContext()), 2));
 
 default:
   break;
@@ -5478,13 +5479,13 @@
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 64) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 128) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
   return ABIArgInfo::getDirect(ResType);
 }
 return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
@@ -6209,7 +6210,7 @@
 return ABIArgInfo::getDirect(ResType);
   }
   if (Size == 64 || Size == 128) {
-llvm::Type *ResType = llvm::VectorType::get(
+auto *ResType = llvm::FixedVectorType::get(
 llvm::Type::getInt32Ty(getVMContext()), Size / 32);
 return ABIArgInfo::getDirect(ResType);
   }
@@ -6225,7 +6226,7 @@
 // FP16 vectors should be converted to integer vectors
 if (!getTarget().hasLegalHalfType() && containsAnyFP16Vectors(Ty)) {
   uint64_t Size = getContext().getTypeSize(VT);
-  llvm::Type *NewVecTy = llvm::VectorType::get(
+  auto *NewVecTy 

[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-05-21 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

In D80323#2048457 , @rjmccall wrote:

> I'm sympathetic to wanting to get rid of the boolean flag, but this is a 
> really invasive change for pretty minimal benefit.  Why not leave 
> `VectorType::get` as meaning a non-scalable vector type and come up with a 
> different method name to get a scalable vector?


As it stands today, if you call VectorType::get(Ty, N, false), you will get an 
instance of FixedVectorType, via a base VectorType pointer. Currently, you can 
call getNumElements() on a base VectorType and it will work, but the ultimate 
endgame is that getNumElements is going to be removed from base VectorType. 
This change makes it so that you don't have to cast your VectorType object to 
FixedVectorType everywhere.

The overall architecture is that there is a derived type for each sort of 
vector. VectorType is the base class, and the two derived vector types are 
FixedVectorType and ScalableVectorType. I suppose I could have named them 
something like BaseVectorType, VectorType(actually fixed width vector type), 
and ScalableVectorType, but I feel that this is a worse solution because it's 
not obvious by the name what a "VectorType" is. Additionally, naming the types 
this would have broken all code that previously worked for scalable vectors. 
It's not obvious to me which naming scheme would have resulted in less changes 
(changes to rename fixed vectors to FixedVectorType vs changes needed to rename 
all generic code to BaseVectorType and to fix code for scalable vectors), but I 
think the consistency in the naming scheme justifies the path I chose.

For your specific proposal, I think it would be very strange if a function with 
the signature `static FixedVectorType *get(Type *, unsigned)` were a member of 
the base VectorType.

If you'd like to know more about the motivation for this work, here is a link 
to the RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80323/new/

https://reviews.llvm.org/D80323



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


[PATCH] D80323: [SVE] Eliminate calls to default-false VectorType::get() from Clang

2020-05-20 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, dmgreen, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
ctetreau added reviewers: david-arm, fpetrogalli, ddunbar, rjmccall.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80323

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/utils/TableGen/MveEmitter.cpp

Index: clang/utils/TableGen/MveEmitter.cpp
===
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -300,7 +300,7 @@
 return Element->cNameBase() + "x" + utostr(Lanes);
   }
   std::string llvmName() const override {
-return "llvm::VectorType::get(" + Element->llvmName() + ", " +
+return "llvm::FixedVectorType::get(" + Element->llvmName() + ", " +
utostr(Lanes) + ")";
   }
 
@@ -354,7 +354,7 @@
 // explanation.
 unsigned ModifiedLanes = (Lanes == 2 ? 4 : Lanes);
 
-return "llvm::VectorType::get(Builder.getInt1Ty(), " +
+return "llvm::FixedVectorType::get(Builder.getInt1Ty(), " +
utostr(ModifiedLanes) + ")";
   }
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1478,8 +1478,8 @@
   // registers and we need to make sure to pick a type the LLVM
   // backend will like.
   if (Size == 128)
-return ABIArgInfo::getDirect(llvm::VectorType::get(
-  llvm::Type::getInt64Ty(getVMContext()), 2));
+return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+llvm::Type::getInt64Ty(getVMContext()), 2));
 
   // Always return in register if it fits in a general purpose
   // register, or if it is 64 bits and has a single element.
@@ -3122,8 +3122,8 @@
 cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
-  return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getInt64Ty(getVMContext()),
+Size / 64);
 }
 
 return IRType;
@@ -3138,8 +3138,8 @@
 
 
   // Return a LLVM IR vector type based on the size of 'Ty'.
-  return llvm::VectorType::get(llvm::Type::getDoubleTy(getVMContext()),
-   Size / 64);
+  return llvm::FixedVectorType::get(llvm::Type::getDoubleTy(getVMContext()),
+Size / 64);
 }
 
 /// BitsContainNoUserData - Return true if the specified [start,end) bit range
@@ -3273,7 +3273,8 @@
   // case.
   if (ContainsFloatAtOffset(IRType, IROffset, getDataLayout()) &&
   ContainsFloatAtOffset(IRType, IROffset+4, getDataLayout()))
-return llvm::VectorType::get(llvm::Type::getFloatTy(getVMContext()), 2);
+return llvm::FixedVectorType::get(llvm::Type::getFloatTy(getVMContext()),
+  2);
 
   return llvm::Type::getDoubleTy(getVMContext());
 }
@@ -4140,8 +4141,8 @@
 
   // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
   // Clang matches them for compatibility.
-  return ABIArgInfo::getDirect(
-  llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()), 2));
+  return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+  llvm::Type::getInt64Ty(getVMContext()), 2));
 
 default:
   break;
@@ -5478,13 +5479,13 @@
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 64) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 2);
   return ABIArgInfo::getDirect(ResType);
 }
 if (Size == 128) {
-  llvm::Type *ResType =
-  llvm::VectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
+  auto *ResType =
+  llvm::FixedVectorType::get(llvm::Type::getInt32Ty(getVMContext()), 4);
   return ABIArgInfo::getDirect(ResType);
 }
 return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
@@ -6209,7 +6210,7 @@
 return ABIArgInfo::getDirect(ResType);
   }
   if (Size == 64 || Size == 128) {
-llvm::Type *ResType = llvm::VectorType::get(
+auto *ResType = llvm::FixedVectorType::get(
 llvm::Type::getInt32Ty(getVMContext()), Size / 32);
 return ABIArgInfo::getDirect(ResType);
   }
@@ -6225,7 +6226,7 @@
 // FP16 vectors should be converted to integer vectors
 if (!getTarget().hasLegalHalfType() && containsAnyFP16Vectors(Ty)) {
   uint64_t Size = getContext().getTypeSize(VT);
- 

[PATCH] D79054: [NFC] Improve doc string to mention that paths in diff are used as-is

2020-05-06 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a77b958e250: [NFC] Improve doc string to mention that paths 
in diff are used as-is (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79054/new/

https://reviews.llvm.org/D79054

Files:
  clang/tools/clang-format/clang-format-diff.py


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,9 +13,13 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
+It should be noted that the filename contained in the diff is used unmodified
+to determine the source file to update. Users calling this script directly
+should be careful to ensure that the path in the diff is correct relative to 
the
+current working directory.
 """
 from __future__ import absolute_import, division, print_function
 


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,9 +13,13 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
+It should be noted that the filename contained in the diff is used unmodified
+to determine the source file to update. Users calling this script directly
+should be careful to ensure that the path in the diff is correct relative to the
+current working directory.
 """
 from __future__ import absolute_import, division, print_function
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79054: [NFC] Improve doc string to mention that paths in diff are used as-is

2020-05-06 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

In D79054#2018912 , @efriedma wrote:

> We should probably encourage people to use git-clang-format with git 
> repositories.  It naturally doesn't have this sort of fragility because it 
> integrates with the repository more tightly.


That may be a better choice for me personally, but other version control 
systems exist, and this is a tool with broader appeal.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79054/new/

https://reviews.llvm.org/D79054



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


[PATCH] D79054: [NFC] Improve doc string to mention that paths in diff are used as-is

2020-05-06 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 262433.
ctetreau added a comment.

address code review issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79054/new/

https://reviews.llvm.org/D79054

Files:
  clang/tools/clang-format/clang-format-diff.py


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,9 +13,13 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
+It should be noted that the filename contained in the diff is used unmodified
+to determine the source file to update. Users calling this script directly
+should be careful to ensure that the path in the diff is correct relative to 
the
+current working directory.
 """
 from __future__ import absolute_import, division, print_function
 


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,9 +13,13 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
+It should be noted that the filename contained in the diff is used unmodified
+to determine the source file to update. Users calling this script directly
+should be careful to ensure that the path in the diff is correct relative to the
+current working directory.
 """
 from __future__ import absolute_import, division, print_function
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79054: [NFC] Improve documentation for -i and update example git one liner

2020-04-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

I considered trying to find a way to work around the issue. Something like "if 
the file is not found, and the current directory is `/foo/bar/`, and the 
computed filename is `bar/baz.c`, then use `/foo/bar/baz.c`". But I don't think 
there's any way we can reliably know that such a computed file is correct, and 
I think it's better to error out than to silently do the wrong thing.

I think the behavior of taking the filename from the diff as-is is reasonable 
as long as it's documented.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79054/new/

https://reviews.llvm.org/D79054



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


[PATCH] D79054: [NFC] Improve documentation for -i and update example git one liner

2020-04-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ctetreau added reviewers: djasper, alexfh.
ctetreau added a comment.

I considered trying to find a way to work around the issue. Something like "if 
the file is not found, and the current directory is `/foo/bar/`, and the 
computed filename is `bar/baz.c`, then use `/foo/bar/baz.c`". But I don't think 
there's any way we can reliably know that such a computed file is correct, and 
I think it's better to error out than to silently do the wrong thing.

I think the behavior of taking the filename from the diff as-is is reasonable 
as long as it's documented.


- Improve the documentation of -i to mention that the path contained in

the diff is used as-is as the file to update.

- Add --relative to the suggested git-diff one liner. If the user does not

pass this argument, then git will produce a diff with the path relative
to the repository root. If the user's working directory is not the
repository root, then clang-format will complain that the file is not
found. The --relative argument makes git produce a diff with the files
relative to the working directory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79054

Files:
  clang/tools/clang-format/clang-format-diff.py


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,7 +13,7 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
 """
@@ -36,7 +36,9 @@
formatter_class=

argparse.RawDescriptionHelpFormatter)
   parser.add_argument('-i', action='store_true', default=False,
-  help='apply edits to files instead of displaying a diff')
+  help='apply edits to files instead of displaying a diff.'
+  ' The filename contained in the diff is used unmodified'
+  ' to determine the source file to update')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')
   parser.add_argument('-regex', metavar='PATTERN', default=None,


Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -13,7 +13,7 @@
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
 
-  git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
+  git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
   svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
 
 """
@@ -36,7 +36,9 @@
formatter_class=
argparse.RawDescriptionHelpFormatter)
   parser.add_argument('-i', action='store_true', default=False,
-  help='apply edits to files instead of displaying a diff')
+  help='apply edits to files instead of displaying a diff.'
+  ' The filename contained in the diff is used unmodified'
+  ' to determine the source file to update')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')
   parser.add_argument('-regex', metavar='PATTERN', default=None,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-28 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef3678cfeea6: [SVE] Update EmitSVEPredicateCast to take a 
ScalableVectorType (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78958/new/

https://reviews.llvm.org/D78958

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3919,7 +3919,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), 
VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3919,7 +3919,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGda8918f27e30: [SVE][NFC] Use ScalableVectorType in CGBuiltin 
(authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78842/new/

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return 

[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260491.
ctetreau added a comment.

fix syntax error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78842/new/

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyBool64:
-return 

[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260474.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78958/new/

https://reviews.llvm.org/D78958

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), 
VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 260472.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78842/new/

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7542,66 +7542,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4, );
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyBool32:
-return llvm::VectorType::get(Builder.getInt1Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyBool64:
-return 

[PATCH] D78958: [SVE] Update EmitSVEPredicateCast to take a ScalableVectorType

2020-04-27 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: clang.

Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_abs.c. Since the type is an
SVE predicate vector, it makes sense to specialize the code for scalable
vectors only.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78958

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), 
VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }


Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3914,7 +3914,8 @@
   llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
   llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
-  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
+  llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
+llvm::ScalableVectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
  llvm::SmallVectorImpl ,
  unsigned IntID);
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7609,15 +7609,14 @@
 // Reinterpret the input predicate so that it can be used to correctly isolate
 // the elements of the specified datatype.
 Value *CodeGenFunction::EmitSVEPredicateCast(Value *Pred,
- llvm::VectorType *VTy) {
-  llvm::VectorType *RTy = llvm::VectorType::get(
-  IntegerType::get(getLLVMContext(), 1), VTy->getElementCount());
+ llvm::ScalableVectorType *VTy) {
+  auto *RTy = llvm::VectorType::get(IntegerType::get(getLLVMContext(), 1), VTy);
   if (Pred->getType() == RTy)
 return Pred;
 
   unsigned IntID;
   llvm::Type *IntrinsicTy;
-  switch (VTy->getNumElements()) {
+  switch (VTy->getMinNumElements()) {
   default:
 llvm_unreachable("unsupported element count!");
   case 2:
@@ -7948,7 +7947,7 @@
 // Predicate results must be converted to svbool_t.
 if (auto PredTy = dyn_cast(Call->getType()))
   if (PredTy->getScalarType()->isIntegerTy(1))
-Call = EmitSVEPredicateCast(Call, cast(Ty));
+Call = EmitSVEPredicateCast(Call, cast(Ty));
 
 return Call;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78842: [SVE][NFC] Use ScalableVectorType in CGBuiltin

2020-04-24 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
ctetreau added a parent revision: D78841: [SVE] Add specialized overloads of 
VectorType::get.
ctetreau added reviewers: david-arm, fpetrogalli, kmclaughlin.

- Upgrade some usages of VectorType to use ScalableVectorType


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78842

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h

Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -3911,8 +3911,8 @@
   SmallVector getSVEOverloadTypes(SVETypeFlags TypeFlags,
ArrayRef Ops);
   llvm::Type *getEltType(SVETypeFlags TypeFlags);
-  llvm::VectorType *getSVEType(const SVETypeFlags );
-  llvm::VectorType *getSVEPredType(SVETypeFlags TypeFlags);
+  llvm::ScalableVectorType *getSVEType(const SVETypeFlags );
+  llvm::ScalableVectorType *getSVEPredType(SVETypeFlags TypeFlags);
   llvm::Value *EmitSVEDupX(llvm::Value *Scalar);
   llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred, llvm::VectorType *VTy);
   llvm::Value *EmitSVEGatherLoad(SVETypeFlags TypeFlags,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7541,66 +7541,68 @@
 
 // Return the llvm predicate vector type corresponding to the specified element
 // TypeFlags.
-llvm::VectorType* CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEPredType(SVETypeFlags TypeFlags) {
   switch (TypeFlags.getEltType()) {
   default: llvm_unreachable("Unhandled SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 16, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4, );
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 8, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 4, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getInt1Ty(), { 2, true });
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 2);
   }
 }
 
 // Return the llvm vector type corresponding to the specified element TypeFlags.
-llvm::VectorType *CodeGenFunction::getSVEType(const SVETypeFlags ) {
+llvm::ScalableVectorType *
+CodeGenFunction::getSVEType(const SVETypeFlags ) {
   switch (TypeFlags.getEltType()) {
   default:
 llvm_unreachable("Invalid SVETypeFlag!");
 
   case SVETypeFlags::EltTyInt8:
-return llvm::VectorType::get(Builder.getInt8Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt8Ty(), 16);
   case SVETypeFlags::EltTyInt16:
-return llvm::VectorType::get(Builder.getInt16Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt16Ty(), 8);
   case SVETypeFlags::EltTyInt32:
-return llvm::VectorType::get(Builder.getInt32Ty(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getInt32Ty(), 4);
   case SVETypeFlags::EltTyInt64:
-return llvm::VectorType::get(Builder.getInt64Ty(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getInt64Ty(), 2);
 
   case SVETypeFlags::EltTyFloat16:
-return llvm::VectorType::get(Builder.getHalfTy(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getHalfTy(), 8);
   case SVETypeFlags::EltTyFloat32:
-return llvm::VectorType::get(Builder.getFloatTy(), {4, true});
+return llvm::ScalableVectorType::get(Builder.getFloatTy(), 4);
   case SVETypeFlags::EltTyFloat64:
-return llvm::VectorType::get(Builder.getDoubleTy(), {2, true});
+return llvm::ScalableVectorType::get(Builder.getDoubleTy(), 2);
 
   case SVETypeFlags::EltTyBool8:
-return llvm::VectorType::get(Builder.getInt1Ty(), {16, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 16);
   case SVETypeFlags::EltTyBool16:
-return llvm::VectorType::get(Builder.getInt1Ty(), {8, true});
+return llvm::ScalableVectorType::get(Builder.getInt1Ty(), 

[PATCH] D77278: Remove asserting getters from base Type

2020-04-17 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc858debebc13: Remove asserting getters from base Type 
(authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77278/new/

https://reviews.llvm.org/D77278

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/unittests/IR/VPIntrinsicTest.cpp

Index: llvm/unittests/IR/VPIntrinsicTest.cpp
===
--- llvm/unittests/IR/VPIntrinsicTest.cpp
+++ llvm/unittests/IR/VPIntrinsicTest.cpp
@@ -107,7 +107,7 @@
 if (MaskParamPos.hasValue()) {
   Type *MaskParamType = F.getArg(MaskParamPos.getValue())->getType();
   ASSERT_TRUE(MaskParamType->isVectorTy());
-  ASSERT_TRUE(MaskParamType->getVectorElementType()->isIntegerTy(1));
+  ASSERT_TRUE(cast(MaskParamType)->getElementType()->isIntegerTy(1));
 }
 
 Optional VecLenParamPos =
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4263,7 +4263,7 @@
 
 Base = SDB->getValue(C);
 
-unsigned NumElts = Ptr->getType()->getVectorNumElements();
+unsigned NumElts = cast(Ptr->getType())->getNumElements();
 EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts);
 Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT);
 IndexType = ISD::SIGNED_SCALED;
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5262,7 +5262,7 @@
   if (!RewriteGEP && Ops.size() == 2)
 return false;
 
-  unsigned NumElts = Ptr->getType()->getVectorNumElements();
+  unsigned NumElts = cast(Ptr->getType())->getNumElements();
 
   IRBuilder<> Builder(MemoryInst);
 
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -300,11 +300,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  inline Type *getScalarType() const;
 
   //======//
   // Type Iteration support.
@@ -339,8 +335,8 @@
 
   //======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" (for
-  // example) is shorthand for cast(Ty)->getNumElements().  This is
+  // the specified subclass and calls its accessor.  "getArrayNumElements" (for
+  // example) is shorthand for cast(Ty)->getNumElements().  This is
   // only intended to cover the core methods that are frequently used, helper
   // methods should not be added here.
 
@@ -361,14 +357,6 @@
 return ContainedTys[0];
   }
 
-  inline bool getVectorIsScalable() const;
-  inline unsigned getVectorNumElements() const;
-  inline ElementCount getVectorElementCount() const;
-  Type *getVectorElementType() const {
-assert(getTypeID() == VectorTyID);
-return ContainedTys[0];
-  }
-
   Type *getPointerElementType() const {
 assert(getTypeID() == PointerTyID);
 return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -531,18 +531,6 @@
   }
 };
 
-unsigned Type::getVectorNumElements() const {
-  return cast(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
-  return cast(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
-  return cast(this)->getElementCount();
-}
-
 bool Type::isVectorTy() const { return isa(this); }
 
 /// Class to represent pointers.
@@ -597,8 +585,8 @@
   isIntOrIntVectorTy() &&
   "Original type expected to be a vector of integers or a scalar integer.");
   Type *NewType = getIntNTy(getContext(), NewBitWidth);
-  if (isVectorTy())
-NewType = VectorType::get(NewType, getVectorElementCount());
+  if (auto *VTy = dyn_cast(this))
+NewType = VectorType::get(NewType, VTy->getElementCount());
   return NewType;
 }
 
@@ -606,6 +594,12 @@
   return cast(getScalarType())->getAddressSpace();
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 } // end namespace llvm
 
 #endif // 

[PATCH] D77278: Remove asserting getters from base Type

2020-04-17 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 258411.
ctetreau added a comment.

catch straggler


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77278/new/

https://reviews.llvm.org/D77278

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/unittests/IR/VPIntrinsicTest.cpp

Index: llvm/unittests/IR/VPIntrinsicTest.cpp
===
--- llvm/unittests/IR/VPIntrinsicTest.cpp
+++ llvm/unittests/IR/VPIntrinsicTest.cpp
@@ -107,7 +107,7 @@
 if (MaskParamPos.hasValue()) {
   Type *MaskParamType = F.getArg(MaskParamPos.getValue())->getType();
   ASSERT_TRUE(MaskParamType->isVectorTy());
-  ASSERT_TRUE(MaskParamType->getVectorElementType()->isIntegerTy(1));
+  ASSERT_TRUE(cast(MaskParamType)->getElementType()->isIntegerTy(1));
 }
 
 Optional VecLenParamPos =
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4263,7 +4263,7 @@
 
 Base = SDB->getValue(C);
 
-unsigned NumElts = Ptr->getType()->getVectorNumElements();
+unsigned NumElts = cast(Ptr->getType())->getNumElements();
 EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts);
 Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT);
 IndexType = ISD::SIGNED_SCALED;
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5262,7 +5262,7 @@
   if (!RewriteGEP && Ops.size() == 2)
 return false;
 
-  unsigned NumElts = Ptr->getType()->getVectorNumElements();
+  unsigned NumElts = cast(Ptr->getType())->getNumElements();
 
   IRBuilder<> Builder(MemoryInst);
 
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -300,11 +300,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  inline Type *getScalarType() const;
 
   //======//
   // Type Iteration support.
@@ -339,8 +335,8 @@
 
   //======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" (for
-  // example) is shorthand for cast(Ty)->getNumElements().  This is
+  // the specified subclass and calls its accessor.  "getArrayNumElements" (for
+  // example) is shorthand for cast(Ty)->getNumElements().  This is
   // only intended to cover the core methods that are frequently used, helper
   // methods should not be added here.
 
@@ -361,14 +357,6 @@
 return ContainedTys[0];
   }
 
-  inline bool getVectorIsScalable() const;
-  inline unsigned getVectorNumElements() const;
-  inline ElementCount getVectorElementCount() const;
-  Type *getVectorElementType() const {
-assert(getTypeID() == VectorTyID);
-return ContainedTys[0];
-  }
-
   Type *getPointerElementType() const {
 assert(getTypeID() == PointerTyID);
 return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -531,18 +531,6 @@
   }
 };
 
-unsigned Type::getVectorNumElements() const {
-  return cast(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
-  return cast(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
-  return cast(this)->getElementCount();
-}
-
 bool Type::isVectorTy() const { return isa(this); }
 
 /// Class to represent pointers.
@@ -597,8 +585,8 @@
   isIntOrIntVectorTy() &&
   "Original type expected to be a vector of integers or a scalar integer.");
   Type *NewType = getIntNTy(getContext(), NewBitWidth);
-  if (isVectorTy())
-NewType = VectorType::get(NewType, getVectorElementCount());
+  if (auto *VTy = dyn_cast(this))
+NewType = VectorType::get(NewType, VTy->getElementCount());
   return NewType;
 }
 
@@ -606,6 +594,12 @@
   return cast(getScalarType())->getAddressSpace();
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 } // end namespace llvm
 
 #endif // LLVM_IR_DERIVEDTYPES_H
Index: clang/lib/CodeGen/CGBuiltin.cpp

[PATCH] D77278: Remove asserting getters from base Type

2020-04-17 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 258392.
ctetreau added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

catch stragglers


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77278/new/

https://reviews.llvm.org/D77278

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4263,7 +4263,7 @@
 
 Base = SDB->getValue(C);
 
-unsigned NumElts = Ptr->getType()->getVectorNumElements();
+unsigned NumElts = cast(Ptr->getType())->getNumElements();
 EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts);
 Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT);
 IndexType = ISD::SIGNED_SCALED;
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5262,7 +5262,7 @@
   if (!RewriteGEP && Ops.size() == 2)
 return false;
 
-  unsigned NumElts = Ptr->getType()->getVectorNumElements();
+  unsigned NumElts = cast(Ptr->getType())->getNumElements();
 
   IRBuilder<> Builder(MemoryInst);
 
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -300,11 +300,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  inline Type *getScalarType() const;
 
   //======//
   // Type Iteration support.
@@ -339,8 +335,8 @@
 
   //======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" (for
-  // example) is shorthand for cast(Ty)->getNumElements().  This is
+  // the specified subclass and calls its accessor.  "getArrayNumElements" (for
+  // example) is shorthand for cast(Ty)->getNumElements().  This is
   // only intended to cover the core methods that are frequently used, helper
   // methods should not be added here.
 
@@ -361,14 +357,6 @@
 return ContainedTys[0];
   }
 
-  inline bool getVectorIsScalable() const;
-  inline unsigned getVectorNumElements() const;
-  inline ElementCount getVectorElementCount() const;
-  Type *getVectorElementType() const {
-assert(getTypeID() == VectorTyID);
-return ContainedTys[0];
-  }
-
   Type *getPointerElementType() const {
 assert(getTypeID() == PointerTyID);
 return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -531,18 +531,6 @@
   }
 };
 
-unsigned Type::getVectorNumElements() const {
-  return cast(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
-  return cast(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
-  return cast(this)->getElementCount();
-}
-
 bool Type::isVectorTy() const { return isa(this); }
 
 /// Class to represent pointers.
@@ -597,8 +585,8 @@
   isIntOrIntVectorTy() &&
   "Original type expected to be a vector of integers or a scalar integer.");
   Type *NewType = getIntNTy(getContext(), NewBitWidth);
-  if (isVectorTy())
-NewType = VectorType::get(NewType, getVectorElementCount());
+  if (auto *VTy = dyn_cast(this))
+NewType = VectorType::get(NewType, VTy->getElementCount());
   return NewType;
 }
 
@@ -606,6 +594,12 @@
   return cast(getScalarType())->getAddressSpace();
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 } // end namespace llvm
 
 #endif // LLVM_IR_DERIVEDTYPES_H
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7573,8 +7573,7 @@
   // The vector type that is stored may be different from the
   // eventual type stored to memory.
   auto VectorTy = cast(Ops.back()->getType());
-  auto MemoryTy =
-  llvm::VectorType::get(MemEltTy, VectorTy->getVectorElementCount());
+  auto MemoryTy = llvm::VectorType::get(MemEltTy, VectorTy->getElementCount());
 
   Value *Predicate = EmitSVEPredicateCast(Ops[0], MemoryTy);
   

[PATCH] D77278: Remove asserting getters from base Type

2020-04-17 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 258393.
ctetreau added a comment.

fix permissions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77278/new/

https://reviews.llvm.org/D77278

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4263,7 +4263,7 @@
 
 Base = SDB->getValue(C);
 
-unsigned NumElts = Ptr->getType()->getVectorNumElements();
+unsigned NumElts = cast(Ptr->getType())->getNumElements();
 EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts);
 Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT);
 IndexType = ISD::SIGNED_SCALED;
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5262,7 +5262,7 @@
   if (!RewriteGEP && Ops.size() == 2)
 return false;
 
-  unsigned NumElts = Ptr->getType()->getVectorNumElements();
+  unsigned NumElts = cast(Ptr->getType())->getNumElements();
 
   IRBuilder<> Builder(MemoryInst);
 
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -300,11 +300,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  inline Type *getScalarType() const;
 
   //======//
   // Type Iteration support.
@@ -339,8 +335,8 @@
 
   //======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" (for
-  // example) is shorthand for cast(Ty)->getNumElements().  This is
+  // the specified subclass and calls its accessor.  "getArrayNumElements" (for
+  // example) is shorthand for cast(Ty)->getNumElements().  This is
   // only intended to cover the core methods that are frequently used, helper
   // methods should not be added here.
 
@@ -361,14 +357,6 @@
 return ContainedTys[0];
   }
 
-  inline bool getVectorIsScalable() const;
-  inline unsigned getVectorNumElements() const;
-  inline ElementCount getVectorElementCount() const;
-  Type *getVectorElementType() const {
-assert(getTypeID() == VectorTyID);
-return ContainedTys[0];
-  }
-
   Type *getPointerElementType() const {
 assert(getTypeID() == PointerTyID);
 return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -531,18 +531,6 @@
   }
 };
 
-unsigned Type::getVectorNumElements() const {
-  return cast(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
-  return cast(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
-  return cast(this)->getElementCount();
-}
-
 bool Type::isVectorTy() const { return isa(this); }
 
 /// Class to represent pointers.
@@ -597,8 +585,8 @@
   isIntOrIntVectorTy() &&
   "Original type expected to be a vector of integers or a scalar integer.");
   Type *NewType = getIntNTy(getContext(), NewBitWidth);
-  if (isVectorTy())
-NewType = VectorType::get(NewType, getVectorElementCount());
+  if (auto *VTy = dyn_cast(this))
+NewType = VectorType::get(NewType, VTy->getElementCount());
   return NewType;
 }
 
@@ -606,6 +594,12 @@
   return cast(getScalarType())->getAddressSpace();
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 } // end namespace llvm
 
 #endif // LLVM_IR_DERIVEDTYPES_H
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -7573,8 +7573,7 @@
   // The vector type that is stored may be different from the
   // eventual type stored to memory.
   auto VectorTy = cast(Ops.back()->getType());
-  auto MemoryTy =
-  llvm::VectorType::get(MemEltTy, VectorTy->getVectorElementCount());
+  auto MemoryTy = llvm::VectorType::get(MemEltTy, VectorTy->getElementCount());
 
   Value *Predicate = EmitSVEPredicateCast(Ops[0], MemoryTy);
   Value *BasePtr = Builder.CreateBitCast(Ops[1], MemoryTy->getPointerTo());

[PATCH] D78131: [SVE] Fix unsigned is always >= 0

2020-04-15 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG464a0697e36a: [SVE] Fix unsigned is always = 0 (authored 
by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78131/new/

https://reviews.llvm.org/D78131

Files:
  clang/utils/TableGen/SveEmitter.cpp


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -801,9 +801,10 @@
 // Collate a list of range/option checks for the immediates.
 SmallVector ImmChecks;
 for (auto *R : ImmCheckList) {
-  unsigned Arg = R->getValueAsInt("Arg");
-  unsigned EltSizeArg = R->getValueAsInt("EltSizeArg");
-  unsigned Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  int64_t Arg = R->getValueAsInt("Arg");
+  int64_t EltSizeArg = R->getValueAsInt("EltSizeArg");
+  int64_t Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  assert(Arg >= 0 && Kind >= 0 && "Arg and Kind must be nonnegative");
 
   unsigned ElementSizeInBits = 0;
   if (EltSizeArg >= 0)


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -801,9 +801,10 @@
 // Collate a list of range/option checks for the immediates.
 SmallVector ImmChecks;
 for (auto *R : ImmCheckList) {
-  unsigned Arg = R->getValueAsInt("Arg");
-  unsigned EltSizeArg = R->getValueAsInt("EltSizeArg");
-  unsigned Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  int64_t Arg = R->getValueAsInt("Arg");
+  int64_t EltSizeArg = R->getValueAsInt("EltSizeArg");
+  int64_t Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  assert(Arg >= 0 && Kind >= 0 && "Arg and Kind must be nonnegative");
 
   unsigned ElementSizeInBits = 0;
   if (EltSizeArg >= 0)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77903: [SVE] Remove calls to getBitWidth from clang

2020-04-14 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG670f2f694bba: [SVE] Remove calls to getBitWidth from clang 
(authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77903/new/

https://reviews.llvm.org/D77903

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78131: [SVE] Fix unsigned is always >= 0

2020-04-14 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
ctetreau added a reviewer: sdesmalen.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78131

Files:
  clang/utils/TableGen/SveEmitter.cpp


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -801,9 +801,10 @@
 // Collate a list of range/option checks for the immediates.
 SmallVector ImmChecks;
 for (auto *R : ImmCheckList) {
-  unsigned Arg = R->getValueAsInt("Arg");
-  unsigned EltSizeArg = R->getValueAsInt("EltSizeArg");
-  unsigned Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  int64_t Arg = R->getValueAsInt("Arg");
+  int64_t EltSizeArg = R->getValueAsInt("EltSizeArg");
+  int64_t Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  assert(Arg >= 0 && Kind >= 0 && "Arg and Kind must be nonnegative");
 
   unsigned ElementSizeInBits = 0;
   if (EltSizeArg >= 0)


Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -801,9 +801,10 @@
 // Collate a list of range/option checks for the immediates.
 SmallVector ImmChecks;
 for (auto *R : ImmCheckList) {
-  unsigned Arg = R->getValueAsInt("Arg");
-  unsigned EltSizeArg = R->getValueAsInt("EltSizeArg");
-  unsigned Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  int64_t Arg = R->getValueAsInt("Arg");
+  int64_t EltSizeArg = R->getValueAsInt("EltSizeArg");
+  int64_t Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
+  assert(Arg >= 0 && Kind >= 0 && "Arg and Kind must be nonnegative");
 
   unsigned ElementSizeInBits = 0;
   if (EltSizeArg >= 0)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77903: [SVE] Remove calls to getBitWidth from clang

2020-04-13 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 257162.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77903/new/

https://reviews.llvm.org/D77903

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-13 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf22fbe3a152e: Clean up usages of asserting vector getters in 
Type (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77257/new/

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,17 +34,15 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(Ty->getScalarType())->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
 Ty, llvm::APInt::getSplat(BitWidth, llvm::APInt(64, IntValue)));
   }
   if (Ty->isPtrOrPtrVectorTy()) {
-auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+auto *PtrTy = cast(Ty->getScalarType());
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,8 +53,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getFltSemantics());
+Ty->getScalarType()->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
   Payload = llvm::APInt::getSplat(BitWidth, Payload);
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1309,7 +1309,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1327,8 +1327,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1694,8 +1694,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -,7 +,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4617,7 +4617,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2127,7 

[PATCH] D77903: [SVE] Remove calls to getBitWidth from clang

2020-04-10 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77903

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -970,7 +970,8 @@
  .Cases("y", "", "^Ym", true)
  .Default(false);
   if (IsMMXCons && Ty->isVectorTy()) {
-if (cast(Ty)->getBitWidth() != 64) {
+if (cast(Ty)->getPrimitiveSizeInBits().getFixedSize() !=
+64) {
   // Invalid MMX constraint
   return nullptr;
 }
@@ -2260,7 +2261,7 @@
 if (info.isDirect()) {
   llvm::Type *ty = info.getCoerceToType();
   if (llvm::VectorType *vectorTy = dyn_cast_or_null(ty))
-return (vectorTy->getBitWidth() > 128);
+return vectorTy->getPrimitiveSizeInBits().getFixedSize() > 128;
 }
 return false;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-10 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 256611.
ctetreau added a comment.

Address code review issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77257/new/

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,17 +34,15 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(Ty->getScalarType())->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
 Ty, llvm::APInt::getSplat(BitWidth, llvm::APInt(64, IntValue)));
   }
   if (Ty->isPtrOrPtrVectorTy()) {
-auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+auto *PtrTy = cast(Ty->getScalarType());
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,8 +53,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getFltSemantics());
+Ty->getScalarType()->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
   Payload = llvm::APInt::getSplat(BitWidth, Payload);
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1309,7 +1309,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1327,8 +1327,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1694,8 +1694,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -,7 +,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4617,7 +4617,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2127,7 +2127,8 @@
 
   if (const VectorType *VTy = Dst.getType()->getAs()) {
 unsigned 

[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-09 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 256408.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77257/new/

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,9 +34,11 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(
+Ty->isVectorTy() ? cast(Ty)->getElementType()
+ : Ty)
+->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
@@ -44,7 +46,7 @@
   }
   if (Ty->isPtrOrPtrVectorTy()) {
 auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty);
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,7 +57,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
+(Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty)
 ->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1309,7 +1309,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1327,8 +1327,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1694,8 +1694,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -,7 +,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4617,7 +4617,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2127,7 +2127,8 @@
 
   if (const VectorType *VTy = Dst.getType()->getAs()) {
 unsigned NumSrcElts = 

[PATCH] D77825: Fix syntax error

2020-04-09 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2a1418f242ab: Fix syntax error (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77825/new/

https://reviews.llvm.org/D77825

Files:
  clang/lib/Tooling/InterpolatingCompilationDatabase.cpp


Index: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
===
--- clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -116,7 +116,7 @@
 return types::TY_ObjCXX;
   case types::TY_CUDA:
   case types::TY_CUDA_DEVICE:
-return types::TY_CUDA:
+return types::TY_CUDA;
   default:
 return types::TY_INVALID;
   }


Index: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
===
--- clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -116,7 +116,7 @@
 return types::TY_ObjCXX;
   case types::TY_CUDA:
   case types::TY_CUDA_DEVICE:
-return types::TY_CUDA:
+return types::TY_CUDA;
   default:
 return types::TY_INVALID;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77451: Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments

2020-04-09 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp:119
+  case types::TY_CUDA_DEVICE:
+return types::TY_CUDA:
   default:

ctetreau wrote:
> Syntax error here, master is broken
I went ahead and fixed it.

https://github.com/llvm/llvm-project/commit/2a1418f242ab17d8d8fef6fe829fc1b9363877ca


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77451/new/

https://reviews.llvm.org/D77451



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


[PATCH] D77825: Fix syntax error

2020-04-09 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ctetreau added reviewers: tra, sammccall, ADRAADRA.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77825

Files:
  clang/lib/Tooling/InterpolatingCompilationDatabase.cpp


Index: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
===
--- clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -116,7 +116,7 @@
 return types::TY_ObjCXX;
   case types::TY_CUDA:
   case types::TY_CUDA_DEVICE:
-return types::TY_CUDA:
+return types::TY_CUDA;
   default:
 return types::TY_INVALID;
   }


Index: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
===
--- clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -116,7 +116,7 @@
 return types::TY_ObjCXX;
   case types::TY_CUDA:
   case types::TY_CUDA_DEVICE:
-return types::TY_CUDA:
+return types::TY_CUDA;
   default:
 return types::TY_INVALID;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77451: Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments

2020-04-09 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp:119
+  case types::TY_CUDA_DEVICE:
+return types::TY_CUDA:
   default:

Syntax error here, master is broken


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77451/new/

https://reviews.llvm.org/D77451



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


[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-06 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 255390.
ctetreau added a comment.

Address code review issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77257/new/

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,9 +34,11 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(
+Ty->isVectorTy() ? cast(Ty)->getElementType()
+ : Ty)
+->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
@@ -44,7 +46,7 @@
   }
   if (Ty->isPtrOrPtrVectorTy()) {
 auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty);
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,7 +57,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
+(Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty)
 ->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1306,7 +1306,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1324,8 +1324,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1691,8 +1691,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -2219,7 +2219,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4545,7 +4545,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2127,7 +2127,8 @@
 
   if (const VectorType *VTy = Dst.getType()->getAs()) {
 unsigned 

[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-04-03 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.
Herald added a subscriber: grosul1.

What's the status on this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-02 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 254570.
ctetreau added a comment.

Note that this is NFC


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77257/new/

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,9 +34,11 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(
+Ty->isVectorTy() ? cast(Ty)->getElementType()
+ : Ty)
+->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
@@ -44,7 +46,7 @@
   }
   if (Ty->isPtrOrPtrVectorTy()) {
 auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty);
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,7 +57,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
+(Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty)
 ->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1306,7 +1306,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1324,8 +1324,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1691,8 +1691,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -2219,7 +2219,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4545,7 +4545,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2127,7 +2127,8 @@
 
   if (const VectorType *VTy = Dst.getType()->getAs()) {
 unsigned 

[PATCH] D77257: Clean up usages of asserting vector getters in Type

2020-04-01 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77257

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,9 +34,11 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(
+Ty->isVectorTy() ? cast(Ty)->getElementType()
+ : Ty)
+->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
@@ -44,7 +46,7 @@
   }
   if (Ty->isPtrOrPtrVectorTy()) {
 auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty);
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,7 +57,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
+(Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty)
 ->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1306,7 +1306,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1324,8 +1324,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1691,8 +1691,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -2219,7 +2219,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4545,7 +4545,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ 

[PATCH] D77254: Clean up usages of asserting vector getters in Type

2020-04-01 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77254

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/PatternInit.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3054,7 +3054,7 @@
 // Don't pass vXi128 vectors in their native type, the backend can't
 // legalize them.
 if (passInt128VectorsInMem() &&
-IRType->getVectorElementType()->isIntegerTy(128)) {
+cast(IRType)->getElementType()->isIntegerTy(128)) {
   // Use a vXi64 vector.
   uint64_t Size = getContext().getTypeSize(Ty);
   return llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()),
Index: clang/lib/CodeGen/PatternInit.cpp
===
--- clang/lib/CodeGen/PatternInit.cpp
+++ clang/lib/CodeGen/PatternInit.cpp
@@ -34,9 +34,11 @@
   constexpr bool NegativeNaN = true;
   constexpr uint64_t NaNPayload = 0xull;
   if (Ty->isIntOrIntVectorTy()) {
-unsigned BitWidth = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
-->getBitWidth();
+unsigned BitWidth =
+cast(
+Ty->isVectorTy() ? cast(Ty)->getElementType()
+ : Ty)
+->getBitWidth();
 if (BitWidth <= 64)
   return llvm::ConstantInt::get(Ty, IntValue);
 return llvm::ConstantInt::get(
@@ -44,7 +46,7 @@
   }
   if (Ty->isPtrOrPtrVectorTy()) {
 auto *PtrTy = cast(
-Ty->isVectorTy() ? Ty->getVectorElementType() : Ty);
+Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty);
 unsigned PtrWidth = CGM.getContext().getTargetInfo().getPointerWidth(
 PtrTy->getAddressSpace());
 if (PtrWidth > 64)
@@ -55,7 +57,7 @@
   }
   if (Ty->isFPOrFPVectorTy()) {
 unsigned BitWidth = llvm::APFloat::semanticsSizeInBits(
-(Ty->isVectorTy() ? Ty->getVectorElementType() : Ty)
+(Ty->isVectorTy() ? cast(Ty)->getElementType() : Ty)
 ->getFltSemantics());
 llvm::APInt Payload(64, NaNPayload);
 if (BitWidth >= 64)
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1306,7 +1306,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1324,8 +1324,8 @@
 // short or half vector.
 
 // Source and destination are both expected to be vectors.
-llvm::Type *SrcElementTy = SrcTy->getVectorElementType();
-llvm::Type *DstElementTy = DstTy->getVectorElementType();
+llvm::Type *SrcElementTy = cast(SrcTy)->getElementType();
+llvm::Type *DstElementTy = cast(DstTy)->getElementType();
 (void)DstElementTy;
 
 assert(((SrcElementTy->isIntegerTy() &&
@@ -1691,8 +1691,8 @@
   assert(DstTy->isVectorTy() &&
  "ConvertVector destination IR type must be a vector");
 
-  llvm::Type *SrcEltTy = SrcTy->getVectorElementType(),
- *DstEltTy = DstTy->getVectorElementType();
+  llvm::Type *SrcEltTy = cast(SrcTy)->getElementType(),
+ *DstEltTy = cast(DstTy)->getElementType();
 
   if (DstEltType->isBooleanType()) {
 assert((SrcEltTy->isFloatingPointTy() ||
@@ -2219,7 +2219,7 @@
 llvm::Type *DstTy = ConvertType(DestTy);
 Value *Elt = Visit(const_cast(E));
 // Splat the element across to all elements
-unsigned NumElements = DstTy->getVectorNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Elt, "splat");
   }
 
@@ -4545,7 +4545,8 @@
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-  auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+  auto Vec4Ty = llvm::VectorType::get(
+  cast(DstTy)->getElementType(), 4);
   Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
  Vec4Ty);
 }
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ 

[PATCH] D77236: [SVE] Cleanup prior to introdution of FixedVectorType

2020-04-01 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 254327.
ctetreau added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Split commit up into multiple smaller commits:

1 commit per llvm library, 1 for clang, and 1 for mlir. Plus one final commit 
to remove the functions from Type


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77236/new/

https://reviews.llvm.org/D77236

Files:
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/IR/Type.cpp


Index: llvm/lib/IR/Type.cpp
===
--- llvm/lib/IR/Type.cpp
+++ llvm/lib/IR/Type.cpp
@@ -149,6 +149,12 @@
   return -1;
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 bool Type::isSizedDerivedType(SmallPtrSetImpl *Visited) const {
   if (auto *ATy = dyn_cast(this))
 return ATy->getElementType()->isSized(Visited);
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -304,11 +304,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  Type *getScalarType() const;
 
   
//======//
   // Type Iteration support.
@@ -343,8 +339,8 @@
 
   
//======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" 
(for
-  // example) is shorthand for cast(Ty)->getNumElements().  This is
+  // the specified subclass and calls its accessor.  "getArrayNumElements" (for
+  // example) is shorthand for cast(Ty)->getNumElements().  This is
   // only intended to cover the core methods that are frequently used, helper
   // methods should not be added here.
 
@@ -370,14 +366,6 @@
 return ContainedTys[0];
   }
 
-  inline bool getVectorIsScalable() const;
-  inline unsigned getVectorNumElements() const;
-  inline ElementCount getVectorElementCount() const;
-  Type *getVectorElementType() const {
-assert(getTypeID() == VectorTyID);
-return ContainedTys[0];
-  }
-
   Type *getPointerElementType() const {
 assert(getTypeID() == PointerTyID);
 return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -546,18 +546,6 @@
   }
 };
 
-unsigned Type::getVectorNumElements() const {
-  return cast(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
-  return cast(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
-  return cast(this)->getElementCount();
-}
-
 /// Class to represent pointers.
 class PointerType : public Type {
   explicit PointerType(Type *ElType, unsigned AddrSpace);
@@ -610,8 +598,8 @@
   isIntOrIntVectorTy() &&
   "Original type expected to be a vector of integers or a scalar 
integer.");
   Type *NewType = getIntNTy(getContext(), NewBitWidth);
-  if (isVectorTy())
-NewType = VectorType::get(NewType, getVectorElementCount());
+  if (auto *VTy = dyn_cast(this))
+NewType = VectorType::get(NewType, VTy->getElementCount());
   return NewType;
 }
 


Index: llvm/lib/IR/Type.cpp
===
--- llvm/lib/IR/Type.cpp
+++ llvm/lib/IR/Type.cpp
@@ -149,6 +149,12 @@
   return -1;
 }
 
+Type *Type::getScalarType() const {
+  if (isVectorTy())
+return cast(this)->getElementType();
+  return const_cast(this);
+}
+
 bool Type::isSizedDerivedType(SmallPtrSetImpl *Visited) const {
   if (auto *ATy = dyn_cast(this))
 return ATy->getElementType()->isSized(Visited);
Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -304,11 +304,7 @@
 
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
-  Type *getScalarType() const {
-if (isVectorTy())
-  return getVectorElementType();
-return const_cast(this);
-  }
+  Type *getScalarType() const;
 
   //======//
   // Type Iteration support.
@@ -343,8 +339,8 @@
 
   //======//
   // Helper methods corresponding to subclass methods.  This forces a cast to
-  // the specified subclass and calls its accessor.  "getVectorNumElements" (for
-  // example) is shorthand for cast(Ty)->getNumElements().  This 

[PATCH] D77236: [SVE] Cleanup prior to introdution of FixedVectorType

2020-04-01 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

> 1. This is orthogonal to splitting VectorType, as far as I can tell.  
> `Ty->getVectorNumElements()` works equally well whether the implementation 
> asserts it's a VectorType that isn't scalable, or asserts it's a 
> FixedVectorType.

While it's not strictly neccesary, the refactor will be more straightforward 
with this change. Before, we would have:

  unsigned n = t->getVectorNumElements();

After the VectorTypes refactor, if t is not a FixedLengthVector, then this code 
will still compile but fail at runtime. However with:

  unsigned n = cast(t)->getNumElements();

... it will be a compile time failure.

Realistically, it would need to be at least renamed to 
getFixedVectorNumElements anyways to avoid confusion.

> 2. This needs to be split up; it's way too long to read, and it's mixing 
> functional and non-functional changes.

I can split it up into a few chunks that make the corrections a bit at a time, 
then a final change to get rid of the functions

> 3. It might make sense to add helpers to remove the use of cast<> in more 
> places. For example, the inputs of a shufflevector are guaranteed to be 
> vectors.

It seems to me that we use base Type for basically everything when we could use 
concrete subclasses. As you can see in my patch, I fixed a few, but ideally 
functions would just return a VectorType if they have a VectorType. The issue 
is pervasive, and is enabled by the existence of these functions. This is a 
deep rabbit hole that I don't really want to go down in this patch.

> 4. Some of the changes are leading to really crazy indentation because the 
> `cast<>` is more characters.

While I agree, there's not much we can do about that. Really, the problem is 
that we have these crazy complicated if statements that check 15 things at once.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77236/new/

https://reviews.llvm.org/D77236



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


[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-03-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: mlir/lib/Target/LLVMIR/ModuleTranslation.cpp:81
 static llvm::Type *getInnermostElementType(llvm::Type *type) {
-  while (isa(type))
-type = type->getSequentialElementType();
-  return type;
+  do {
+if (auto *arrayTy = dyn_cast(type)) {

Readability: This works, but is a little strange. I'd rewrite:

```
static llvm::Type *getInnermostElementType(llvm::Type *type) {
  while (isa(type) || isa(type)) {
if (auto *arrayTy = dyn_cast(type))
  type = arrayTy->getElementType();
else
  type = cast(type)->getElementType();
  }
  return type;
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-03-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

I'd like the see the clang-format complaints actually addressed, but don't 
bother unless you need to upload another patch for some other reason anyways.

That aside, LGTM. This has been looked at by 3 people (plus yourself). So far, 
nobody has had any serious objections. Perhaps enough has been enough?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-03-20 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: clang/lib/CodeGen/CGDecl.cpp:1078
   }
+  // FIXME: Do we need to handle tail padding in vectors?
   return constant;

efriedma wrote:
> ctetreau wrote:
> > The fact that you have to ask this question tells me that you should 
> > probably just make this handle vectors.
> > 
> > You could add a templated helper function above this function that is 
> > basically just the original body of the SequentialType branch.
> Well, no, the original code doesn't handle vectors either.  The issue here 
> would be that we need to pad out the vector with additional elements, or 
> something like that.
At a cursory glance, it seemed to me that the addition of this comment implied 
that it used to handle the tail padding. However, after having dug into what 
this function does, assuming that vectors only ever actually contain scalars, 
then it seems that this does currently just return the original vector and that 
this patch does not change the behavior.

Given this, your comment really kind of just says "FIXME: is this function 
correct?", a question that applies to basically every function. If you have 
reason to believe that the answer to your question is yes, you should probably 
add why you think so to this comment. Otherwise, I think you should remove it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-03-20 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.
Herald added a reviewer: aartbik.



Comment at: clang/lib/CodeGen/CGDecl.cpp:1059
+llvm::Type *ElemTy = ArrayTy->getElementType();
+bool ZeroInitializer = constant->isNullValue();
 llvm::Constant *OpValue, *PaddedOp;

I assume the reasoning here is that [-0.0f, ...] isn't the zero initialized 
value, but why make this change now? Seems unrelated.



Comment at: clang/lib/CodeGen/CGDecl.cpp:1078
   }
+  // FIXME: Do we need to handle tail padding in vectors?
   return constant;

The fact that you have to ask this question tells me that you should probably 
just make this handle vectors.

You could add a templated helper function above this function that is basically 
just the original body of the SequentialType branch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D75661: Remove SequentialType from the type heirarchy.

2020-03-18 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added a comment.

> I'm concerned though about having getSequentialElementType and 
> getSequentialNumElements apply to different sets of types. That's bound to 
> lead to confusion which causes bugs. Can we have one name for all types that 
> are homogenous sequences of the same element type, and a different name for 
> all types which are *fixed-length* homogenous sequences?

isSequentialType() returns true for VectorType and ArrayType. It should be 
changed to only return true if the vector type is not scalable, and 
getSequentialNumElements() should assert isSequentialType() before attempting 
the casts.

In the future, when my proposed FixedVectorType is added, isSequentialType will 
return true for ArrayType and FixedVectorType only.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75661/new/

https://reviews.llvm.org/D75661



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


[PATCH] D75486: [SVE] Make CompositeType not inherit from Type

2020-03-03 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau updated this revision to Diff 248050.
ctetreau added a comment.

Cleaned up code, resolved clang-format lints


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75486/new/

https://reviews.llvm.org/D75486

Files:
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/unittests/CodeGen/CodeGenExternalTest.cpp
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/GetElementPtrTypeIterator.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/Analysis.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/FuzzMutate/Operations.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/IPO/StripSymbols.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3130,7 +3130,7 @@
   unsigned N = 1;
   Type *EltTy = T;
 
-  while (isa(EltTy)) {
+  while (CompositeType::is(EltTy)) {
 if (auto *ST = dyn_cast(EltTy)) {
   // Check that struct is homogeneous.
   for (const auto *Ty : ST->elements())
@@ -3139,7 +3139,7 @@
   N *= ST->getNumElements();
   EltTy = *ST->element_begin();
 } else {
-  auto *SeqT = cast(EltTy);
+  auto *SeqT = cast(CompositeType::get(EltTy));
   N *= SeqT->getNumElements();
   EltTy = SeqT->getElementType();
 }
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -478,8 +478,8 @@
 
   case Type::ArrayTyID:
   case Type::VectorTyID: {
-auto *STyL = cast(TyL);
-auto *STyR = cast(TyR);
+auto *STyL = cast(CompositeType::get(TyL));
+auto *STyR = cast(CompositeType::get(TyR));
 if (STyL->getNumElements() != STyR->getNumElements())
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
Index: llvm/lib/Transforms/Scalar/SROA.cpp
===
--- llvm/lib/Transforms/Scalar/SROA.cpp
+++ llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3511,7 +3511,8 @@
   (DL.getTypeAllocSize(Ty) - Offset) < Size)
 return nullptr;
 
-  if (SequentialType *SeqTy = dyn_cast(Ty)) {
+  if (SequentialType *SeqTy =
+  dyn_cast_or_null(CompositeType::get(Ty, false))) {
 Type *ElementTy = SeqTy->getElementType();
 uint64_t ElementSize = DL.getTypeAllocSize(ElementTy);
 uint64_t NumSkippedElements = Offset / ElementSize;
Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1934,7 +1934,7 @@
 if (J > 0) {
   if (J == 1) {
 CurTy = Op1->getSourceElementType();
-  } else if (auto *CT = dyn_cast(CurTy)) {
+  } else if (auto *CT = CompositeType::get(CurTy, false)) {
 CurTy = CT->getTypeAtIndex(Op1->getOperand(J));
   } else {
 CurTy = nullptr;
Index: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2427,10 +2427,10 @@
 // to a getelementptr X, 0, 0, 0...  turn it into the appropriate gep.
 // This can enhance SROA and other transforms that want type-safe pointers.
 unsigned NumZeros = 0;
-while (SrcElTy != DstElTy &&
-   isa(SrcElTy) && !SrcElTy->isPointerTy() &&
+while (SrcElTy != DstElTy && CompositeType::is(SrcElTy) &&
+   !SrcElTy->isPointerTy() &&
SrcElTy->getNumContainedTypes() /* not "{}" */) {
-  SrcElTy = cast(SrcElTy)->getTypeAtIndex(0U);
+  SrcElTy = CompositeType::get(SrcElTy)->getTypeAtIndex(0U);
   ++NumZeros;
 }
 
Index: llvm/lib/Transforms/IPO/StripSymbols.cpp

[PATCH] D75486: [SVE] Make CompositeType not inherit from Type

2020-03-02 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: llvm-commits, cfe-commits, kerbowa, psnobl, rkruppe, 
hiraditya, tschuett, nhaehnle, jvesely, arsenm.
Herald added a reviewer: efriedma.
Herald added projects: clang, LLVM.

This patch is a work in progress

Make CompositeType not inherit from Type. Instead, Vecotr, Array, and
Struct Types directly inherit from Type. This is in preparation for the
introduction of distinct Fixed and Scalable Vector Types


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75486

Files:
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/unittests/CodeGen/CodeGenExternalTest.cpp
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/IR/GetElementPtrTypeIterator.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/Analysis.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/FuzzMutate/Operations.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/IPO/StripSymbols.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3130,7 +3130,7 @@
   unsigned N = 1;
   Type *EltTy = T;
 
-  while (isa(EltTy)) {
+  while (CompositeType::is(EltTy)) {
 if (auto *ST = dyn_cast(EltTy)) {
   // Check that struct is homogeneous.
   for (const auto *Ty : ST->elements())
@@ -3139,7 +3139,7 @@
   N *= ST->getNumElements();
   EltTy = *ST->element_begin();
 } else {
-  auto *SeqT = cast(EltTy);
+  auto *SeqT = cast(CompositeType::get(EltTy));
   N *= SeqT->getNumElements();
   EltTy = SeqT->getElementType();
 }
Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp
===
--- llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -478,8 +478,8 @@
 
   case Type::ArrayTyID:
   case Type::VectorTyID: {
-auto *STyL = cast(TyL);
-auto *STyR = cast(TyR);
+auto *STyL = cast(CompositeType::get(TyL));
+auto *STyR = cast(CompositeType::get(TyR));
 if (STyL->getNumElements() != STyR->getNumElements())
   return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
 return cmpTypes(STyL->getElementType(), STyR->getElementType());
Index: llvm/lib/Transforms/Scalar/SROA.cpp
===
--- llvm/lib/Transforms/Scalar/SROA.cpp
+++ llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3511,7 +3511,8 @@
   (DL.getTypeAllocSize(Ty) - Offset) < Size)
 return nullptr;
 
-  if (SequentialType *SeqTy = dyn_cast(Ty)) {
+  if (SequentialType *SeqTy = dyn_cast_or_null(
+  CompositeType::get(Ty, CompositeType::is(Ty {
 Type *ElementTy = SeqTy->getElementType();
 uint64_t ElementSize = DL.getTypeAllocSize(ElementTy);
 uint64_t NumSkippedElements = Offset / ElementSize;
Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1934,7 +1934,8 @@
 if (J > 0) {
   if (J == 1) {
 CurTy = Op1->getSourceElementType();
-  } else if (auto *CT = dyn_cast(CurTy)) {
+  } else if (auto *CT =
+ CompositeType::get(CurTy, CompositeType::is(CurTy))) {
 CurTy = CT->getTypeAtIndex(Op1->getOperand(J));
   } else {
 CurTy = nullptr;
Index: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2428,9 +2428,9 @@
 // This can enhance SROA and other transforms that want type-safe pointers.
 unsigned NumZeros = 0;
 while (SrcElTy != DstElTy &&
-   isa(SrcElTy) && !SrcElTy->isPointerTy() &&
+   CompositeType::is(SrcElTy) && !SrcElTy->isPointerTy() &&

[PATCH] D75370: [test] Fix flang test failures due to not handling .exe

2020-02-28 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, DavidTruby.
Herald added a project: clang.
ctetreau added reviewers: efriedma, rsmith, peterwaller-arm.

- Update flang tests to account for the fact that the binary is called 
flang.exe on windows


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75370

Files:
  clang/test/Driver/flang/flang.f90
  clang/test/Driver/flang/flang_ucase.F90
  clang/test/Driver/flang/multiple-inputs.f90


Index: clang/test/Driver/flang/multiple-inputs.f90
===
--- clang/test/Driver/flang/multiple-inputs.f90
+++ clang/test/Driver/flang/multiple-inputs.f90
@@ -1,7 +1,7 @@
 ! Check that flang driver can handle multiple inputs at once.
 
 ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 
%S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
-! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
-! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90"
Index: clang/test/Driver/flang/flang_ucase.F90
===
--- clang/test/Driver/flang/flang_ucase.F90
+++ clang/test/Driver/flang/flang_ucase.F90
@@ -13,7 +13,7 @@
 ! * (no type specified, resulting in an object file)
 
 ! All invocations should begin with flang -fc1, consume up to here.
-! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
+! ALL-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 
 ! Check that f90 files are not treated as "previously preprocessed"
 ! ... in --driver-mode=flang.
Index: clang/test/Driver/flang/flang.f90
===
--- clang/test/Driver/flang/flang.f90
+++ clang/test/Driver/flang/flang.f90
@@ -13,7 +13,7 @@
 ! * (no type specified, resulting in an object file)
 
 ! All invocations should begin with flang -fc1, consume up to here.
-! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
+! ALL-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 
 ! Check that f90 files are not treated as "previously preprocessed"
 ! ... in --driver-mode=flang.


Index: clang/test/Driver/flang/multiple-inputs.f90
===
--- clang/test/Driver/flang/multiple-inputs.f90
+++ clang/test/Driver/flang/multiple-inputs.f90
@@ -1,7 +1,7 @@
 ! Check that flang driver can handle multiple inputs at once.
 
 ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
-! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
-! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90"
Index: clang/test/Driver/flang/flang_ucase.F90
===
--- clang/test/Driver/flang/flang_ucase.F90
+++ clang/test/Driver/flang/flang_ucase.F90
@@ -13,7 +13,7 @@
 ! * (no type specified, resulting in an object file)
 
 ! All invocations should begin with flang -fc1, consume up to here.
-! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
+! ALL-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 
 ! Check that f90 files are not treated as "previously preprocessed"
 ! ... in --driver-mode=flang.
Index: clang/test/Driver/flang/flang.f90
===
--- clang/test/Driver/flang/flang.f90
+++ clang/test/Driver/flang/flang.f90
@@ -13,7 +13,7 @@
 ! * (no type specified, resulting in an object file)
 
 ! All invocations should begin with flang -fc1, consume up to here.
-! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
+! ALL-LABEL: "{{[^"]*}}flang{{(.exe)?}}" "-fc1"
 
 ! Check that f90 files are not treated as "previously preprocessed"
 ! ... in --driver-mode=flang.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72467: Remove "mask" operand from shufflevector.

2020-01-24 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: llvm/lib/IR/ConstantsContext.h:153
cast(C1->getType())->getElementType(),
-   cast(C3->getType())->getElementCount()),
+   Mask.size(), C1->getType()->getVectorIsScalable()),
  Instruction::ShuffleVector,

sdesmalen wrote:
> The number of elements in the result matches the number of elements in the 
> mask, but if we assume 'scalable' from one of the source vectors, this means 
> we make the choice that we cannot extract a fixed-width vector from a 
> scalable vector, e.g.
> 
>   shufflevector( %in,  undef, <4 x i32> 
> )
> 
> The LangRef does not explicitly call out this case (and it currently fails to 
> compile), but it would provide a way to extract a sub-vector from a scalable 
> vector.
> If we want to allow this, we'd also need to decide what the meaning would be 
> of:
> 
>   shufflevector( %in,  undef, <4 x i32> 
> )
> 
> which may not be valid if `vscale = 1`.
> 
> Alternatively, we could implement this with an additional extract intrinsic 
> and add the restriction that if the source values are scalable, the mask must 
> be scalable as well. If so, then we should update the LangRef to explicitly 
> disallow the above case.
For the time being, Either this assumption must hold, or a bool must be added 
that is true if the mask is from a scalable vector.

There are places in the codebase that assume that the mask has a concrete value 
known at compile time. These sites are currently the sites of bugs, and the fix 
is to not try to access the mask if the vector is scalable. We need some way of 
knowing that the mask is scalable, either by the assumption made here, or a 
queryable bool value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72467/new/

https://reviews.llvm.org/D72467



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


[PATCH] D72467: Remove "mask" operand from shufflevector.

2020-01-23 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau added inline comments.



Comment at: llvm/include/llvm/IR/IRBuilder.h:2544
+SmallVector IntMask;
+ShuffleVectorInst::getShuffleMask(cast(Mask), IntMask);
+return CreateShuffleVector(V1, V2, IntMask, Name);

spatel wrote:
> Add an assert that Mask isa ?
cast already does this assert.



Comment at: llvm/include/llvm/IR/IRBuilder.h:2551
+SmallVector IntMask;
+IntMask.assign(Mask.begin(), Mask.end());
+return CreateShuffleVector(V1, V2, IntMask, Name);

[0 .. uint32_MAX] is wider than [0 .. int_MAX]. Assert the values are in range 
somehow?



Comment at: llvm/include/llvm/IR/Instructions.h:1985-1986
 ///
+/// The shuffle mask operand specifies, for each element of the result vector,
+/// which element of the two input vectors the result element gets. The
+/// shuffle mask is represented as an array of integers. Positive integers

spatel wrote:
> This reads awkwardly to me (if you agree, we can update the LangRef too). 
> How about:
> "For each element of the result vector, the shuffle mask selects an element 
> from one of the input vectors to copy to the result. Non-negative elements in 
> the mask represent an index into the concatenated pair of input vectors. 
> UndefMaskElem (-1) specifies that the result element is undefined."
I also found the wording of the description of shufflevector in the language 
ref confusing. Since this description seems to be related I thought it worth 
mentioning.

It's unclear to me how the values specify vector inputs. I assume for two 
vectors <4 x 18>, that the mask <3, 4, 5, 6> takes the last element of the 
first vector, and the first three elements of the second vector, but this isn't 
explicitly stated anywhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72467/new/

https://reviews.llvm.org/D72467



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


[PATCH] D68882: [test] Fix test failure

2019-10-11 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The version mismatch symbol is version 9 on 32 bit android. Since
this test isn't actually testing any android specific functionality,
we force the target triple to x86_64-unknown-unknown in order to have
a consistent version number. It seems the test was already trying to
do this, just not doing it right


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68882

Files:
  clang/test/CodeGen/asan-new-pm.ll


Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,10 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-
-target triple = "x86_64-unknown-unknown"
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
 
 ; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
 


Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,10 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-
-target triple = "x86_64-unknown-unknown"
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager