[PATCH] D71208: CodeGen: Allow annotations on globals in non-zero address space

2019-12-10 Thread Nicolai Hähnle via Phabricator via cfe-commits
nhaehnle added a comment.

> My concern is that there's something that's going to blow up or miscompile if 
> we start passing in constants that aren't in a regular address space.  Aren't 
> there kinds of annotations which get persisted into the emitted code?

Annotations don't seem to be used for much at the moment in the first place. 
They're definitely not emitted in the resulting binary by default. Also, the 
only testcase in LLVM proper that has @llvm.global.annotations also happens to 
have addrspacecasts in there, so at least at some point in the past somebody 
thought it's okay to allow those casts there.

Also: what's the alternative?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71208



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71082: Allow system header to provide their own implementation of some builtin

2019-12-10 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Validation OK: https://github.com/serge-sans-paille/llvm-project/pull/4/checks




Comment at: clang/lib/AST/Decl.cpp:3006
 
+bool FunctionDecl::isReplaceableSystemFunction() const {
+  FunctionDecl const *Definition;

Note to reviewers: I'm not super happy with that name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71082



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


[PATCH] D70245: [OPENMP50]Add device/kind context selector support.

2019-12-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70245



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


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, 
gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim.
Herald added subscribers: s.egerton, guansong, bollu, simoncook, fedor.sergeev, 
aheejin, rampitec, jholewinski.
Herald added a project: clang.

Instead of going through a custom overload resolution twice, we can use
the existing one.

TODO:

  The tests need updating, they checked for functions that shouldn't
have been emitted and the way they check is hard to update.
  There is a TODO in the code we need to fix (see below).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71241

Files:
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/OpenMP/declare_variant_ast_print.cpp
  clang/test/OpenMP/declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp
  clang/test/OpenMP/declare_variant_mixed_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_implementation_vendor_codegen.cpp

Index: clang/test/OpenMP/nvptx_declare_variant_implementation_vendor_codegen.cpp
===
--- clang/test/OpenMP/nvptx_declare_variant_implementation_vendor_codegen.cpp
+++ clang/test/OpenMP/nvptx_declare_variant_implementation_vendor_codegen.cpp
@@ -8,31 +8,20 @@
 // CHECK-DAG: define {{.*}}i32 @_Z3barv()
 // CHECK-DAG: define {{.*}}i32 @_ZN16SpecSpecialFuncs6MethodEv(%struct.SpecSpecialFuncs* %{{.+}})
 // CHECK-DAG: define {{.*}}i32 @_ZN12SpecialFuncs6MethodEv(%struct.SpecialFuncs* %{{.+}})
-// CHECK-DAG: define linkonce_odr {{.*}}i32 @_ZN16SpecSpecialFuncs6methodEv(%struct.SpecSpecialFuncs* %{{.+}})
-// CHECK-DAG: define linkonce_odr {{.*}}i32 @_ZN12SpecialFuncs6methodEv(%struct.SpecialFuncs* %{{.+}})
 // CHECK-DAG: define {{.*}}i32 @_Z5prio_v()
-// CHECK-DAG: define internal i32 @_ZL6prio1_v()
 // CHECK-DAG: define {{.*}}i32 @_Z4callv()
-// CHECK-DAG: define internal i32 @_ZL9stat_usedv()
 // CHECK-DAG: define {{.*}}i32 @fn_linkage()
 // CHECK-DAG: define {{.*}}i32 @_Z11fn_linkage1v()
 
 // CHECK-DAG: ret i32 2
 // CHECK-DAG: ret i32 3
-// CHECK-DAG: ret i32 4
-// CHECK-DAG: ret i32 5
 // CHECK-DAG: ret i32 6
 // CHECK-DAG: ret i32 7
-// CHECK-DAG: ret i32 82
 // CHECK-DAG: ret i32 83
-// CHECK-DAG: ret i32 85
-// CHECK-DAG: ret i32 86
 // CHECK-DAG: ret i32 87
 
 // Outputs for function members
-// CHECK-DAG: ret i32 6
-// CHECK-DAG: ret i32 7
-// CHECK-NOT: ret i32 {{1|81|84}}
+// CHECK-NOT: ret i32 {{81|84}}
 
 #ifndef HEADER
 #define HEADER
Index: clang/test/OpenMP/nvptx_declare_variant_device_kind_codegen.cpp
===
--- clang/test/OpenMP/nvptx_declare_variant_device_kind_codegen.cpp
+++ clang/test/OpenMP/nvptx_declare_variant_device_kind_codegen.cpp
@@ -13,31 +13,20 @@
 // CHECK-DAG: define {{.*}}i32 @_Z3barv()
 // CHECK-DAG: define {{.*}}i32 @_ZN16SpecSpecialFuncs6MethodEv(%struct.SpecSpecialFuncs* %{{.+}})
 // CHECK-DAG: define {{.*}}i32 @_ZN12SpecialFuncs6MethodEv(%struct.SpecialFuncs* %{{.+}})
-// CHECK-DAG: define linkonce_odr {{.*}}i32 @_ZN16SpecSpecialFuncs6methodEv(%struct.SpecSpecialFuncs* %{{.+}})
-// CHECK-DAG: define linkonce_odr {{.*}}i32 @_ZN12SpecialFuncs6methodEv(%struct.SpecialFuncs* %{{.+}})
 // CHECK-DAG: define {{.*}}i32 @_Z5prio_v()
-// CHECK-DAG: define internal i32 @_ZL6prio1_v()
 // CHECK-DAG: define {{.*}}i32 @_Z4callv()
-// CHECK-DAG: define internal i32 @_ZL9stat_usedv()
 // CHECK-DAG: define {{.*}}i32 @fn_linkage()
 // CHECK-DAG: define {{.*}}i32 @_Z11fn_linkage1v()
 
 // CHECK-DAG: ret i32 2
 // CHECK-DAG: ret i32 3
-// CHECK-DAG: ret i32 4
-// CHECK-DAG: ret i32 5
 // CHECK-DAG: ret i32 6
 // CHECK-DAG: ret i32 7
-// CHECK-DAG: ret i32 82
 // CHECK-DAG: ret i32 83
-// CHECK-DAG: ret i32 85
-// CHECK-DAG: ret i32 86
 // CHECK-DAG: ret i32 87
 
 // Outputs for function members
-// CHECK-DAG: ret i32 6
-// CHECK-DAG: ret i32 7
-// CHECK-NOT: ret i32 {{1|81|84}}
+// CHECK-NOT: ret i32 {{81|84}}
 
 #ifndef HEADER
 #define HEADER
Index: clang/test/OpenMP/declare_variant_mixed_codegen.cpp
===
--- clang/test/OpenMP/declare_variant_mixed_codegen.cpp
+++ clang/test/OpenMP/declare_variant_mixed_codegen.cpp
@@ -4,19 +4,8 @@
 // expected-no-diagnostics
 
 // CHECK-NOT: ret i32 {{1|4|81|84}}
-// CHECK-DAG: @_Z3barv = {{.*}}alias i32 (), i32 ()* @_Z3foov
-// C

[PATCH] D71179: [OpenMP][WIP] Initial support for `begin/end declare variant`

2019-12-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

So, D71241  shows how declare variant (5.0) 
would look like if we implement it through SemaLookup. I will actually revisit 
this patch tomorrow as I might be able to make it even simpler. (D71241 
 is saving ~250 lines and from what I've seen 
in the tests actually fixing things.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71179



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


[PATCH] D71016: [SYCL] Implement OpenCL kernel function generation

2019-12-10 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon updated this revision to Diff 233013.
Fznamznon added a comment.

Updated tests using address space attributes added by D71005 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71016

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Parse/ParseAST.cpp
  clang/lib/Sema/CMakeLists.txt
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGenSYCL/Inputs/sycl.hpp
  clang/test/CodeGenSYCL/basic-opencl-kernel.cpp
  clang/test/CodeGenSYCL/device-functions.cpp
  clang/test/SemaSYCL/Inputs/sycl.hpp
  clang/test/SemaSYCL/accessors-targets.cpp
  clang/test/SemaSYCL/basic-opencl-kernel.cpp
  clang/test/SemaSYCL/built-in-type-kernel-arg.cpp
  clang/test/SemaSYCL/fake-accessors.cpp
  clang/test/SemaSYCL/mangle-kernel.cpp

Index: clang/test/SemaSYCL/mangle-kernel.cpp
===
--- /dev/null
+++ clang/test/SemaSYCL/mangle-kernel.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -triple spir64-unknown-unknown-unknown -I %S/Inputs -I %S/../Headers/Inputs/include/ -fsycl-is-device -ast-dump %s | FileCheck %s --check-prefix=CHECK-64
+// RUN: %clang_cc1 -triple spir-unknown-unknown-unknown -I %S/Inputs -I %S/../Headers/Inputs/include/ -fsycl-is-device -ast-dump %s | FileCheck %s --check-prefix=CHECK-32
+#include 
+#include 
+
+template 
+__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
+  kernelFunc();
+}
+
+template 
+class SimpleVadd;
+
+int main() {
+  kernel>(
+  [=](){});
+
+  kernel>(
+  [=](){});
+
+  kernel>(
+  [=](){});
+  return 0;
+}
+
+// CHECK: _ZTS10SimpleVaddIiE
+// CHECK: _ZTS10SimpleVaddIdE
+// CHECK-64: _ZTS10SimpleVaddImE
+// CHECK-32: _ZTS10SimpleVaddIjE
Index: clang/test/SemaSYCL/fake-accessors.cpp
===
--- /dev/null
+++ clang/test/SemaSYCL/fake-accessors.cpp
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -I %S/Inputs -fsycl-is-device -ast-dump %s | FileCheck %s
+
+#include 
+
+namespace foo {
+namespace cl {
+namespace sycl {
+class accessor {
+public:
+  int field;
+};
+} // namespace sycl
+} // namespace cl
+} // namespace foo
+
+class accessor {
+public:
+  int field;
+};
+
+typedef cl::sycl::accessor
+MyAccessorTD;
+
+using MyAccessorA = cl::sycl::accessor;
+
+template 
+__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
+  kernelFunc();
+}
+
+int main() {
+  foo::cl::sycl::accessor acc = {1};
+  accessor acc1 = {1};
+
+  cl::sycl::accessor accessorA;
+  cl::sycl::accessor accessorB;
+  cl::sycl::accessor accessorC;
+kernel(
+[=]() {
+  accessorA.use((void*)(acc.field + acc1.field));
+});
+kernel(
+[=]() {
+  accessorB.use((void*)(acc.field + acc1.field));
+});
+kernel(
+[=]() {
+  accessorC.use((void*)(acc.field + acc1.field));
+});
+  return 0;
+}
+// CHECK: fake_accessors 'void (__global int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>, foo::cl::sycl::accessor, accessor)
+// CHECK: accessor_typedef 'void (__global int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>, foo::cl::sycl::accessor, accessor)
+// CHECK: accessor_alias 'void (__global int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>, foo::cl::sycl::accessor, accessor)
Index: clang/test/SemaSYCL/built-in-type-kernel-arg.cpp
===
--- /dev/null
+++ clang/test/SemaSYCL/built-in-type-kernel-arg.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -I %S/Inputs -fsycl-is-device -ast-dump %s | FileCheck %s
+
+// This test checks that compiler generates correct initialization for arguments
+// that have struct or built-in type inside the OpenCL kernel
+
+#include 
+
+template 
+__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
+  kernelFunc();
+}
+
+struct test_struct {
+  int data;
+};
+
+void test(const int some_const) {
+  kernel(
+  [=]() {
+int a = some_const;
+  });
+}
+
+int main() {
+  int data = 5;
+  test_struct s;
+  s.data = data;
+  kernel(
+  [=]() {
+int kernel_data = data;
+  });
+  kernel(
+  [=]() {
+test_struct k_s;
+k_s = s;
+  });
+  const int some_const = 10;
+  test(some_const);
+  return 0;
+}
+// Check kernel parameters
+// CHECK: FunctionDecl {{.*}}kernel_const{{.*}} 'void (const int)'
+// CHECK: ParmVarDecl {{.*}} used _arg_ 'const int'
+
+// Check that lambda field of const built-in type is initialized
+// CHECK: VarDecl {{.*}}'(lambda at {{.*}}built-in-type-kernel-arg.cpp{{.*}})'
+// CHECK-NEXT: InitListExpr
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' 
+// CHECK-NEXT: DeclRefExpr {{.*}} 'const int' lvalue ParmVar {{.*}} '_arg_' 'const int'
+
+// Check kernel parameters
+// CHECK: {{.*}}kernel_int{{.*}} 'void (

Re: [PATCH] D71186: Reland "[AST] Traverse the class type loc inside the member type loc.""

2019-12-10 Thread Yvan Roux via cfe-commits
Hi Haojian,

AArch64 bots are broken after this commit, logs are available here:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/21125/steps/ninja%20check%201/logs/stdio

Thanks
Yvan

On Mon, 9 Dec 2019 at 11:30, pre-merge checks [bot] via Phabricator
via cfe-commits  wrote:
>
> merge_guards_bot added a comment.
>
> Build result: pass - 60555 tests passed, 0 failed and 726 were skipped.
>
> Log files: console-log.txt 
> ,
>  CMakeCache.txt 
> 
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D71186/new/
>
> https://reviews.llvm.org/D71186
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] b63c35e - [clangd] Simplify code using findName. NFC

2019-12-10 Thread Ilya Biryukov via cfe-commits

Author: Ilya Biryukov
Date: 2019-12-10T10:22:43+01:00
New Revision: b63c35ebf76ca0ac89405aeadee2b98a0e91e05e

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

LOG: [clangd] Simplify code using findName. NFC

`findName` was always used in conjuction with `spellingLocIfSpelled`.
This patch replaces patterns of the form:
  spellingLocIfSpelled(findName(&ND), SM)

With a new helper function:
  nameLocation(ND, SM)

And removes `spellingLocIfSpelled` and `findName`. Both are never used
anywhere else and the latter is an equivalent of `Decl::getLocation` if
we ever need it again.

Added: 


Modified: 
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/AST.h
clang-tools-extra/clangd/FindSymbols.cpp
clang-tools-extra/clangd/SourceCode.cpp
clang-tools-extra/clangd/SourceCode.h
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/index/SymbolCollector.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/AST.cpp 
b/clang-tools-extra/clangd/AST.cpp
index e4d808921c01..65fdecc9e1ae 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -156,7 +156,12 @@ bool isImplementationDetail(const Decl *D) {
 D->getASTContext().getSourceManager());
 }
 
-SourceLocation findName(const clang::Decl *D) { return D->getLocation(); }
+SourceLocation nameLocation(const clang::Decl &D, const SourceManager &SM) {
+  auto L = D.getLocation();
+  if (isSpelledInSource(L, SM))
+return SM.getSpellingLoc(L);
+  return SM.getExpansionLoc(L);
+}
 
 std::string printQualifiedName(const NamedDecl &ND) {
   std::string QName;

diff  --git a/clang-tools-extra/clangd/AST.h b/clang-tools-extra/clangd/AST.h
index bc38f19c6553..a823365e7053 100644
--- a/clang-tools-extra/clangd/AST.h
+++ b/clang-tools-extra/clangd/AST.h
@@ -34,11 +34,11 @@ namespace clangd {
 /// in code is considered implementation detail.
 bool isImplementationDetail(const Decl *D);
 
-/// Find the identifier source location of the given D.
-///
-/// The returned location is usually the spelling location where the name of 
the
-/// decl occurs in the code.
-SourceLocation findName(const clang::Decl *D);
+/// Find the source location of the identifier for \p D.
+/// Transforms macro locations to locations spelled inside files. All code
+/// that needs locations of declaration names (e.g. the index) should go 
through
+/// this function.
+SourceLocation nameLocation(const clang::Decl &D, const SourceManager &SM);
 
 /// Returns the qualified name of ND. The scope doesn't contain unwritten 
scopes
 /// like inline namespaces.

diff  --git a/clang-tools-extra/clangd/FindSymbols.cpp 
b/clang-tools-extra/clangd/FindSymbols.cpp
index 619f1a5cfdbc..4c92c8896b9d 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -131,7 +131,7 @@ namespace {
 llvm::Optional declToSym(ASTContext &Ctx, const NamedDecl &ND) 
{
   auto &SM = Ctx.getSourceManager();
 
-  SourceLocation NameLoc = spellingLocIfSpelled(findName(&ND), SM);
+  SourceLocation NameLoc = nameLocation(ND, SM);
   // getFileLoc is a good choice for us, but we also need to make sure
   // sourceLocToPosition won't switch files, so we call getSpellingLoc on top 
of
   // that to make sure it does not switch files.

diff  --git a/clang-tools-extra/clangd/SourceCode.cpp 
b/clang-tools-extra/clangd/SourceCode.cpp
index b36d11d64a3e..15403d215fc6 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -224,14 +224,6 @@ bool isSpelledInSource(SourceLocation Loc, const 
SourceManager &SM) {
   return true;
 }
 
-SourceLocation spellingLocIfSpelled(SourceLocation Loc,
-const SourceManager &SM) {
-  if (!isSpelledInSource(Loc, SM))
-// Use the expansion location as spelling location is not interesting.
-return SM.getExpansionRange(Loc).getBegin();
-  return SM.getSpellingLoc(Loc);
-}
-
 llvm::Optional getTokenRange(const SourceManager &SM,
 const LangOptions &LangOpts,
 SourceLocation TokLoc) {

diff  --git a/clang-tools-extra/clangd/SourceCode.h 
b/clang-tools-extra/clangd/SourceCode.h
index f75be998dc2d..47fde505c252 100644
--- a/clang-tools-extra/clangd/SourceCode.h
+++ b/clang-tools-extra/clangd/SourceCode.h
@@ -107,12 +107,6 @@ SourceLocation includeHashLoc(FileID IncludedFile, const 
SourceManager &SM);
 /// `-DName=foo`, the spelling location will be "".
 bool isSpelledInSource(SourceLocation Loc, const SourceManager &SM);
 
-/// Returns the spelling location of the token at Loc if isSpelledInSource,
-/// otherwise its expansion location.
-/// FIXME: Most callers likely want some variant of "file

Re: [PATCH] D71186: Reland "[AST] Traverse the class type loc inside the member type loc.""

2019-12-10 Thread Ilya Biryukov via cfe-commits
Ah, some older gcc versions can't handle raw string literals inside macro
arguments.
+Haojian Wu , could you fix this?

On Tue, Dec 10, 2019 at 12:22 PM Yvan Roux  wrote:

> Hi Haojian,
>
> AArch64 bots are broken after this commit, logs are available here:
>
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/21125/steps/ninja%20check%201/logs/stdio
>
> Thanks
> Yvan
>
> On Mon, 9 Dec 2019 at 11:30, pre-merge checks [bot] via Phabricator
> via cfe-commits  wrote:
> >
> > merge_guards_bot added a comment.
> >
> > Build result: pass - 60555 tests passed, 0 failed and 726 were skipped.
> >
> > Log files: console-log.txt <
> http://results.llvm-merge-guard.org/amd64_debian_testing_clang8-368/console-log.txt>,
> CMakeCache.txt <
> http://results.llvm-merge-guard.org/amd64_debian_testing_clang8-368/CMakeCache.txt
> >
> >
> >
> > Repository:
> >   rG LLVM Github Monorepo
> >
> > CHANGES SINCE LAST ACTION
> >   https://reviews.llvm.org/D71186/new/
> >
> > https://reviews.llvm.org/D71186
> >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>


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


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: fail - 60666 tests passed, 1 failed and 726 were skipped.

  failed: Clang.OpenMP/declare_variant_ast_print.cpp

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71241



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


[PATCH] D71179: [OpenMP][WIP] Initial support for `begin/end declare variant`

2019-12-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D71179#1776528 , @hfinkel wrote:

> In D71179#1776491 , @ABataev wrote:
>
> > In D71179#1776487 , @hfinkel wrote:
> >
> > > In D71179#1776467 , @ABataev 
> > > wrote:
> > >
> > > > In D71179#1776457 , @jdoerfert 
> > > > wrote:
> > > >
> > > > > > You're doing absolutely the same thing as the original declare 
> > > > > > variant implementation.
> > > > >
> > > > > I don't think so but if you do why do you oppose this approach?
> > > > >
> > > > > > And I don't think it would be correct to add them as multiversiin 
> > > > > > variants to the original function.
> > > > >
> > > > > Why wouldn't it be correct to pick the version through the overload 
> > > > > resolution instead of the code generation?
> > > > >  How this could work is already described in the TODO 
> > > > > (CodeGenModule.cpp):
> > > > >
> > > > >   // TODO: We should introduce function aliases for `omp declare 
> > > > > variant`
> > > > >   //   directives such that we can treat them through the same 
> > > > > overload
> > > > >   //   resolution scheme (via multi versioning) as `omp begin 
> > > > > declare
> > > > >   //   variant` functions. For an `omp declare variant(VARIANT) 
> > > > > ...`
> > > > >   //   that is attached to a BASE function we would create a 
> > > > > global alias
> > > > >   //   VARIANT = BASE which will participate in the multi version 
> > > > > overload
> > > > >   //   resolution. If picked, here is no need to emit them 
> > > > > explicitly.
> > > > >   
> > > > >
> > > > >
> > > > >
> > > > >  ---
> > > > >
> > > > > I still haven't understood why we cannot/should not reuse the 
> > > > > existing multi-version support and instead duplicate the logic in 
> > > > > some custom scheme.
> > > > >  We have this patch that shows how we can reuse the logic in Clang. 
> > > > > It works on a per-call basis, so it will work for all context 
> > > > > selector (incl. construct).
> > > > >  If you think there is something conceptually not working, I'd like 
> > > > > to hear about it. However, just saying "it wouldn't be correct" is 
> > > > > not sufficient. You need to provide details about the situation, what 
> > > > > you think would not work, and why.
> > > >
> > > >
> > > > I explayned already: declare variant cannot be represented as 
> > > > mutiversion functiin, for example.
> > >
> > >
> > > @ABataev, can you please elaborate? It's not obvious to me that we cannot 
> > > handle the existing declare variant with the same scheme (as @jdoerfert 
> > > highlighted above). In general, I believe it's preferable to have one 
> > > generic scheme and use it to handle all cases as opposed to continuing to 
> > > use a more-limited scheme in addition to the generic scheme.
> >
> >
> > Eaine already. Current version of declare variant cannot be represented as 
> > multiversiin functions, because it is not. We have a function that is the 
> > alias to other functions with different names. They just are not 
> > multiversion functions by definition.
>
>
> I understand that they have different names. I don't see why we that means 
> that they can't be added to the overload set as multi-version candidates if 
> we add logic which does exactly that.


Because this is exactly what I said- you want to reuse the exiwting solution 
for completely different purpose just because you want to you reuse though even 
semantically it has nothing to do with multiversioning. And I think it is bad 
idead to break the semantics of the existing solution. It requires some 
addition changes like merging of different functiins with different names. And 
here I want to ask - why do you think it is better than my proposal to reuse 
the codegen for the already implemented declare variant stuff for the OpenMP  
multiversioned functions? It really requires less work, bdcause you just need 
to add a loop over all varinants and call `tryEmit...` function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71179



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


[PATCH] D69764: [clang-format] Add Left/Right Const (East/West , Before/After) fixer capability

2019-12-10 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

> But I don't know if this can be (easily) supported in a .clang-format file, 
> since the style options are defined as (static) enums. I realize my proposal 
> might be out of the scope of this patch, but I wanted to get some opinions 
> from the community.

just thinking out loud, I think this could be achieved in the config by a list 
of dictionaries

  QualifierStyle:
 -   const: Right
 -   volatile:  Right
 -   __as1: Right
 -   __as2: Right

I think we'd need some ordering information (which is why I was thinking maybe 
having this in a list (so the order of the list defines the left -> right order)

`const __as1 int  foo;` ->   `int const __as1 foo; `

if the order is:

  QualifierStyle:
 -   {  "const":   "Right" }
 -   {  "__as1": "Right" }

but

`const __as1 int foo;`  ->   `int __as1 const foo; `

if the order is

  QualifierStyle:
 -   {  "__as1": "Right" }
 -   {  "const":   "Right" }

I think this would likely make everything much more complicated, but perhaps we 
should think about this for the configuration at least now so we future proof 
ourselves.

  QualifierStyle:
 -   {  "__as1": "Left" }
 -   {  "const":   "Right" }
 -   {  "__as2": "Left" }
 -   {  "volatile":  "Left" }

would give

`const volatile __as1 int foo;`  ->   `__as1 volatile int const foo; `


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

https://reviews.llvm.org/D69764



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


[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Clement Courbet via Phabricator via cfe-commits
courbet added inline comments.



Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:1092
 const DataLayout &DL = F.getParent()->getDataLayout();
-unsigned IntptrAlignment = DL.getABITypeAlignment(MS.IntptrTy);
+Align IntptrAlignment = Align(DL.getABITypeAlignment(MS.IntptrTy));
 unsigned IntptrSize = DL.getTypeStoreSize(MS.IntptrTy);

const ?



Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2910
+const Align Alignment =
+assumeAligned(cast(I.getArgOperand(2))->getZExtValue());
 Value *Mask = I.getArgOperand(3);

how did you infer this ? I'm not sure I can prove that this is nonzero.



Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2940
+const Align Alignment =
+assumeAligned(cast(I.getArgOperand(1))->getZExtValue());
 Value *Mask = I.getArgOperand(2);

ditto



Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3319
 if (ArgOffset + Size > kParamTLSSize) break;
-unsigned ParamAlignment = CS.getParamAlignment(i);
-unsigned Alignment = std::min(ParamAlignment, kShadowTLSAlignment);
+const Align ParamAlignment = assumeAligned(CS.getParamAlignment(i));
+const Align Alignment = std::min(ParamAlignment, kShadowTLSAlignment);

ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71213



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


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

You're merging different functions as multiversiin  variants. I don't think 
this right to overcomplicate the semantics of multiversion functions just 
because you want to do it.




Comment at: clang/lib/Sema/SemaOverload.cpp:9725
+
+  // TODO: Handle template instantiation
+  Best->Function = cast(

Implement all todos and check it with the size of the code where you just need 
to iterate through all the va4iants and call the existing functions to emit 
their aliases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71241



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov updated this revision to Diff 233020.
goncharov added a comment.

more files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197

Files:
  clang/tools/clang-diff/ClangDiff.cpp
  clang/tools/clang-fuzzer/ClangFuzzer.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-  cl::desc("Print the matched nodes."),
-  cl::init(false), cl::cat(ClangDiffCategory));
+static cl::opt PrintMatches("dump-matches", cl::desc("Print the matched 
nodes."), cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt HtmlDiff("html",
-  cl::desc("Output a side-by-side diff in HTML."),
+ cl::desc("Output a side-by-side diff in HTML."),
   cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt SourcePath(cl::Positional, cl::desc(""),
@@ -77,7 +75,9 @@
   std::make_unique(
   std::move(Compilations));
   AdjustingCompilations->appendArgumentsAdjuster(
-  getInsertArgumentAdjuster(ArgsBefore, ArgumentInsertPosition::BEGIN));
+  getInsertArgumentAdjuster(ArgsBefore,
+
+ArgumentInsertPosition::BEGIN));
   AdjustingCompilations->appendArgumentsAdjuster(
   getInsertArgumentAdjuster(ArgsAfter, ArgumentInsertPosition::END));
   Compilations = std::move(AdjustingCompilations);


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-   

[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60624 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71065: [ARM][MVE] Add intrinsics for immediate shifts.

2019-12-10 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 233025.
simon_tatham added a comment.

Changes from previous version:

- minor cleanup: removed check of `hasIntegerConstantValue` in 
`IRBuilderResult::more_prerequisites`, which was causing the generated codegen 
to perofrm a pointless call to `EmitScalarExpr` whose result was thrown away.

- incorporated NEON test failure fix from rG8d70f3c933a5b81a 


- incorporated the `-Winconsistent-missing-override` fix from 
rGff4dceef9201c5ae 


- did not incorporate the `-Wunused-variable` change from rGff4dceef9201c5ae 
 which 
moved a side-effecting function call into an assert statement. Instead fixed it 
with a `(void)IsConst` like all the other call sites.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71065

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vector-shift-imm.c
  clang/utils/TableGen/MveEmitter.cpp
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll
@@ -0,0 +1,398 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve -verify-machineinstrs -o - %s | FileCheck %s
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshlq_n_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshlq_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i8 q0, q0, #5
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshlq_n_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshlq_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i16 q0, q0, #5
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshlq_n_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshlq_n_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i32 q0, q0, #18
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshrq_n_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshrq_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s8 q0, q0, #4
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshrq_n_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshrq_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s16 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshrq_n_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshrq_n_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s32 q0, q0, #19
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshrq_n_u8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshrq_n_u8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u8 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshrq_n_u16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshrq_n_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u16 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshrq_n_u32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshrq_n_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u32 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshlq_m_n_s8(<16 x i8> %inactive, <16 x i8> %a, i16 zeroext %p) {
+; CHECK-LABEL: test_vshlq_m_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmsr p0, r0
+; CHECK-NEXT:vpst
+; CHECK-NEXT:vshlt.i8 q0, q1, #6
+; CHECK-NEXT:bx lr
+entry:
+  %0 = zext i16 %p to i32
+  %1 = tail call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
+  %2 = tail call <16 x i8> @llvm.arm.mve.shl.imm.predicated.v16i8.v16i1(<16 x i8> %a, i32 6, <16 x i1> %1, <16 x i8> %inactive)
+  ret <16 x i8> %2
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshlq_m_n_s16(<8 x i16> %inactive, <8 x i16> %a, i16 zeroext %p) {
+; CHECK-LABEL: test_vshlq_m_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmsr p0, r0
+; CHECK-NEXT:vpst
+; CHECK-NEXT:vshlt.i16 q0, q1, #13
+; CHECK-NEXT:bx lr
+entry:
+  %0 = 

[PATCH] D71065: [ARM][MVE] Add intrinsics for immediate shifts.

2019-12-10 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham reopened this revision.
simon_tatham added a comment.
This revision is now accepted and ready to land.

Reopening to review a revised version of this patch. It was reverted yesterday 
because of a test failure in release builds, which looks like the result of a 
warning fix that moved a side effect into an assert statement.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71065



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


[PATCH] D71245: [ARM][MVE] Refactor complex vector intrinsics [NFCI]

2019-12-10 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: dmgreen, ostannard, simon_tatham, MarkMurrayARM.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, kristof.beyls.
Herald added projects: clang, LLVM.

This patch refactors instruction selection of the complex vector
addition, multiplication and multiply-add intrinsics, so that it is
now based on TableGen patterns rather than C++ code.

It also changes the first parameter (halving vs non-halving) of the
arm_mve_vcaddq IR intrinsic to match the corresponding instruction
encoding, hence it requires some changes in the tests.

The patch addresses David's comment in https://reviews.llvm.org/D71190


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71245

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
  clang/test/CodeGen/arm-mve-intrinsics/vhcaddq.c
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
===
--- llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
@@ -23,7 +23,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 0, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 0, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -33,7 +33,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 0, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 0, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -44,7 +44,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 0, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 0, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -54,7 +54,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 0, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 0, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -64,7 +64,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 0, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 0, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -75,7 +75,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 0, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 0, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -85,7 +85,7 @@
 ; CHECK-NEXT:vcadd.f16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x half> @llvm.arm.mve.vcaddq.v8f16(i32 0, i32 0, <8 x half> %a, <8 x half> %b)
+  %0 = call <8 x half> @llvm.arm.mve.vcaddq.v8f16(i32 1, i32 0, <8 x half> %a, <8 x half> %b)
   ret <8 x half> %0
 }
 
@@ -96,7 +96,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x float> @llvm.arm.mve.vcaddq.v4f32(i32 0, i32 0, <4 x float> %a, <4 x float> %b)
+  %0 = call <4 x float> @llvm.arm.mve.vcaddq.v4f32(i32 1, i32 0, <4 x float> %a, <4 x float> %b)
   ret <4 x float> %0
 }
 
@@ -106,7 +106,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 1, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 1, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -116,7 +116,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 1, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 1, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -127,7 +127,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 1, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 1, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -137,7 +137,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 1, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 1, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -147,7 +147,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
- 

[PATCH] D71065: [ARM][MVE] Add intrinsics for immediate shifts.

2019-12-10 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham added subscribers: rdhindsa, hokein, echristo.
simon_tatham added a comment.

@hokein , @rdhindsa , @echristo : you all pointed out test failures in the 
previous version. Any problems I haven't spotted with this one?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71065



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71245: [ARM][MVE] Refactor complex vector intrinsics [NFCI]

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60668 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71245



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov updated this revision to Diff 233029.
goncharov added a comment.

update clang diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197

Files:
  clang/tools/clang-diff/ClangDiff.cpp
  clang/tools/clang-fuzzer/ClangFuzzer.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-  cl::desc("Print the matched nodes."),
-  cl::init(false), cl::cat(ClangDiffCategory));
+static cl::opt PrintMatches("dump-matches", cl::desc("Print the matched 
nodes."), cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt HtmlDiff("html",
-  cl::desc("Output a side-by-side diff in HTML."),
+ cl::desc("Output a side-by-side diff in HTML."),
   cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt SourcePath(cl::Positional, cl::desc(""),
@@ -77,7 +75,10 @@
   std::make_unique(
   std::move(Compilations));
   AdjustingCompilations->appendArgumentsAdjuster(
-  getInsertArgumentAdjuster(ArgsBefore, ArgumentInsertPosition::BEGIN));
+
+  getInsertArgumentAdjuster(ArgsBefore   ,
+
+  ArgumentInsertPosition::BEGIN));
   AdjustingCompilations->appendArgumentsAdjuster(
   getInsertArgumentAdjuster(ArgsAfter, ArgumentInsertPosition::END));
   Compilations = std::move(AdjustingCompilations);


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-

[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60624 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[clang] 9c39663 - Only Remove implicit conversion for the target that support fp16

2019-12-10 Thread Jim Lin via cfe-commits

Author: Jim Lin
Date: 2019-12-10T19:15:11+08:00
New Revision: 9c3966379813c198129c57aa3ebecd68d6af1ebd

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

LOG: Only Remove implicit conversion for the target that support fp16

Remove implicit conversion that promotes half to double
for the target that support fp16. If the target doesn't
support fp16, fp16 will be converted to fp16 intrinsic.

Added: 


Modified: 
clang/lib/Sema/SemaChecking.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 2be9ecec..aff63aef2934 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5822,7 +5822,8 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, 
unsigned NumArgs) {
 "promotion from float to either float, double, or long double is "
 "the only expected cast here");
 IgnoreCast = true;
-  } else if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half)) 
{
+  } else if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half) 
&&
+ !Context.getTargetInfo().useFP16ConversionIntrinsics()) {
 assert(
 (Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) ||
  Cast->getType()->isSpecificBuiltinType(BuiltinType::Float) ||



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


Re: [clang] 9c39663 - Only Remove implicit conversion for the target that support fp16

2019-12-10 Thread Roman Lebedev via cfe-commits
Is there a test missing?

On Tue, Dec 10, 2019 at 2:11 PM Jim Lin via cfe-commits
 wrote:
>
>
> Author: Jim Lin
> Date: 2019-12-10T19:15:11+08:00
> New Revision: 9c3966379813c198129c57aa3ebecd68d6af1ebd
>
> URL: 
> https://github.com/llvm/llvm-project/commit/9c3966379813c198129c57aa3ebecd68d6af1ebd
> DIFF: 
> https://github.com/llvm/llvm-project/commit/9c3966379813c198129c57aa3ebecd68d6af1ebd.diff
>
> LOG: Only Remove implicit conversion for the target that support fp16
>
> Remove implicit conversion that promotes half to double
> for the target that support fp16. If the target doesn't
> support fp16, fp16 will be converted to fp16 intrinsic.
>
> Added:
>
>
> Modified:
> clang/lib/Sema/SemaChecking.cpp
>
> Removed:
>
>
>
> 
> diff  --git a/clang/lib/Sema/SemaChecking.cpp 
> b/clang/lib/Sema/SemaChecking.cpp
> index 2be9ecec..aff63aef2934 100644
> --- a/clang/lib/Sema/SemaChecking.cpp
> +++ b/clang/lib/Sema/SemaChecking.cpp
> @@ -5822,7 +5822,8 @@ bool Sema::SemaBuiltinFPClassification(CallExpr 
> *TheCall, unsigned NumArgs) {
>  "promotion from float to either float, double, or long double is 
> "
>  "the only expected cast here");
>  IgnoreCast = true;
> -  } else if 
> (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half)) {
> +  } else if 
> (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half) &&
> + !Context.getTargetInfo().useFP16ConversionIntrinsics()) {
>  assert(
>  (Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) ||
>   Cast->getType()->isSpecificBuiltinType(BuiltinType::Float) ||
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71240: [clangd] Heuristically resolve dependent method calls

2019-12-10 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Awesome, thanks, I'd been hoping to get around to this! LG with some 
naming/structure nits.
This doesn't handle references into smart pointers (details below), but feel 
free to do that in this patch, separately, or not at all.




Comment at: clang-tools-extra/clangd/FindTarget.cpp:81
 // This affects:
 //  - DependentTemplateSpecializationType,
 //  - DependentNameType

while here, I think UnresolvedUsingValueDecl and UnresolvedUsingTypenameDecl 
can be added here :-)



Comment at: clang-tools-extra/clangd/FindTarget.cpp:217
+if (E->isArrow()) {
+  if (!BaseType || !BaseType->isPointerType()) {
+return;

If I'm understanding the AST correctly, this drops the `operator->` case, where 
the base is a smart-pointer.

e.g. `void run(unique_ptr> X) { X->go(); }`

There are potentially two reasons then that `x->go` is a *dependent* memberexpr:
 - `operator->` probably returns T*, but `unique_ptr` might be specialized (you 
don't handle this)
 - we probably want the primary `Action::go`, but `Action` might be 
specialized (you do handle this)

So it might be worth trying to get the pointee type (if the base type is a 
TemplateSpecializationType, look up operator-> in the primary template, and 
replace the base with its return type).
If you don't want to do this yet, we should leave a comment (like `FIXME: 
handle unique_ptr by looking up operator-> in the primary template`)



Comment at: clang-tools-extra/clangd/FindTarget.cpp:255
+bool IsNonstaticMember) {
+// This code was adapted in part from indexDependentReference() in
+// IndexBody.cpp.

In the long term, I'm not sure this comment will be as useful as one saying 
something like:
"Dependent name references like `vector::size()` can't be definitively 
resolved, but the using the definition from the primary template is probably 
better than giving up"



Comment at: clang-tools-extra/clangd/FindTarget.cpp:278
+});
+for (const NamedDecl *D : Decls) {
+  Outer.add(D, Flags);

can we make this function return the decls, and make the callers call add() in 
a loop?

That way this function could be reused for the `operator->` lookup, and could 
be a standalone helper function outside this class. (Maybe eventually exposed 
in AST.h, as I can imagine it being useful in other places, but static in this 
file seems fine)



Comment at: clang-tools-extra/clangd/FindTarget.cpp:278
+});
+for (const NamedDecl *D : Decls) {
+  Outer.add(D, Flags);

sammccall wrote:
> can we make this function return the decls, and make the callers call add() 
> in a loop?
> 
> That way this function could be reused for the `operator->` lookup, and could 
> be a standalone helper function outside this class. (Maybe eventually exposed 
> in AST.h, as I can imagine it being useful in other places, but static in 
> this file seems fine)
with multiple lookup results we could add all, discard all, or pick one 
arbitrarily.

I'm not sure what the best policy is, but it's worth pointing out in a comment 
what the cases are and what the choice is.

I think this should only affects overloads, where returning all seems 
reasonable (resolution would be way too much work).

Can you add a test?



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:470
+
+  R"cpp(// Heuristic resolution of method
+template 

nit: dependent method (just so it's easier to search for)



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:501
+}
   )cpp"};
   for (const char *Test : Tests) {

could you add a test for the `operator->` case too, even if we don't handle it 
yet? (in which case with a FIXME)

Something like:
```
template  struct unique_ptr { T* operator->(); };
template  struct S { void [[foo]](); }
template  void test(unique_ptr>& V) { V->f^oo(); }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71240



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


[PATCH] D71049: Remove implicit conversion that promotes half to other larger precision types for fp classification builtins

2019-12-10 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

This causes build bot failures on SystemZ due to a failed assertion in 
ConstantFP::getInfinity:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/28723/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Abuiltins.c


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71049



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


[PATCH] D71248: [clangd] Introduce paragraph, the first part of new rendering structs

2019-12-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

Initial patch for new rendering structs in clangd.

Splitting implementation into smaller chunks, for a full view of the API see 
D71063 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71248

Files:
  clang-tools-extra/clangd/FormattedString.cpp
  clang-tools-extra/clangd/FormattedString.h
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/Hover.h
  clang-tools-extra/clangd/unittests/FormattedStringTests.cpp

Index: clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
===
--- clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
+++ clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
@@ -14,186 +14,233 @@
 
 namespace clang {
 namespace clangd {
+namespace markup {
 namespace {
 
-TEST(FormattedString, Basic) {
-  FormattedString S;
-  EXPECT_EQ(S.renderAsPlainText(), "");
-  EXPECT_EQ(S.renderAsMarkdown(), "");
-
-  S.appendText("foobar  ");
-  S.appendText("baz");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "foobar  baz");
-
-  S = FormattedString();
-  S.appendInlineCode("foobar");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foobar`");
-
-  S = FormattedString();
-  S.appendCodeBlock("foobar");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
-  "foobar\n"
-  "```\n");
-}
-
-TEST(FormattedString, CodeBlocks) {
-  FormattedString S;
-  S.appendCodeBlock("foobar");
-  S.appendCodeBlock("bazqux", "javascript");
-  S.appendText("after");
-
-  std::string ExpectedText = R"(foobar
-
-bazqux
-
-after)";
-  EXPECT_EQ(S.renderAsPlainText(), ExpectedText);
-  std::string ExpectedMarkdown = R"md(```cpp
-foobar
-```
-```javascript
-bazqux
-```
-after)md";
-  EXPECT_EQ(S.renderAsMarkdown(), ExpectedMarkdown);
-
-  S = FormattedString();
-  S.appendInlineCode("foobar");
-  S.appendInlineCode("bazqux");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar bazqux");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foobar` `bazqux`");
-
-  S = FormattedString();
-  S.appendText("foo");
-  S.appendInlineCode("bar");
-  S.appendText("baz");
-
-  EXPECT_EQ(S.renderAsPlainText(), "foo bar baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "foo `bar` baz");
-}
-
-TEST(FormattedString, Escaping) {
+TEST(Render, Escaping) {
   // Check some ASCII punctuation
-  FormattedString S;
-  S.appendText("*!`");
-  EXPECT_EQ(S.renderAsMarkdown(), "\\*\\!\\`");
+  Paragraph P;
+  P.appendText("*!`");
+  EXPECT_EQ(P.renderAsMarkdown(), "\\*\\!\\`");
 
   // Check all ASCII punctuation.
-  S = FormattedString();
+  P = Paragraph();
   std::string Punctuation = R"txt(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)txt";
   // Same text, with each character escaped.
   std::string EscapedPunctuation;
   EscapedPunctuation.reserve(2 * Punctuation.size());
   for (char C : Punctuation)
 EscapedPunctuation += std::string("\\") + C;
-  S.appendText(Punctuation);
-  EXPECT_EQ(S.renderAsMarkdown(), EscapedPunctuation);
+  P.appendText(Punctuation);
+  EXPECT_EQ(P.renderAsMarkdown(), EscapedPunctuation);
 
   // In code blocks we don't need to escape ASCII punctuation.
-  S = FormattedString();
-  S.appendInlineCode("* foo !+ bar * baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "`* foo !+ bar * baz`");
-  S = FormattedString();
-  S.appendCodeBlock("#define FOO\n* foo !+ bar * baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
+  P = Paragraph();
+  P.appendInlineCode("* foo !+ bar * baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "`* foo !+ bar * baz`");
+  P = Paragraph();
+  P.appendCodeBlock("#define FOO\n* foo !+ bar * baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "```cpp\n"
   "#define FOO\n* foo !+ bar * baz\n"
-  "```\n");
+  "```");
 
   // But we have to escape the backticks.
-  S = FormattedString();
-  S.appendInlineCode("foo`bar`baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foo``bar``baz`");
+  P = Paragraph();
+  P.appendInlineCode("foo`bar`baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "`foo``bar``baz`");
 
-  S = FormattedString();
-  S.appendCodeBlock("foo`bar`baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
+  P = Paragraph();
+  P.appendCodeBlock("foo`bar`baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "```cpp\n"
   "foo`bar`baz\n"
-  "```\n");
+  "```");
 
   // Inline code blocks starting or ending with backticks should add spaces.
-  S = FormattedString();
-  S.appendInlineCode("`foo");
-  EXPECT_EQ(S.renderAsMarkdown(), "` ``foo `");
-  S = FormattedString();
-  S.appendInlineCode("foo`");
-  EXPECT_EQ(S.ren

[PATCH] D71247: [clangd] Rename constructors and destructors in cross-file case

2019-12-10 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 233037.
kbobyrev added a comment.

Improve wording in the comment I moved.


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

https://reviews.llvm.org/D71247

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -668,11 +668,85 @@
   std::vector Diagnostics) override {}
   } DiagConsumer;
   // rename is runnning on the "^" point in FooH, and "[[]]" ranges are the
-  // expcted rename occurrences.
+  // expected rename occurrences.
   struct Case {
 llvm::StringRef FooH;
 llvm::StringRef FooCC;
   } Cases [] = {
+{
+  // Constructor.
+  R"cpp(
+class [[Foo]] {
+  [[Foo^]]();
+  ~[[Foo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting before the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  ^~[[Foo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting within the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  ~[[F^oo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting before the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  virtual ~ /*~Foo?*/[[Foo^]]() {
+int a = 4;
+  }
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
 {
   // classes.
   R"cpp(
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -14,11 +14,14 @@
 #include "Selection.h"
 #include "SourceCode.h"
 #include "index/SymbolCollector.h"
+#include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/TokenKinds.h"
 #include "clang/Tooling/Refactoring/Rename/USRFindingAction.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 
@@ -85,17 +88,36 @@
   // range of the Decl. This would avoid allowing rename on unrelated tokens.
   //   ^class Foo {} // SelectionTree returns CXXRecordDecl,
   // // we don't attempt to trigger rename on this position.
-  // FIXME: Make this work on destructors, e.g. "~F^oo()".
   if (const auto *D = SelectedNode->ASTNode.get()) {
-if (D->getLocation() != TokenStartLoc)
-  return {};
+if (D->getLocation() != TokenStartLoc) {
+  // Destructor->getLocation() points to ~. In this case, TokenStartLoc
+  // should point to the next token.
+  const auto *Destructor = llvm::dyn_cast(D);
+  if (!Destructor)
+return {};
+  // There should be exactly two tokens within inspected range: tok::tilde
+  // and tok::identifier.
+  const auto Tokens = AST.getTokens().expandedTokens(
+  {Destructor->getLocation(), TokenStartLoc});
+  if (Tokens.size() != 2 || Tokens.back().kind() != tok::identifier)
+return {};
+}
   }
 
   llvm::DenseSet Result;
   for (const auto *D :
targetDecl(SelectedNode->ASTNode,
-  DeclRelation::Alias | DeclRelation::TemplatePattern))
-Result.insert(D);
+  DeclRelation::Alias | DeclRelation::TemplatePattern)) {
+// If the cursor is at the underlying CXXRecordDecl of the
+// ClassTemplateDecl, ND will be the CXXRecordDecl. In this case, we need to
+// get the primary template maunally.
+// FIXME: Do proper and well-defined canonicalization.
+D = D->getDescribedTemplate() ? D->getDescribedTemplate() : D;
+const auto *ND = llvm::dyn_cast(D);
+// Get to CXXRecordDecl from constructor or destructor.
+ND = tooling::getCanonicalSymbolDeclaration(ND);
+Result.insert(ND);
+  }
   return Result;
 }
 
@@ -212,17 +234,11 @@
 // Return all rename occurrences in the main file.
 std::vector findOccu

[PATCH] D71247: [clangd] Rename constructors and destructors in cross-file case

2019-12-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/unittests/RenameTests.cpp:699
+  [[Foo]]();
+  ^~[[Foo]]();
+};

could you also add a case with `~^Foo()`


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

https://reviews.llvm.org/D71247



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


[PATCH] D71248: [clangd] Introduce paragraph, the first part of new rendering structs

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60655 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71248



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


[PATCH] D70615: Add an -fno-temp-file flag for compilation

2019-12-10 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

I see. For some reason I thought the temporary files would be written 
elsewhere, like in /tmp, but I see that's not the case, and I guess it also 
makes sense to avoid having to copy it between file systems.

This patch seems okay to me.


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

https://reviews.llvm.org/D70615



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


[PATCH] D71247: [clangd] Rename constructors and destructors in cross-file case

2019-12-10 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 233048.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Add another test for `~^Foo` and rebase on top of master.


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

https://reviews.llvm.org/D71247

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -672,11 +672,103 @@
   std::vector Diagnostics) override {}
   } DiagConsumer;
   // rename is runnning on the "^" point in FooH, and "[[]]" ranges are the
-  // expcted rename occurrences.
+  // expected rename occurrences.
   struct Case {
 llvm::StringRef FooH;
 llvm::StringRef FooCC;
   } Cases [] = {
+{
+  // Constructor.
+  R"cpp(
+class [[Foo]] {
+  [[Foo^]]();
+  ~[[Foo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting before the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  ^~[[Foo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting before the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  ~^[[Foo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting within the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  ~[[F^oo]]();
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
+{
+  // Destructor (selecting after the identifier).
+  R"cpp(
+class [[Foo]] {
+  [[Foo]]();
+  virtual ~ /*~Foo?*/[[Foo^]]() {
+int a = 4;
+  }
+};
+  )cpp",
+  R"cpp(
+#include "foo.h"
+[[Foo]]::[[Foo]]() {}
+[[Foo]]::~[[Foo]]() {}
+
+void func() {
+  [[Foo]] foo;
+}
+  )cpp",
+},
 {
   // classes.
   R"cpp(
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -87,17 +87,36 @@
   // range of the Decl. This would avoid allowing rename on unrelated tokens.
   //   ^class Foo {} // SelectionTree returns CXXRecordDecl,
   // // we don't attempt to trigger rename on this position.
-  // FIXME: Make this work on destructors, e.g. "~F^oo()".
   if (const auto *D = SelectedNode->ASTNode.get()) {
-if (D->getLocation() != TokenStartLoc)
-  return {};
+if (D->getLocation() != TokenStartLoc) {
+  // Destructor->getLocation() points to ~. In this case, TokenStartLoc
+  // should point to the next token.
+  const auto *Destructor = llvm::dyn_cast(D);
+  if (!Destructor)
+return {};
+  // There should be exactly two tokens within inspected range: tok::tilde
+  // and tok::identifier.
+  const auto Tokens = AST.getTokens().expandedTokens(
+  {Destructor->getLocation(), TokenStartLoc});
+  if (Tokens.size() != 2 || Tokens.back().kind() != tok::identifier)
+return {};
+}
   }
 
   llvm::DenseSet Result;
   for (const auto *D :
targetDecl(SelectedNode->ASTNode,
-  DeclRelation::Alias | DeclRelation::TemplatePattern))
-Result.insert(D);
+  DeclRelation::Alias | DeclRelation::TemplatePattern)) {
+// If the cursor is at the underlying CXXRecordDecl of the
+// ClassTemplateDecl, ND will be the CXXRecordDecl. In this case, we need to
+// get the primary template maunally.
+// FIXME: Do proper and well-defined canonicalization.
+D = D->getDescribedTemplate() ? D->getDescribedTemplate() : D;
+const auto *ND = llvm::dyn_cast(D);
+// Get to CXXRecordDecl from constructor or destructor.
+ND = tooling::getCanonicalSymbolDeclaration(ND);
+Result.insert(ND);
+  }
   return Result;
 }
 
@@ -214,17 +233,11 @@
 // Return all rename occurrences in the main file.
 std::vector findOccurrencesWithinFile(ParsedAST &AST,

[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet marked 2 inline comments as done.
gchatelet added inline comments.



Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2910
+const Align Alignment =
+assumeAligned(cast(I.getArgOperand(2))->getZExtValue());
 Value *Mask = I.getArgOperand(3);

courbet wrote:
> how did you infer this ? I'm not sure I can prove that this is nonzero.
The argument can be `0` and in that case `assumeAligned` will turn it into `1`.
It's not a problem for `getShadowOriginPtr` which treats `0` as `1`.
It does change the generated IR for `CreateMaskedStore` which will have an 
alignment of `1` instead of `0`. But I believe this is treated the same way 
down the road by the CodeGen.
All tests are still passing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71213



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2019-12-10 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm updated this revision to Diff 233059.
arsenm added a comment.

Reword langref, fix name in langref


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

https://reviews.llvm.org/D69878

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Driver/ToolChains/AMDGPU.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.h
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenCUDA/flush-denormals.cu
  clang/test/CodeGenCUDA/propagate-metadata.cu
  clang/test/CodeGenOpenCL/amdgpu-features.cl
  clang/test/CodeGenOpenCL/denorms-are-zero.cl
  clang/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
  clang/test/Driver/cl-denorms-are-zero.cl
  clang/test/Driver/cuda-flush-denormals-to-zero.cu
  clang/test/Driver/denormal-fp-math.c
  clang/test/Driver/opencl.cl
  llvm/docs/LangRef.rst
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/CodeGen/NVPTX/fast-math.ll
  llvm/test/CodeGen/NVPTX/math-intrins.ll
  llvm/test/CodeGen/NVPTX/sqrt-approx.ll
  llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll

Index: llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
===
--- llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
+++ llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
@@ -5,11 +5,11 @@
 ; hackery:
 
 ; RUN: cat %s > %t.ftz
-; RUN: echo 'attributes #0 = { "nvptx-f32ftz" = "true" }' >> %t.ftz
+; RUN: echo 'attributes #0 = { "denormal-fp-math-f32" = "preserve-sign" }' >> %t.ftz
 ; RUN: opt < %t.ftz -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=FTZ
 
 ; RUN: cat %s > %t.noftz
-; RUN: echo 'attributes #0 = { "nvptx-f32ftz" = "false" }' >> %t.noftz
+; RUN: echo 'attributes #0 = { "denormal-fp-math-f32" = "ieee" }' >> %t.noftz
 ; RUN: opt < %t.noftz -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=NOFTZ
 
 ; We handle nvvm intrinsics with ftz variants as follows:
Index: llvm/test/CodeGen/NVPTX/sqrt-approx.ll
===
--- llvm/test/CodeGen/NVPTX/sqrt-approx.ll
+++ llvm/test/CodeGen/NVPTX/sqrt-approx.ll
@@ -146,5 +146,5 @@
 }
 
 attributes #0 = { "unsafe-fp-math" = "true" }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
 attributes #2 = { "reciprocal-estimates" = "rsqrtf:1,rsqrtd:1,sqrtf:1,sqrtd:1" }
Index: llvm/test/CodeGen/NVPTX/math-intrins.ll
===
--- llvm/test/CodeGen/NVPTX/math-intrins.ll
+++ llvm/test/CodeGen/NVPTX/math-intrins.ll
@@ -289,4 +289,4 @@
 }
 
 attributes #0 = { nounwind readnone }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
Index: llvm/test/CodeGen/NVPTX/fast-math.ll
===
--- llvm/test/CodeGen/NVPTX/fast-math.ll
+++ llvm/test/CodeGen/NVPTX/fast-math.ll
@@ -162,4 +162,4 @@
 }
 
 attributes #0 = { "unsafe-fp-math" = "true" }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -15,6 +15,7 @@
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
@@ -1703,9 +1704,10 @@
   // intrinsic, we don't have to look up any module metadata, as
   // FtzRequirementTy will be FTZ_Any.)
   if (Action.FtzRequirement != FTZ_Any) {
-bool FtzEnabled =
-II->getFunction()->getFnAttribute("nvptx-f32ftz").getValueAsString() ==
-"true";
+StringRef Attr = II->getFunction()
+ ->getFnAttribute("denormal-fp-math-f32")
+ .getValueAsString();
+bool FtzEnabled = parseDenormalFPAttribute(Attr) != DenormalMode::IEEE;
 
 if (FtzEnabled != (Action.FtzRequirement == FTZ_MustBeOn))
   return nullptr;
Index: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -120,14 +120,10 @@
   if (FtzEnab

[PATCH] D71124: [RISCV] support clang driver to select cpu

2019-12-10 Thread Sam Elliott via Phabricator via cfe-commits
lenary added reviewers: lenary, asb.
lenary added inline comments.



Comment at: clang/lib/Basic/Targets/RISCV.cpp:164
+
+static constexpr llvm::StringLiteral ValidRV32CPUNames[] = {{"generic-rv32"},
+{"rocket-rv32"}};

Is there not a tablegen'd implementation of these based on 
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/RISCV/RISCV.td#L96-L99
 (which will include `rocket-rv32` and `rocket-rv64` when those two schedules 
are landed)?


Repository:
  rC Clang

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

https://reviews.llvm.org/D71124



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


[PATCH] D68213: [LTO] Support for embedding bitcode section during LTO

2019-12-10 Thread Josef Eisl via Phabricator via cfe-commits
zapster added a comment.

(Ping)

Hi! I am still looking for reviews/reviewers for this change. Please let me 
know what I can do to make progress with this.
Many thanks in advance!


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

https://reviews.llvm.org/D68213



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


[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

2019-12-10 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

ping


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

https://reviews.llvm.org/D69979



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


[PATCH] D69782: Summary: Instead of dropping all the ranges associated with a Diagnostic when converting them to a ClangTidy error, instead attach them to the ClangTidyError, so they can be consumed b

2019-12-10 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.



Comment at: include/clang/Tooling/DiagnosticsYaml.h:75
 std::string BuildDirectory;
+ArrayRef Ranges;
   };

We should serialize the ranges too.


Repository:
  rC Clang

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

https://reviews.llvm.org/D69782



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


[PATCH] D71245: [ARM][MVE] Refactor complex vector intrinsics [NFCI]

2019-12-10 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

Nice one. Thanks.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71245



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


[PATCH] D70157: Align branches within 32-Byte boundary

2019-12-10 Thread Fedor Sergeev via Phabricator via cfe-commits
fedor.sergeev added a comment.

In D70157#1776424 , @skan wrote:

> > What if I insert explicit align(8) right *after* the sequence?
>
> If your insert explicit `.align 8` after the sequence, and the sequence 
> doesn't has any branch to be aligned, the current solution won't change the 
> sequence.


Well, I kinda figure that from the code behavior right now, however is it 
really by design or just happens to work now?
Seeing that assembler becomes very intelligent now I would rather have a strict 
guarantee similar to "hardcode" thing that you have here that protects my 
sequence
rather than relying on a fact that in current settings moving my label by 8 
does not appear to be profitable to assembler.


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

https://reviews.llvm.org/D70157



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


[PATCH] D70256: [FPEnv] clang support for constrained FP builtins

2019-12-10 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn updated this revision to Diff 233073.
kpn added a comment.

Update for review comments.


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

https://reviews.llvm.org/D70256

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/constrained-math-builtins.c
  llvm/include/llvm/IR/IRBuilder.h

Index: llvm/include/llvm/IR/IRBuilder.h
===
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -2087,6 +2087,8 @@
 case Intrinsic::experimental_constrained_fpext:
 case Intrinsic::experimental_constrained_fptoui:
 case Intrinsic::experimental_constrained_fptosi:
+case Intrinsic::experimental_constrained_lround:
+case Intrinsic::experimental_constrained_llround:
   C = CreateIntrinsic(ID, {DestTy, V->getType()}, {V, ExceptV}, nullptr,
   Name);
   break;
@@ -2297,6 +2299,37 @@
 Args, OpBundles, Name, FPMathTag);
   }
 
+  // Deprecated [opaque pointer types]
+  CallInst *CreateConstrainedFPCall(
+  Value *Callee, ArrayRef Args, const Twine &Name = "",
+  Optional Rounding = None,
+  Optional Except = None) {
+llvm::SmallVector UseArgs;
+
+for (auto *OneArg : Args)
+  UseArgs.push_back(OneArg);
+Function *F = cast(Callee);
+switch (F->getIntrinsicID()) {
+default:
+  UseArgs.push_back(getConstrainedFPRounding(Rounding));
+  break;
+case Intrinsic::experimental_constrained_fpext:
+case Intrinsic::experimental_constrained_fptoui:
+case Intrinsic::experimental_constrained_fptosi:
+case Intrinsic::experimental_constrained_lround:
+case Intrinsic::experimental_constrained_llround:
+  // No rounding metadata for these intrinsics.
+  break;
+}
+UseArgs.push_back(getConstrainedFPExcept(Except));
+
+CallInst *C = CreateCall(
+cast(Callee->getType()->getPointerElementType()), Callee,
+UseArgs, Name);
+setConstrainedFPCallAttr(C);
+return C;
+  }
+
   Value *CreateSelect(Value *C, Value *True, Value *False,
   const Twine &Name = "", Instruction *MDFrom = nullptr) {
 if (auto *CC = dyn_cast(C))
Index: clang/test/CodeGen/constrained-math-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/constrained-math-builtins.c
@@ -0,0 +1,150 @@
+// RUN: %clang_cc1 -triple x86_64-linux -ffp-exception-behavior=strict -w -S -o - -emit-llvm %s | FileCheck %s
+
+// Test codegen of constrained math builtins.
+
+void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
+  f = __builtin_fmod(f,f);f = __builtin_fmodf(f,f);   f =  __builtin_fmodl(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.frem.f64(double, double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.frem.f32(float, float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.frem.f80(x86_fp80, x86_fp80, metadata, metadata)
+
+  __builtin_pow(f,f);__builtin_powf(f,f);   __builtin_powl(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.pow.f64(double, double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.pow.f32(float, float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.pow.f80(x86_fp80, x86_fp80, metadata, metadata)
+
+  __builtin_powi(f,f);__builtin_powif(f,f);   __builtin_powil(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.powi.f64(double, i32, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.powi.f32(float, i32, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.powi.f80(x86_fp80, i32, metadata, metadata)
+
+  __builtin_ceil(f);   __builtin_ceilf(f);  __builtin_ceill(f);
+
+// CHECK: declare double @llvm.experimental.constrained.ceil.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.ceil.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.ceil.f80(x86_fp80, metadata, metadata)
+
+  __builtin_cos(f);__builtin_cosf(f);   __builtin_cosl(f); 
+
+// CHECK: declare double @llvm.experimental.constrained.cos.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.cos.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.cos.f80(x86_fp80, metadata, metadata)
+
+  __builtin_exp(f);__builtin_expf(f);   __builtin_expl(f);
+
+// CHECK: declare double @llvm.experimental.constrained.exp.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.exp.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.exp.f80(x86_fp80, metadata, metadata)
+
+  __builtin_exp2(f);   __builtin_exp2f(f);  __builtin_exp2l(f); 
+
+// CHECK: decla

[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet updated this revision to Diff 233074.
gchatelet added a comment.

- Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71213

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuilder.h
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -624,7 +624,7 @@
 
   if (SrcLen == 0) {
 // strncpy(x, "", y) -> memset(align 1 x, '\0', y)
-CallInst *NewCI = B.CreateMemSet(Dst, B.getInt8('\0'), Size, 1);
+CallInst *NewCI = B.CreateMemSet(Dst, B.getInt8('\0'), Size, Align::None());
 AttrBuilder ArgAttrs(CI->getAttributes().getParamAttributes(0));
 NewCI->setAttributes(NewCI->getAttributes().addParamAttributes(
 CI->getContext(), 0, ArgAttrs));
@@ -1235,7 +1235,8 @@
 
   // memset(p, v, n) -> llvm.memset(align 1 p, v, n)
   Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(), false);
-  CallInst *NewCI = B.CreateMemSet(CI->getArgOperand(0), Val, Size, 1);
+  CallInst *NewCI =
+  B.CreateMemSet(CI->getArgOperand(0), Val, Size, Align::None());
   NewCI->setAttributes(CI->getAttributes());
   return CI->getArgOperand(0);
 }
@@ -3290,8 +3291,8 @@
 
   if (isFortifiedCallFoldable(CI, 3, 2)) {
 Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(), false);
-CallInst *NewCI =
-B.CreateMemSet(CI->getArgOperand(0), Val, CI->getArgOperand(2), 1);
+CallInst *NewCI = B.CreateMemSet(CI->getArgOperand(0), Val,
+ CI->getArgOperand(2), Align::None());
 NewCI->setAttributes(CI->getAttributes());
 return CI->getArgOperand(0);
   }
Index: llvm/lib/Transforms/Scalar/SROA.cpp
===
--- llvm/lib/Transforms/Scalar/SROA.cpp
+++ llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2801,7 +2801,7 @@
   Constant *Size = ConstantInt::get(SizeTy, NewEndOffset - NewBeginOffset);
   CallInst *New = IRB.CreateMemSet(
   getNewAllocaSlicePtr(IRB, OldPtr->getType()), II.getValue(), Size,
-  getSliceAlign(), II.isVolatile());
+  MaybeAlign(getSliceAlign()), II.isVolatile());
   if (AATags)
 New->setAAMetadata(AATags);
   LLVM_DEBUG(dbgs() << "  to: " << *New << "\n");
Index: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
===
--- llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -388,16 +388,12 @@
 StartPtr = Range.StartPtr;
 
 // Determine alignment
-unsigned Alignment = Range.Alignment;
-if (Alignment == 0) {
-  Type *EltType =
-cast(StartPtr->getType())->getElementType();
-  Alignment = DL.getABITypeAlignment(EltType);
-}
-
-AMemSet =
-  Builder.CreateMemSet(StartPtr, ByteVal, Range.End-Range.Start, Alignment);
+const Align Alignment = DL.getValueOrABITypeAlignment(
+MaybeAlign(Range.Alignment),
+cast(StartPtr->getType())->getElementType());
 
+AMemSet = Builder.CreateMemSet(StartPtr, ByteVal, Range.End - Range.Start,
+   Alignment);
 LLVM_DEBUG(dbgs() << "Replace stores:\n"; for (Instruction *SI
: Range.TheStores) dbgs()
   << *SI << '\n';
@@ -683,12 +679,11 @@
 auto *T = V->getType();
 if (T->isAggregateType()) {
   uint64_t Size = DL.getTypeStoreSize(T);
-  unsigned Align = SI->getAlignment();
-  if (!Align)
-Align = DL.getABITypeAlignment(T);
+  const Align MA =
+  DL.getValueOrABITypeAlignment(MaybeAlign(SI->getAlignment()), T);
   IRBuilder<> Builder(SI);
   auto *M =
-  Builder.CreateMemSet(SI->getPointerOperand(), ByteVal, Size, Align);
+  Builder.CreateMemSet(SI->getPointerOperand(), ByteVal, Size, MA);
 
   LLVM_DEBUG(dbgs() << "Promoting " << *SI << " to " << *M << "\n");
 
@@ -1058,7 +1053,7 @@
   Builder.CreateMemSet(
   Builder.CreateGEP(Dest->getType()->getPointerElementType(), Dest,
 SrcSize),
-  MemSet->getOperand(1), MemsetLen, Align);
+  MemSet->getOperand(1), MemsetLen, MaybeAlign(Align));
 

[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet added a comment.

Thx for the review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71213



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


[clang] 1b2842b - [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Guillaume Chatelet via cfe-commits

Author: Guillaume Chatelet
Date: 2019-12-10T15:17:44+01:00
New Revision: 1b2842bf902a8b52acbef2425120533b63be5ae3

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

LOG: [Alignment][NFC] CreateMemSet use MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: 
http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/lib/CodeGen/CGAtomic.cpp
clang/lib/CodeGen/CGBuilder.h
clang/lib/CodeGen/CGBuiltin.cpp
llvm/include/llvm/IR/IRBuilder.h
llvm/lib/IR/Core.cpp
llvm/lib/IR/IRBuilder.cpp
llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index d07aaf58681c..149982d82790 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -350,7 +350,7 @@ bool AtomicInfo::emitMemSetZeroIfNecessary() const {
   CGF.Builder.CreateMemSet(
   addr, llvm::ConstantInt::get(CGF.Int8Ty, 0),
   CGF.getContext().toCharUnitsFromBits(AtomicSizeInBits).getQuantity(),
-  LVal.getAlignment().getQuantity());
+  LVal.getAlignment().getAsAlign());
   return true;
 }
 

diff  --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h
index dae3fbbc4b9f..746053f43e36 100644
--- a/clang/lib/CodeGen/CGBuilder.h
+++ b/clang/lib/CodeGen/CGBuilder.h
@@ -296,7 +296,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
   llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
llvm::Value *Size, bool IsVolatile = false) {
 return CreateMemSet(Dest.getPointer(), Value, Size,
-Dest.getAlignment().getQuantity(), IsVolatile);
+Dest.getAlignment().getAsAlign(), IsVolatile);
   }
 
   using CGBuilderBaseTy::CreatePreserveStructAccessIndex;

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 7447a5841599..2b2738252a05 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -46,7 +46,8 @@ int64_t clamp(int64_t Value, int64_t Low, int64_t High) {
   return std::min(High, std::max(Low, Value));
 }
 
-static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value 
*Size, unsigned AlignmentInBytes) {
+static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size,
+ Align AlignmentInBytes) {
   ConstantInt *Byte;
   switch (CGF.getLangOpts().getTrivialAutoVarInit()) {
   case LangOptions::TrivialAutoVarInitKind::Uninitialized:
@@ -2359,12 +2360,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 Value *Size = EmitScalarExpr(E->getArg(0));
 const TargetInfo &TI = getContext().getTargetInfo();
 // The alignment of the alloca should correspond to __BIGGEST_ALIGNMENT__.
-unsigned SuitableAlignmentInBytes =
+const Align SuitableAlignmentInBytes =
 CGM.getContext()
 .toCharUnitsFromBits(TI.getSuitableAlign())
-.getQuantity();
+.getAsAlign();
 AllocaInst *AI = Builder.CreateAlloca(Builder.getInt8Ty(), Size);
-AI->setAlignment(MaybeAlign(SuitableAlignmentInBytes));
+AI->setAlignment(SuitableAlignmentInBytes);
 initializeAlloca(*this, AI, Size, SuitableAlignmentInBytes);
 return RValue::get(AI);
   }
@@ -2374,10 +2375,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 Value *AlignmentInBitsValue = EmitScalarExpr(E->getArg(1));
 auto *AlignmentInBitsCI = cast(AlignmentInBitsValue);
 unsigned AlignmentInBits = AlignmentInBitsCI->getZExtValue();
-unsigned AlignmentInBytes =
-CGM.getContext().toCharUnitsFromBits(AlignmentInBits).getQuantity();
+const Align AlignmentInBytes =
+CGM.getContext().toCharUnitsFromBits(AlignmentInBits).getAsAlign();
 AllocaInst *AI = Builder.CreateAlloca(Builder.getInt8Ty(), Size);
-AI->setAlignment(MaybeAlign(AlignmentInBytes));
+AI->setAlignment(AlignmentInBytes);
 initializeAlloca(*this, AI, Size, AlignmentInBytes);
 return RValue::get

[PATCH] D71248: [clangd] Introduce paragraph, the first part of new rendering structs

2019-12-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 233078.
kadircet added a comment.

- More comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71248

Files:
  clang-tools-extra/clangd/FormattedString.cpp
  clang-tools-extra/clangd/FormattedString.h
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/Hover.h
  clang-tools-extra/clangd/unittests/FormattedStringTests.cpp

Index: clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
===
--- clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
+++ clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
@@ -14,186 +14,233 @@
 
 namespace clang {
 namespace clangd {
+namespace markup {
 namespace {
 
-TEST(FormattedString, Basic) {
-  FormattedString S;
-  EXPECT_EQ(S.renderAsPlainText(), "");
-  EXPECT_EQ(S.renderAsMarkdown(), "");
-
-  S.appendText("foobar  ");
-  S.appendText("baz");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "foobar  baz");
-
-  S = FormattedString();
-  S.appendInlineCode("foobar");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foobar`");
-
-  S = FormattedString();
-  S.appendCodeBlock("foobar");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
-  "foobar\n"
-  "```\n");
-}
-
-TEST(FormattedString, CodeBlocks) {
-  FormattedString S;
-  S.appendCodeBlock("foobar");
-  S.appendCodeBlock("bazqux", "javascript");
-  S.appendText("after");
-
-  std::string ExpectedText = R"(foobar
-
-bazqux
-
-after)";
-  EXPECT_EQ(S.renderAsPlainText(), ExpectedText);
-  std::string ExpectedMarkdown = R"md(```cpp
-foobar
-```
-```javascript
-bazqux
-```
-after)md";
-  EXPECT_EQ(S.renderAsMarkdown(), ExpectedMarkdown);
-
-  S = FormattedString();
-  S.appendInlineCode("foobar");
-  S.appendInlineCode("bazqux");
-  EXPECT_EQ(S.renderAsPlainText(), "foobar bazqux");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foobar` `bazqux`");
-
-  S = FormattedString();
-  S.appendText("foo");
-  S.appendInlineCode("bar");
-  S.appendText("baz");
-
-  EXPECT_EQ(S.renderAsPlainText(), "foo bar baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "foo `bar` baz");
-}
-
-TEST(FormattedString, Escaping) {
+TEST(Render, Escaping) {
   // Check some ASCII punctuation
-  FormattedString S;
-  S.appendText("*!`");
-  EXPECT_EQ(S.renderAsMarkdown(), "\\*\\!\\`");
+  Paragraph P;
+  P.appendText("*!`");
+  EXPECT_EQ(P.renderAsMarkdown(), "\\*\\!\\`");
 
   // Check all ASCII punctuation.
-  S = FormattedString();
+  P = Paragraph();
   std::string Punctuation = R"txt(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)txt";
   // Same text, with each character escaped.
   std::string EscapedPunctuation;
   EscapedPunctuation.reserve(2 * Punctuation.size());
   for (char C : Punctuation)
 EscapedPunctuation += std::string("\\") + C;
-  S.appendText(Punctuation);
-  EXPECT_EQ(S.renderAsMarkdown(), EscapedPunctuation);
+  P.appendText(Punctuation);
+  EXPECT_EQ(P.renderAsMarkdown(), EscapedPunctuation);
 
   // In code blocks we don't need to escape ASCII punctuation.
-  S = FormattedString();
-  S.appendInlineCode("* foo !+ bar * baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "`* foo !+ bar * baz`");
-  S = FormattedString();
-  S.appendCodeBlock("#define FOO\n* foo !+ bar * baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
+  P = Paragraph();
+  P.appendInlineCode("* foo !+ bar * baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "`* foo !+ bar * baz`");
+  P = Paragraph();
+  P.appendCodeBlock("#define FOO\n* foo !+ bar * baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "```cpp\n"
   "#define FOO\n* foo !+ bar * baz\n"
-  "```\n");
+  "```");
 
   // But we have to escape the backticks.
-  S = FormattedString();
-  S.appendInlineCode("foo`bar`baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "`foo``bar``baz`");
+  P = Paragraph();
+  P.appendInlineCode("foo`bar`baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "`foo``bar``baz`");
 
-  S = FormattedString();
-  S.appendCodeBlock("foo`bar`baz");
-  EXPECT_EQ(S.renderAsMarkdown(), "```cpp\n"
+  P = Paragraph();
+  P.appendCodeBlock("foo`bar`baz");
+  EXPECT_EQ(P.renderAsMarkdown(), "```cpp\n"
   "foo`bar`baz\n"
-  "```\n");
+  "```");
 
   // Inline code blocks starting or ending with backticks should add spaces.
-  S = FormattedString();
-  S.appendInlineCode("`foo");
-  EXPECT_EQ(S.renderAsMarkdown(), "` ``foo `");
-  S = FormattedString();
-  S.appendInlineCode("foo`");
-  EXPECT_EQ(S.renderAsMarkdown(), "` foo`` `");
-  S = FormattedString();
-  S.appendInlineCode("`foo`");
-  EXPECT_EQ(S.renderAsMarkdown(), "` ``foo`` `");
-
-  // Should also add extra spac

[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-10 Thread Guillaume Chatelet via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b2842bf902a: [Alignment][NFC] CreateMemSet use MaybeAlign 
(authored by gchatelet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71213

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuilder.h
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -624,7 +624,7 @@
 
   if (SrcLen == 0) {
 // strncpy(x, "", y) -> memset(align 1 x, '\0', y)
-CallInst *NewCI = B.CreateMemSet(Dst, B.getInt8('\0'), Size, 1);
+CallInst *NewCI = B.CreateMemSet(Dst, B.getInt8('\0'), Size, Align::None());
 AttrBuilder ArgAttrs(CI->getAttributes().getParamAttributes(0));
 NewCI->setAttributes(NewCI->getAttributes().addParamAttributes(
 CI->getContext(), 0, ArgAttrs));
@@ -1235,7 +1235,8 @@
 
   // memset(p, v, n) -> llvm.memset(align 1 p, v, n)
   Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(), false);
-  CallInst *NewCI = B.CreateMemSet(CI->getArgOperand(0), Val, Size, 1);
+  CallInst *NewCI =
+  B.CreateMemSet(CI->getArgOperand(0), Val, Size, Align::None());
   NewCI->setAttributes(CI->getAttributes());
   return CI->getArgOperand(0);
 }
@@ -3290,8 +3291,8 @@
 
   if (isFortifiedCallFoldable(CI, 3, 2)) {
 Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(), false);
-CallInst *NewCI =
-B.CreateMemSet(CI->getArgOperand(0), Val, CI->getArgOperand(2), 1);
+CallInst *NewCI = B.CreateMemSet(CI->getArgOperand(0), Val,
+ CI->getArgOperand(2), Align::None());
 NewCI->setAttributes(CI->getAttributes());
 return CI->getArgOperand(0);
   }
Index: llvm/lib/Transforms/Scalar/SROA.cpp
===
--- llvm/lib/Transforms/Scalar/SROA.cpp
+++ llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2801,7 +2801,7 @@
   Constant *Size = ConstantInt::get(SizeTy, NewEndOffset - NewBeginOffset);
   CallInst *New = IRB.CreateMemSet(
   getNewAllocaSlicePtr(IRB, OldPtr->getType()), II.getValue(), Size,
-  getSliceAlign(), II.isVolatile());
+  MaybeAlign(getSliceAlign()), II.isVolatile());
   if (AATags)
 New->setAAMetadata(AATags);
   LLVM_DEBUG(dbgs() << "  to: " << *New << "\n");
Index: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
===
--- llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -388,16 +388,12 @@
 StartPtr = Range.StartPtr;
 
 // Determine alignment
-unsigned Alignment = Range.Alignment;
-if (Alignment == 0) {
-  Type *EltType =
-cast(StartPtr->getType())->getElementType();
-  Alignment = DL.getABITypeAlignment(EltType);
-}
-
-AMemSet =
-  Builder.CreateMemSet(StartPtr, ByteVal, Range.End-Range.Start, Alignment);
+const Align Alignment = DL.getValueOrABITypeAlignment(
+MaybeAlign(Range.Alignment),
+cast(StartPtr->getType())->getElementType());
 
+AMemSet = Builder.CreateMemSet(StartPtr, ByteVal, Range.End - Range.Start,
+   Alignment);
 LLVM_DEBUG(dbgs() << "Replace stores:\n"; for (Instruction *SI
: Range.TheStores) dbgs()
   << *SI << '\n';
@@ -683,12 +679,11 @@
 auto *T = V->getType();
 if (T->isAggregateType()) {
   uint64_t Size = DL.getTypeStoreSize(T);
-  unsigned Align = SI->getAlignment();
-  if (!Align)
-Align = DL.getABITypeAlignment(T);
+  const Align MA =
+  DL.getValueOrABITypeAlignment(MaybeAlign(SI->getAlignment()), T);
   IRBuilder<> Builder(SI);
   auto *M =
-  Builder.CreateMemSet(SI->getPointerOperand(), ByteVal, Size, Align);
+  Builder.CreateMemSet(SI->getPointerOperand(), ByteVal, Size, MA);
 
   LLVM_DEBUG(dbgs() << "Promoting " << *SI << " to " << *M << "\n");
 
@@ -1058,7 +1053,7 @@
   Builder.CreateMemSet(
   Builder.CreateGEP(Dest->getType()->getPointerElementType(), Dest,
 SrcSize),
-  MemSet->getOperand(1),

[PATCH] D68213: [LTO] Support for embedding bitcode section during LTO

2019-12-10 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

It seems reasonable to support this from LTO since it provides analogous 
support to what is available via clang without LTO. @pcc what do you think?

I only just skimmed it for now, one question below.




Comment at: llvm/lib/LTO/LTOBackend.cpp:335
+   .Case("bitcode", EmbedBitcodeKind::Embed_Bitcode)
+   .Case("marker", EmbedBitcodeKind::Embed_Marker)
+   .Default(~0U);

Does this value make any sense since CmdArgs is always empty below?


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

https://reviews.llvm.org/D68213



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


[PATCH] D68261: [clangd] Add "inline" keyword to prevent ODR-violations in DefineInline

2019-12-10 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 233081.
kadircet added a comment.

- Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68261

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -1864,6 +1864,66 @@
   EXPECT_EQ(apply(Test), Expected) << Test;
 }
 
+TEST_F(DefineInlineTest, AddInline) {
+  llvm::StringMap EditedFiles;
+  ExtraFiles["a.h"] = "void foo();";
+  apply(R"cpp(#include "a.h"
+  void fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents(
+   testPath("a.h"), "inline void foo(){}")));
+
+  // Check we put inline before cv-qualifiers.
+  ExtraFiles["a.h"] = "const int foo();";
+  apply(R"cpp(#include "a.h"
+  const int fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents(
+   testPath("a.h"), "inline const int foo(){}")));
+
+  // No double inline.
+  ExtraFiles["a.h"] = "inline void foo();";
+  apply(R"cpp(#include "a.h"
+  inline void fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents(
+   testPath("a.h"), "inline void foo(){}")));
+
+  // Constexprs don't need "inline".
+  ExtraFiles["a.h"] = "constexpr void foo();";
+  apply(R"cpp(#include "a.h"
+  constexpr void fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents(
+   testPath("a.h"), "constexpr void foo(){}")));
+
+  // Class members don't need "inline".
+  ExtraFiles["a.h"] = "struct Foo { void foo(); }";
+  apply(R"cpp(#include "a.h"
+  void Foo::fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles,
+  testing::ElementsAre(FileWithContents(
+  testPath("a.h"), "struct Foo { void foo(){} }")));
+
+  // Function template doesn't need to be "inline"d.
+  ExtraFiles["a.h"] = "template  void foo();";
+  apply(R"cpp(#include "a.h"
+  template 
+  void fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles,
+  testing::ElementsAre(FileWithContents(
+  testPath("a.h"), "template  void foo(){}")));
+
+  // Specializations needs to be marked "inline".
+  ExtraFiles["a.h"] = R"cpp(
+template  void foo();
+template <> void foo();)cpp";
+  apply(R"cpp(#include "a.h"
+  template <>
+  void fo^o() {})cpp", &EditedFiles);
+  EXPECT_THAT(EditedFiles,
+  testing::ElementsAre(FileWithContents(testPath("a.h"),
+R"cpp(
+template  void foo();
+template <> inline void foo(){})cpp")));
+}
+
 TWEAK_TEST(DefineOutline);
 TEST_F(DefineOutlineTest, TriggersOnFunctionDecl) {
   FileName = "Test.cpp";
Index: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
@@ -32,6 +32,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Driver/Types.h"
 #include "clang/Index/IndexDataConsumer.h"
 #include "clang/Index/IndexSymbol.h"
 #include "clang/Index/IndexingAction.h"
@@ -360,6 +361,30 @@
   return FD->getBeginLoc();
 }
 
+llvm::Optional
+addInlineIfInHeader(const FunctionDecl *FD) {
+  // This includes inline functions and constexpr functions.
+  if (FD->isInlined() || llvm::isa(FD))
+return llvm::None;
+  // Primary template doesn't need inline.
+  if (FD->isTemplated() && !FD->isFunctionTemplateSpecialization())
+return llvm::None;
+
+  const SourceManager &SM = FD->getASTContext().getSourceManager();
+  llvm::StringRef FileName = SM.getFilename(FD->getLocation());
+
+  auto Type = driver::types::lookupTypeForExtension(
+  llvm::sys::path::extension(FileName).substr(1));
+
+  // If it is not a header we don't need to mark function as "inline".
+  if (Type == driver::types::TY_INVALID ||
+  !driver::types::onlyPrecompileType(Type)) {
+return llvm::None;
+  }
+
+  return tooling::Replacement(SM, FD->getInnerLocStart(), 0, "inline ");
+}
+
 /// Moves definition of a function/method to its declaration location.
 /// Before:
 /// a.h:
@@ -436,6 +461,7 @@
   "Couldn't find semicolon for target declaration.");
 }
 
+auto AddInlineIfNecessary = addInl

[PATCH] D71248: [clangd] Introduce paragraph, the first part of new rendering structs

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60655 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71248



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


[PATCH] D70615: Add an -fno-temp-file flag for compilation

2019-12-10 Thread Zachary Henkel via Phabricator via cfe-commits
zahen added a comment.

Thanks Hans!  I'll need someone to do the actual submission since I don't have 
commit rights.


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

https://reviews.llvm.org/D70615



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


[PATCH] D71199: [clang-tidy][WIP] New check readability-prefer-initialization-list

2019-12-10 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 233087.
baloghadamsoftware added a comment.

Updated according to some comments.


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

https://reviews.llvm.org/D71199

Files:
  clang-tools-extra/clang-tidy/readability/CMakeLists.txt
  clang-tools-extra/clang-tidy/readability/PreferInitializationListCheck.cpp
  clang-tools-extra/clang-tidy/readability/PreferInitializationListCheck.h
  clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/docs/clang-tidy/checks/readability-prefer-initialization-list.rst
  
clang-tools-extra/test/clang-tidy/checkers/readability-prefer-initialization-list.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-prefer-initialization-list.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-prefer-initialization-list.cpp
@@ -0,0 +1,304 @@
+// RUN: %check_clang_tidy %s readability-prefer-initialization-list %t
+
+class Simple1 {
+  int n;
+  double x;
+
+public:
+  Simple1() {
+n = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: n should be initialized in the initializer list of the constructor [readability-prefer-initialization-list]
+x = 0.0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: x should be initialized in the initializer list of the constructor [readability-prefer-initialization-list]
+  }
+
+  ~Simple1() = default;
+};
+
+class Simple2 {
+  int n;
+  double x;
+
+public:
+  Simple2() : n (0) {
+x = 0.0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: x should be initialized in the initializer list of the constructor [readability-prefer-initialization-list]
+  }
+
+  ~Simple2() = default;
+};
+
+class Simple3 {
+  int n;
+  double x;
+
+public:
+  Simple3() : x (0.0) {
+n = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: n should be initialized in the initializer list of the constructor [readability-prefer-initialization-list]
+  }
+
+  ~Simple3() = default;
+};
+
+static bool dice();
+
+class Complex1 {
+  int n;
+  int m;
+
+public:
+  Complex1() : n(0) {
+if (dice())
+  m = 1;
+// NO-MESSAGES: initialization of m is nested in a conditional expression
+  }
+
+  ~Complex1() = default;
+};
+
+class Complex2 {
+  int n;
+  int m;
+
+public:
+  Complex2() : n(0) {
+if (!dice())
+  return;
+m = 1;
+// NO-MESSAGES: initialization of m follows a conditional expression
+  }
+
+  ~Complex2() = default;
+};
+
+class Complex3 {
+  int n;
+  int m;
+
+public:
+  Complex3() : n(0) {
+while (dice())
+  m = 1;
+// NO-MESSAGES: initialization of m is nested in a conditional loop
+  }
+
+  ~Complex3() = default;
+};
+
+class Complex4 {
+  int n;
+  int m;
+
+public:
+  Complex4() : n(0) {
+while (!dice())
+  return;
+m = 1;
+// NO-MESSAGES: initialization of m follows a conditional loop
+  }
+
+  ~Complex4() = default;
+};
+
+class Complex5 {
+  int n;
+  int m;
+
+public:
+  Complex5() : n(0) {
+do {
+  m = 1;
+// NO-MESSAGES: initialization of m is nested in a conditional loop
+} while (dice());
+  }
+
+  ~Complex5() = default;
+};
+
+class Complex6 {
+  int n;
+  int m;
+
+public:
+  Complex6() : n(0) {
+do {
+  return;
+} while (!dice());
+m = 1;
+// NO-MESSAGES: initialization of m follows a conditional loop
+  }
+
+  ~Complex6() = default;
+};
+
+class Complex7 {
+  int n;
+  int m;
+
+public:
+  Complex7() : n(0) {
+for (int i = 2; i < 1; ++i) {
+  m = 1;
+}
+// NO-MESSAGES: initialization of m is nested into a conditional loop
+  }
+
+  ~Complex7() = default;
+};
+
+class Complex8 {
+  int n;
+  int m;
+
+public:
+  Complex8() : n(0) {
+for (int i = 0; i < 2; ++i) {
+  return;
+}
+m = 1;
+// NO-MESSAGES: initialization of m follows a conditional loop
+  }
+
+  ~Complex8() = default;
+};
+
+class Complex9 {
+  int n;
+  int m;
+
+public:
+  Complex9() : n(0) {
+switch (dice()) {
+case 1:
+  m = 1;
+// NO-MESSAGES: initialization of m is nested in a conditional expression
+  break;
+default:
+  break;
+}
+  }
+
+  ~Complex9() = default;
+};
+
+class Complex10 {
+  int n;
+  int m;
+
+public:
+  Complex10() : n(0) {
+switch (dice()) {
+case 1:
+  return;
+  break;
+default:
+  break;
+}
+m = 1;
+// NO-MESSAGES: initialization of m follows a conditional expression
+  }
+
+  ~Complex10() = default;
+};
+
+class E {};
+void risky(); // may throw
+
+class Complex11 {
+  int n;
+  int m;
+
+public:
+  Complex11() : n(0) {
+try {
+  risky();
+  m = 1;
+// NO-MESSAGES: initialization of m follows is nested in a try-block
+} catch (const E& e) {
+  return;
+}
+  }
+
+  ~Complex11() = default;
+};
+
+class Complex12 {
+  int n;
+  int m;
+
+public:
+  Complex12() : n(0) {
+try {
+   

[PATCH] D68261: [clangd] Add "inline" keyword to prevent ODR-violations in DefineInline

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60656 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68261



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


[PATCH] D71124: [RISCV] support clang driver to select cpu

2019-12-10 Thread Kuan Hsu Chen (Zakk) via Phabricator via cfe-commits
khchen updated this revision to Diff 233082.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71124

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/RISCV.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/riscv-cpus.c


Index: clang/test/Driver/riscv-cpus.c
===
--- /dev/null
+++ clang/test/Driver/riscv-cpus.c
@@ -0,0 +1,8 @@
+// Check target CPUs are correctly passed.
+
+// RUN: %clang -target riscv32 -### -c %s 2>&1 -mcpu=rocket-rv32 | FileCheck 
-check-prefix=ROCKETCHIP32 %s
+// ROCKETCHIP32: "-fuse-init-array" "-target-cpu" "rocket-rv32"
+
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=rocket-rv64 | FileCheck 
-check-prefix=ROCKETCHIP64 %s
+// ROCKETCHIP64: "-fuse-init-array" "-target-cpu" "rocket-rv64"
+
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -304,6 +304,11 @@
 }
 return TargetCPUName;
   }
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64:
+if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
+  return A->getValue();
+return "";
 
   case llvm::Triple::bpfel:
   case llvm::Triple::bpfeb:
Index: clang/lib/Basic/Targets/RISCV.h
===
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -24,7 +24,7 @@
 // RISC-V Target
 class RISCVTargetInfo : public TargetInfo {
 protected:
-  std::string ABI;
+  std::string ABI, CPU;
   bool HasM;
   bool HasA;
   bool HasF;
@@ -43,6 +43,13 @@
 WIntType = UnsignedInt;
   }
 
+  bool setCPU(const std::string &Name) override {
+if (!isValidCPUName(Name))
+  return false;
+CPU = Name;
+return true;
+  }
+
   StringRef getABI() const override { return ABI; }
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override;
@@ -94,6 +101,7 @@
 return false;
   }
 
+  bool isValidCPUName(StringRef Name) const override;
   void setMaxAtomicWidth() override {
 MaxAtomicPromoteWidth = 128;
 
@@ -118,6 +126,7 @@
 return false;
   }
 
+  bool isValidCPUName(StringRef Name) const override;
   void setMaxAtomicWidth() override {
 MaxAtomicPromoteWidth = 128;
 
Index: clang/lib/Basic/Targets/RISCV.cpp
===
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -160,3 +160,17 @@
 
   return true;
 }
+
+static constexpr llvm::StringLiteral ValidRV32CPUNames[] = {{"generic-rv32"},
+{"rocket-rv32"}};
+
+bool RISCV32TargetInfo::isValidCPUName(StringRef Name) const {
+  return llvm::find(ValidRV32CPUNames, Name) != std::end(ValidRV32CPUNames);
+}
+
+static constexpr llvm::StringLiteral ValidRV64CPUNames[] = {{"generic-rv64"},
+{"rocket-rv64"}};
+
+bool RISCV64TargetInfo::isValidCPUName(StringRef Name) const {
+  return llvm::find(ValidRV64CPUNames, Name) != std::end(ValidRV64CPUNames);
+}


Index: clang/test/Driver/riscv-cpus.c
===
--- /dev/null
+++ clang/test/Driver/riscv-cpus.c
@@ -0,0 +1,8 @@
+// Check target CPUs are correctly passed.
+
+// RUN: %clang -target riscv32 -### -c %s 2>&1 -mcpu=rocket-rv32 | FileCheck -check-prefix=ROCKETCHIP32 %s
+// ROCKETCHIP32: "-fuse-init-array" "-target-cpu" "rocket-rv32"
+
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=rocket-rv64 | FileCheck -check-prefix=ROCKETCHIP64 %s
+// ROCKETCHIP64: "-fuse-init-array" "-target-cpu" "rocket-rv64"
+
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -304,6 +304,11 @@
 }
 return TargetCPUName;
   }
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64:
+if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
+  return A->getValue();
+return "";
 
   case llvm::Triple::bpfel:
   case llvm::Triple::bpfeb:
Index: clang/lib/Basic/Targets/RISCV.h
===
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -24,7 +24,7 @@
 // RISC-V Target
 class RISCVTargetInfo : public TargetInfo {
 protected:
-  std::string ABI;
+  std::string ABI, CPU;
   bool HasM;
   bool HasA;
   bool HasF;
@@ -43,6 +43,13 @@
 WIntType = UnsignedInt;
   }
 
+  bool setCPU(const std::string &Name) override {
+if (!isValidCPUName(Name))
+  return false;
+CPU = Name;
+return true;
+  }
+
   StringRef getABI() const override 

[PATCH] D71124: [RISCV] support clang driver to select cpu

2019-12-10 Thread Kuan Hsu Chen (Zakk) via Phabricator via cfe-commits
khchen marked 3 inline comments as done.
khchen added inline comments.



Comment at: clang/lib/Basic/Targets/RISCV.cpp:164
+
+static constexpr llvm::StringLiteral ValidRV32CPUNames[] = {{"generic-rv32"},
+{"rocket-rv32"}};

lenary wrote:
> Is there not a tablegen'd implementation of these based on 
> https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/RISCV/RISCV.td#L96-L99
>  (which will include `rocket-rv32` and `rocket-rv64` when those two schedules 
> are landed)?
you are right, if generic-cpu uses rocket chip scheduler, it's okay to abandon 
this patch.

 



Comment at: clang/lib/Basic/Targets/RISCV.h:46
 
+  bool setCPU(const std::string &Name) override {
+CPU = Name;

Jim wrote:
> I think this should test cpu name is valid first. And assign Name to CPU, if 
> it is valid.
yes, you are right, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71124



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


[PATCH] D70973: [OPENMP50]Treat context selectors as expressions, not just strings.

2019-12-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 233093.
ABataev added a comment.

Fixed misprint in the comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70973

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/OpenMP/declare_variant_ast_print.c
  clang/test/OpenMP/declare_variant_ast_print.cpp
  clang/test/OpenMP/declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp
  clang/test/OpenMP/declare_variant_messages.c
  clang/test/OpenMP/declare_variant_messages.cpp
  clang/test/OpenMP/declare_variant_mixed_codegen.cpp

Index: clang/test/OpenMP/declare_variant_mixed_codegen.cpp
===
--- clang/test/OpenMP/declare_variant_mixed_codegen.cpp
+++ clang/test/OpenMP/declare_variant_mixed_codegen.cpp
@@ -1,7 +1,8 @@
 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=50 %s
-// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=50 | FileCheck %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=50 %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t %s -emit-llvm -o - -fopenmp-version=50 | FileCheck %s
+
+// expected-warning@138 {{unknown 'ccpu' device kind trait in the 'device' context selector set, expected one of 'host', 'nohost', 'cpu', 'gpu' or 'fpga', set ignored}}
 
 // CHECK-NOT: ret i32 {{1|4|81|84}}
 // CHECK-DAG: @_Z3barv = {{.*}}alias i32 (), i32 ()* @_Z3foov
@@ -38,15 +39,15 @@
 int bar() { return 1; }
 
 int bazzz();
-#pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}, device={kind(host)})
+#pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}, device={kind("host")})
 int baz() { return 1; }
 
 int test();
-#pragma omp declare variant(test) match(implementation = {vendor(llvm)}, device={kind(cpu)})
+#pragma omp declare variant(test) match(implementation = {vendor("llvm")}, device={kind(cpu)})
 int call() { return 1; }
 
 static int stat_unused_();
-#pragma omp declare variant(stat_unused_) match(implementation = {vendor(llvm)}, device={kind(cpu)})
+#pragma omp declare variant(stat_unused_) match(implementation = {vendor("llvm")}, device={kind("cpu")})
 static int stat_unused() { return 1; }
 
 static int stat_used_();
@@ -134,4 +135,7 @@
 #pragma omp declare variant(fn_variant2) match(implementation = {vendor(llvm)}, device={kind(fpga)})
 int fn2() { return 87; }
 
+#pragma omp declare variant(fn_variant2) match(device = {kind("ccpu")})
+int wrong_kind() { return 87; }
+
 #endif // HEADER
Index: clang/test/OpenMP/declare_variant_messages.cpp
===
--- clang/test/OpenMP/declare_variant_messages.cpp
+++ clang/test/OpenMP/declare_variant_messages.cpp
@@ -30,25 +30,25 @@
 #pragma omp declare variant(foofoo ) match(xxx = {vvv} xxx) // expected-error {{expected ','}} expected-error {{expected '=' after 'xxx' context selector set name on 'omp declare variant' directive}} expected-error {{context selector set 'xxx' is used already in the same 'omp declare variant' directive}} expected-note {{previously context selector set 'xxx' used here}}
 #pragma omp declare variant(foofoo ) match(xxx = {vvv}) xxx // expected-warning {{extra tokens at the end of '#pragma omp declare variant' are ignored}}
 #pragma omp declare variant(foofoo ) match(implementation={xxx}) // expected-warning {{unknown context selector in 'implementation' context selector set of 'omp declare variant' directive, ignored}}
-#pragma omp declare variant(foofoo ) match(implementation={vendor}) // expected-error {{expected '(' after 'vendor'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-error {{expected ')' or ',' after 'vendor name'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
-#pragma omp declare variant(foofoo ) match(implementation={vendor(}) // expected-error 

[PATCH] D68213: [LTO] Support for embedding bitcode section during LTO

2019-12-10 Thread Josef Eisl via Phabricator via cfe-commits
zapster added a comment.

Thanks for your comment. I replied inline.




Comment at: llvm/lib/LTO/LTOBackend.cpp:335
+   .Case("bitcode", EmbedBitcodeKind::Embed_Bitcode)
+   .Case("marker", EmbedBitcodeKind::Embed_Marker)
+   .Default(~0U);

tejohnson wrote:
> Does this value make any sense since CmdArgs is always empty below?
You are right. Currently, this option value is not utterly useful, but I kept 
it for compatibility with clangs `-fembed-bitcode`. It seems the marker section 
is needed (even if empty), otherwise certain tools will complain (notably the 
MacOS linker). Ideally, we would have something sensible to write into the 
section but I am not sure about reasonable values. I was not able to find any 
information about consumers of these commands. Pointers in that regard would be 
highly appreciated.

Anyhow, I lean toward keeping the options for compatibility with clang and for 
making it simple to properly implement the `marker` case. That said, I am 
perfectly fine with removing the option. In that case, I guess I should get rid 
of `EmbedBitcodeKind` altogether and always insert the bitcode and the marker, 
right?

On the other hand, we should maybe just consolidate the option (parsing) with 
the clang option. Some thoughts about that in my inline comment above.


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

https://reviews.llvm.org/D68213



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: SUCCESS - 
Build artifacts :clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D70973: [OPENMP50]Treat context selectors as expressions, not just strings.

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60659 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70973



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

test `code`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71124: [RISCV] support clang driver to select cpu

2019-12-10 Thread Sam Elliott via Phabricator via cfe-commits
lenary added inline comments.



Comment at: clang/lib/Basic/Targets/RISCV.cpp:164
+
+static constexpr llvm::StringLiteral ValidRV32CPUNames[] = {{"generic-rv32"},
+{"rocket-rv32"}};

khchen wrote:
> lenary wrote:
> > Is there not a tablegen'd implementation of these based on 
> > https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/RISCV/RISCV.td#L96-L99
> >  (which will include `rocket-rv32` and `rocket-rv64` when those two 
> > schedules are landed)?
> you are right, if generic-cpu uses rocket chip scheduler, it's okay to 
> abandon this patch.
> 
>  
No, that's not quite what I mean. When we add the rocket schedules, there will 
be additional `ProcessorModel` entries for the rocket chips, in addition to the 
current generic models. 

The point in these `ProcessorModel` entries is if a user passes 
`-mcpu=generic-rv64`, then `[Feature64Bit, FeatureRVCHints]` will get turned 
on, because they chose a specific cpu. This is different to validating that the 
correct features are enabled in order to choose a cpu, which seems the correct 
way around.

Then instead of checking against hard-coded lists, you use use 
`MCSubtargetInfo::isCPUStringValid(StringRef)`, which uses the info from the 
`ProcessorModel` tablegen entries. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71124



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: SUCCESS - 
Build artifacts : clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[clang] d77ae15 - [DebugInfo] Support to emit debugInfo for extern variables

2019-12-10 Thread Yonghong Song via cfe-commits

Author: Yonghong Song
Date: 2019-12-10T08:09:51-08:00
New Revision: d77ae1552fc21a9f3877f3ed7e13d631f517c825

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

LOG: [DebugInfo] Support to emit debugInfo for extern variables

Extern variable usage in BPF is different from traditional
pure user space application. Recent discussion in linux bpf
mailing list has two use cases where debug info types are
required to use extern variables:
  - extern types are required to have a suitable interface
in libbpf (bpf loader) to provide kernel config parameters
to bpf programs.

https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23ptwazs-yayafmx...@mail.gmail.com/T/#t
  - extern types are required so kernel bpf verifier can
verify program which uses external functions more precisely.
This will make later link with actual external function no
need to reverify.

https://lore.kernel.org/bpf/87eez4odqp@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed

This patch added clang support to emit debuginfo for extern variables
with a TargetInfo hook to enable it. The debuginfo for the
extern variable is emitted only if that extern variable is
referenced in the current compilation unit.

Currently, only BPF target enables to generate debug info for
extern variables. The emission of such debuginfo is disabled for C++
 at this moment since BPF only supports a subset of C language.
Emission with C++ can be enabled later if an appropriate use case
is identified.

-fstandalone-debug permits us to see more debuginfo with the cost
of bloated binary size. This patch did not add emission of extern
variable debug info with -fstandalone-debug. This can be
re-evaluated if there is a real need.

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

Added: 
clang/test/CodeGen/debug-info-extern-basic.c
clang/test/CodeGen/debug-info-extern-duplicate.c
clang/test/CodeGen/debug-info-extern-multi.c
clang/test/CodeGen/debug-info-extern-unused.c

Modified: 
clang/include/clang/AST/ASTConsumer.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Basic/Targets/BPF.h
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ModuleBuilder.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaDecl.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/unittests/Transforms/Utils/CloningTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTConsumer.h 
b/clang/include/clang/AST/ASTConsumer.h
index dc216a89c205..ecdd8e873e1e 100644
--- a/clang/include/clang/AST/ASTConsumer.h
+++ b/clang/include/clang/AST/ASTConsumer.h
@@ -102,6 +102,11 @@ class ASTConsumer {
   /// modified by the introduction of an implicit zero initializer.
   virtual void CompleteTentativeDefinition(VarDecl *D) {}
 
+  /// CompleteExternalDeclaration - Callback invoked at the end of a 
translation
+  /// unit to notify the consumer that the given external declaration should be
+  /// completed.
+  virtual void CompleteExternalDeclaration(VarDecl *D) {}
+
   /// Callback invoked when an MSInheritanceAttr has been attached to a
   /// CXXRecordDecl.
   virtual void AssignInheritanceModel(CXXRecordDecl *RD) {}

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 33cecdadc686..bc06f59d41d4 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1389,6 +1389,9 @@ class TargetInfo : public virtual TransferrableTargetInfo,
 
   virtual void setAuxTarget(const TargetInfo *Aux) {}
 
+  /// Whether target allows debuginfo types for decl only variables.
+  virtual bool allowDebugInfoForExternalVar() const { return false; }
+
 protected:
   /// Copy type and layout related info.
   void copyAuxTarget(const TargetInfo *Aux);

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 5633f95b2c23..1cdaab3dc28c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -667,6 +667,9 @@ class Sema final {
   /// All the tentative definitions encountered in the TU.
   TentativeDefinitionsType TentativeDefinitions;
 
+  /// All the external declarations encoutered and used in the TU.
+  SmallVector ExternalDeclarations;
+
   typedef LazyVector
 UnusedFileScopedDeclsType;

diff  --git a/clang/lib/Basic/Targets/BPF.h b/clang/lib/Basic/Targets/BPF.h
index 117f81430bf4..b2f1831e960e 100644
--- a/clang/lib/Basic/Targets/BPF.h
+++ b/clang/lib/Basic/Targets/BPF.h
@@ -76,6 +76,8 @@ class LLVM_LIBRARY_VISIBILITY BPFTargetI

[PATCH] D70696: [DebugInfo] Support to emit debugInfo for extern variables

2019-12-10 Thread Yonghong Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd77ae1552fc2: [DebugInfo] Support to emit debugInfo for 
extern variables (authored by yonghong-song).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70696

Files:
  clang/include/clang/AST/ASTConsumer.h
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Basic/Targets/BPF.h
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ModuleBuilder.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGen/debug-info-extern-basic.c
  clang/test/CodeGen/debug-info-extern-duplicate.c
  clang/test/CodeGen/debug-info-extern-multi.c
  clang/test/CodeGen/debug-info-extern-unused.c
  llvm/include/llvm/IR/DIBuilder.h
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/unittests/Transforms/Utils/CloningTest.cpp

Index: llvm/unittests/Transforms/Utils/CloningTest.cpp
===
--- llvm/unittests/Transforms/Utils/CloningTest.cpp
+++ llvm/unittests/Transforms/Utils/CloningTest.cpp
@@ -764,7 +764,7 @@
 
 DBuilder.createGlobalVariableExpression(
 Subprogram, "unattached", "unattached", File, 1,
-DBuilder.createNullPtrType(), false, Expr);
+DBuilder.createNullPtrType(), false, true, Expr);
 
 auto *Entry = BasicBlock::Create(C, "", F);
 IBuilder.SetInsertPoint(Entry);
Index: llvm/lib/IR/DebugInfo.cpp
===
--- llvm/lib/IR/DebugInfo.cpp
+++ llvm/lib/IR/DebugInfo.cpp
@@ -1289,7 +1289,7 @@
   return wrap(unwrap(Builder)->createGlobalVariableExpression(
   unwrapDI(Scope), {Name, NameLen}, {Linkage, LinkLen},
   unwrapDI(File), LineNo, unwrapDI(Ty), LocalToUnit,
-  unwrap(Expr), unwrapDI(Decl),
+  true, unwrap(Expr), unwrapDI(Decl),
   nullptr, AlignInBits));
 }
 
Index: llvm/lib/IR/DIBuilder.cpp
===
--- llvm/lib/IR/DIBuilder.cpp
+++ llvm/lib/IR/DIBuilder.cpp
@@ -640,13 +640,14 @@
 
 DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
-unsigned LineNumber, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
+unsigned LineNumber, DIType *Ty, bool isLocalToUnit,
+bool isDefined, DIExpression *Expr,
 MDNode *Decl, MDTuple *templateParams, uint32_t AlignInBits) {
   checkGlobalVariableScope(Context);
 
   auto *GV = DIGlobalVariable::getDistinct(
   VMContext, cast_or_null(Context), Name, LinkageName, F,
-  LineNumber, Ty, isLocalToUnit, true, cast_or_null(Decl),
+  LineNumber, Ty, isLocalToUnit, isDefined, cast_or_null(Decl),
   templateParams, AlignInBits);
   if (!Expr)
 Expr = createExpression();
Index: llvm/include/llvm/IR/DIBuilder.h
===
--- llvm/include/llvm/IR/DIBuilder.h
+++ llvm/include/llvm/IR/DIBuilder.h
@@ -583,7 +583,7 @@
 ///specified)
 DIGlobalVariableExpression *createGlobalVariableExpression(
 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
-unsigned LineNo, DIType *Ty, bool isLocalToUnit,
+unsigned LineNo, DIType *Ty, bool isLocalToUnit, bool isDefined = true,
 DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
 MDTuple *templateParams = nullptr, uint32_t AlignInBits = 0);
 
Index: clang/test/CodeGen/debug-info-extern-unused.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-extern-unused.c
@@ -0,0 +1,27 @@
+// REQUIRES: bpf-registered-target
+// RUN: %clang -target bpf -emit-llvm -S -g %s -o - | FileCheck %s
+
+extern char ch;
+int test() {
+  return 0;
+}
+
+int test2() {
+  extern char ch2;
+  return 0;
+}
+
+extern int (*foo)(int);
+int test3() {
+  return 0;
+}
+
+int test4() {
+  extern int (*foo2)(int);
+  return 0;
+}
+
+// CHECK-NOT: distinct !DIGlobalVariable(name: "ch"
+// CHECK-NOT: distinct !DIGlobalVariable(name: "ch2"
+// CHECK-NOT: distinct !DIGlobalVariable(name: "foo"
+// CHECK-NOT: distinct !DIGlobalVariable(name: "foo2"
Index: clang/test/CodeGen/debug-info-extern-multi.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-extern-multi.c
@@ -0,0 +1,23 @@
+// REQUIRES: bpf-registered-target
+// RUN: %clang -target bpf -emit-llvm -S -g %s -o - | FileCheck %s
+
+extern char ch;
+int test() {
+  extern short sh;
+  return ch + sh;
+}
+
+extern char (*foo)(char);
+int test2() {
+  return foo(0) + ch;
+}
+
+// CHECK: distinct !DIGlobalVariable(name: "ch",{{.*}} type: ![[Tch

[clang] e6d3261 - [ARM][MVE] Refactor complex vector intrinsics [NFCI]

2019-12-10 Thread Mikhail Maltsev via cfe-commits

Author: Mikhail Maltsev
Date: 2019-12-10T16:21:52Z
New Revision: e6d3261c67ecade5d959ee3094eb2bd1cd7ec447

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

LOG: [ARM][MVE] Refactor complex vector intrinsics [NFCI]

Summary:
This patch refactors instruction selection of the complex vector
addition, multiplication and multiply-add intrinsics, so that it is
now based on TableGen patterns rather than C++ code.

It also changes the first parameter (halving vs non-halving) of the
arm_mve_vcaddq IR intrinsic to match the corresponding instruction
encoding, hence it requires some changes in the tests.

The patch addresses David's comment in https://reviews.llvm.org/D71190

Reviewers: dmgreen, ostannard, simon_tatham, MarkMurrayARM

Reviewed By: dmgreen

Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/include/clang/Basic/arm_mve.td
clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
clang/test/CodeGen/arm-mve-intrinsics/vhcaddq.c
llvm/include/llvm/IR/IntrinsicsARM.td
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll

Removed: 




diff  --git a/clang/include/clang/Basic/arm_mve.td 
b/clang/include/clang/Basic/arm_mve.td
index f3d3f4124101..618a087d6275 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -683,16 +683,16 @@ def vadciq_m: Intrinsic;
 }
 
-multiclass VectorComplexAddPred {
+multiclass VectorComplexAddPred {
   def "" : Intrinsic halving, angle, $a, $b)>;
+ (IRInt<"vcaddq", [Vector]> not_halving, angle, $a, $b)>;
   def _m : Intrinsic
-   halving, angle, $inactive, $a, $b, $pred)>;
+   not_halving, angle, $inactive, $a, $b, $pred)>;
   def _x : Intrinsic
-   halving, angle, (undef Vector), $a, $b, $pred)>;
+   not_halving, angle, (undef Vector), $a, $b, $pred)>;
 }
 
 multiclass VectorComplexMulPred {
@@ -715,9 +715,9 @@ multiclass VectorComplexMLAPred {
 (IRInt<"vcmlaq_predicated", [Vector, Predicate]> angle, $a, $b, $c, 
$pred)>;
 }
 
-multiclass VectorComplexAddAngle {
-  defm _rot90 : VectorComplexAddPred;
-  defm _rot270 : VectorComplexAddPred;
+multiclass VectorComplexAddAngle {
+  defm _rot90 : VectorComplexAddPred;
+  defm _rot270 : VectorComplexAddPred;
 }
 
 multiclass VectorComplexMulAngle {
@@ -735,10 +735,10 @@ multiclass VectorComplexMLAAngle {
 }
 
 let params = T.Usual in
-defm vcaddq : VectorComplexAddAngle<(u32 0)>;
+defm vcaddq : VectorComplexAddAngle<(u32 1)>;
 
 let params = T.Signed in
-defm vhcaddq : VectorComplexAddAngle<(u32 1)>;
+defm vhcaddq : VectorComplexAddAngle<(u32 0)>;
 
 let params = T.Float in {
 defm vcmulq : VectorComplexMulAngle;

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
index 3e00384eeb61..f23751a3526a 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
@@ -6,7 +6,7 @@
 
 // CHECK-LABEL: @test_vcaddq_rot90_u8(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 
0, i32 0, <16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]])
+// CHECK-NEXT:[[TMP0:%.*]] = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 
1, i32 0, <16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]])
 // CHECK-NEXT:ret <16 x i8> [[TMP0]]
 //
 uint8x16_t test_vcaddq_rot90_u8(uint8x16_t a, uint8x16_t b)
@@ -20,7 +20,7 @@ uint8x16_t test_vcaddq_rot90_u8(uint8x16_t a, uint8x16_t b)
 
 // CHECK-LABEL: @test_vcaddq_rot90_u16(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 
0, i32 0, <8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]])
+// CHECK-NEXT:[[TMP0:%.*]] = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 
1, i32 0, <8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]])
 // CHECK-NEXT:ret <8 x i16> [[TMP0]]
 //
 uint16x8_t test_vcaddq_rot90_u16(uint16x8_t a, uint16x8_t b)
@@ -34,7 +34,7 @@ uint16x8_t test_vcaddq_rot90_u16(uint16x8_t a, uint16x8_t b)
 
 // CHECK-LABEL: @test_vcaddq_rot90_u32(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 
0, i32 0, <4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]])
+// CHECK-NEXT:[[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 
1, i32 0, <4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]])
 // CHECK-NEXT:ret <4 x i32> [[TMP0]]
 //
 uint32x4_t test_vcaddq_rot90_u32(uint32x4_t a, uint32x4_t b)
@@ -48,7 +48,7 @@ uint32x4_t test_vcaddq_rot90_u32(uint32x4_t a, uint32x4_t b)
 
 // CHECK-LABEL: @test_vcaddq_rot90_s8(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = call <16 x i8> @l

[PATCH] D71245: [ARM][MVE] Refactor complex vector intrinsics [NFCI]

2019-12-10 Thread Mikhail Maltsev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe6d3261c67ec: [ARM][MVE] Refactor complex vector intrinsics 
[NFCI] (authored by miyuki).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71245

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/test/CodeGen/arm-mve-intrinsics/vcaddq.c
  clang/test/CodeGen/arm-mve-intrinsics/vhcaddq.c
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
===
--- llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vcaddq.ll
@@ -23,7 +23,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 0, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 0, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -33,7 +33,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 0, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 0, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -44,7 +44,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 0, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 0, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -54,7 +54,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 0, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 0, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -64,7 +64,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 0, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 0, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -75,7 +75,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 0, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 0, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -85,7 +85,7 @@
 ; CHECK-NEXT:vcadd.f16 q0, q0, q1, #90
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x half> @llvm.arm.mve.vcaddq.v8f16(i32 0, i32 0, <8 x half> %a, <8 x half> %b)
+  %0 = call <8 x half> @llvm.arm.mve.vcaddq.v8f16(i32 1, i32 0, <8 x half> %a, <8 x half> %b)
   ret <8 x half> %0
 }
 
@@ -96,7 +96,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x float> @llvm.arm.mve.vcaddq.v4f32(i32 0, i32 0, <4 x float> %a, <4 x float> %b)
+  %0 = call <4 x float> @llvm.arm.mve.vcaddq.v4f32(i32 1, i32 0, <4 x float> %a, <4 x float> %b)
   ret <4 x float> %0
 }
 
@@ -106,7 +106,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 1, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 1, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -116,7 +116,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 1, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 1, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -127,7 +127,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 1, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 1, i32 1, <4 x i32> %a, <4 x i32> %b)
   ret <4 x i32> %0
 }
 
@@ -137,7 +137,7 @@
 ; CHECK-NEXT:vcadd.i8 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 0, i32 1, <16 x i8> %a, <16 x i8> %b)
+  %0 = call <16 x i8> @llvm.arm.mve.vcaddq.v16i8(i32 1, i32 1, <16 x i8> %a, <16 x i8> %b)
   ret <16 x i8> %0
 }
 
@@ -147,7 +147,7 @@
 ; CHECK-NEXT:vcadd.i16 q0, q0, q1, #270
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 0, i32 1, <8 x i16> %a, <8 x i16> %b)
+  %0 = call <8 x i16> @llvm.arm.mve.vcaddq.v8i16(i32 1, i32 1, <8 x i16> %a, <8 x i16> %b)
   ret <8 x i16> %0
 }
 
@@ -158,7 +158,7 @@
 ; CHECK-NEXT:vmov q0, q2
 ; CHECK-NEXT:bx lr
 entry:
-  %0 = call <4 x i32> @llvm.arm.mve.vcaddq.v4i32(i32 0, i32 1, <4 x i32> %a, <4 x i32> %b)
+  %0 = call <4 x i32> @llvm.arm.mve.vc

[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Please format your changes with clang-format by running `git-clang-format 
HEAD^` or apply this patch 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[PATCH] D71197: llvm premerge: clang format test

2019-12-10 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Build result: pass - 0 tests passed, 0 failed and 0 were skipped.

Build artifacts : test-results.xml 
, clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71197



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


[clang] f3a2820 - [analyzer] Keep track of escaped locals

2019-12-10 Thread Gabor Horvath via cfe-commits

Author: Gabor Horvath
Date: 2019-12-10T08:51:33-08:00
New Revision: f3a28202ef58551db15818f8f51afd21e0f3e231

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

LOG: [analyzer] Keep track of escaped locals

We want to escape all symbols that are stored into escaped regions.
The problem is, we did not know which local regions were escaped. Until now.
This should fix some false positives like the one in the tests.

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

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
clang/lib/StaticAnalyzer/Core/ProgramState.cpp
clang/test/Analysis/symbol-escape.cpp

Removed: 




diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index 2d0967616ff2..c85a66db3457 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -627,6 +627,9 @@ class ExprEngine : public SubEngine {
const CallEvent *Call,
RegionAndSymbolInvalidationTraits &ITraits) 
override;
 
+  ProgramStateRef processLocalRegionEscape(ProgramStateRef State,
+   const MemRegion *R) const override;
+
   /// A simple wrapper when you only need to notify checkers of pointer-escape
   /// of a single value.
   ProgramStateRef escapeValue(ProgramStateRef State, SVal V,

diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index bdd12a3ffe33..b6b4a86acbb2 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -27,7 +27,7 @@
 
 namespace llvm {
 class APSInt;
-}
+} // namespace llvm
 
 namespace clang {
 class ASTContext;
@@ -872,8 +872,8 @@ class ScanReachableSymbols {
   bool scan(const SymExpr *sym);
 };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif

diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
index 7789b431c0a6..5866be2b2e7c 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -149,14 +149,16 @@ class SubEngine {
   }
 
   virtual ProgramStateRef
-  processPointerEscapedOnBind(ProgramStateRef State, SVal Loc, SVal Val, const 
LocationContext *LCtx) = 0;
+  processPointerEscapedOnBind(ProgramStateRef State, SVal Loc, SVal Val,
+  const LocationContext *LCtx) = 0;
+
+  virtual ProgramStateRef notifyCheckersOfPointerEscape(
+  ProgramStateRef State, const InvalidatedSymbols *Invalidated,
+  ArrayRef ExplicitRegions, const CallEvent *Call,
+  RegionAndSymbolInvalidationTraits &HTraits) = 0;
 
   virtual ProgramStateRef
-  notifyCheckersOfPointerEscape(ProgramStateRef State,
-   const InvalidatedSymbols *Invalidated,
-   ArrayRef ExplicitRegions,
-   const CallEvent *Call,
-   RegionAndSymbolInvalidationTraits &HTraits) = 0;
+  processLocalRegionEscape(ProgramStateRef State, const MemRegion *R) const = 
0;
 
   /// printJson - Called by ProgramStateManager to print checker-specific data.
   virtual void printJson(raw_ostream &Out, ProgramStateRef State,

diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp 
b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index efbc20f09250..b6f6481c369d 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -193,6 +193,8 @@ typedef llvm::ImmutableMap
 REGISTER_TRAIT_WITH_PROGRAMSTATE(ObjectsUnderConstruction,
  ObjectsUnderConstructionMap)
 
+REGISTER_SET_WITH_PROGRAMSTATE(EscapedLocals, const MemRegion *)
+
 
//===--===//
 // Engine construction and deletion.
 
//===--===//
@@ -723,6 +725,12 @@ void ExprEngine::removeDead(ExplodedNode *Pred, 
ExplodedNodeSet &Out,
   SymReaper.markLive(MR);
   }
 
+  EscapedLocalsTy EscapedRegions = CleanedState->get();
+  for (const MemRegion *MR : EscapedRegions) {
+i

[PATCH] D71133: [OpenCL] Add ExtVectorElementExpr constant evaluation (PR42387)

2019-12-10 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:7057
+
+if (Val.isVector()) {
+  SmallVector Indices;

can Val not be vector at this point?


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

https://reviews.llvm.org/D71133



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


[PATCH] D71152: [analyzer] Keep track of escaped locals.

2019-12-10 Thread Gábor Horváth via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf3a28202ef58: [analyzer] Keep track of escaped locals 
(authored by xazax.hun).

Changed prior to commit:
  https://reviews.llvm.org/D71152?vs=232675&id=233124#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71152

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/ProgramState.cpp
  clang/test/Analysis/symbol-escape.cpp

Index: clang/test/Analysis/symbol-escape.cpp
===
--- clang/test/Analysis/symbol-escape.cpp
+++ clang/test/Analysis/symbol-escape.cpp
@@ -31,3 +31,12 @@
   return Baz;
 }
 
+void save_ptr(int **);
+void delete_saved();
+
+void store_to_escaped_region() {
+  int *p;
+  save_ptr(&p);
+  p = new int;
+  delete_saved();
+} // no-warning
Index: clang/lib/StaticAnalyzer/Core/ProgramState.cpp
===
--- clang/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ clang/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -41,7 +41,8 @@
 Mgr.freeStates.push_back(s);
   }
 }
-}}
+} // namespace ento
+} // namespace clang
 
 ProgramState::ProgramState(ProgramStateManager *mgr, const Environment& env,
  StoreRef st, GenericDataMap gdm)
@@ -209,6 +210,13 @@
   ProgramStateRef newState = makeWithStore(newStore);
 
   if (CausedByPointerEscape) {
+for (const MemRegion *R : Invalidated) {
+  if (!R->hasStackStorage())
+continue;
+
+  newState = Eng.processLocalRegionEscape(newState, R->getBaseRegion());
+}
+
 newState = Eng.notifyCheckersOfPointerEscape(newState, IS,
  TopLevelInvalidated,
  Call,
Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -193,6 +193,8 @@
 REGISTER_TRAIT_WITH_PROGRAMSTATE(ObjectsUnderConstruction,
  ObjectsUnderConstructionMap)
 
+REGISTER_SET_WITH_PROGRAMSTATE(EscapedLocals, const MemRegion *)
+
 //===--===//
 // Engine construction and deletion.
 //===--===//
@@ -723,6 +725,12 @@
   SymReaper.markLive(MR);
   }
 
+  EscapedLocalsTy EscapedRegions = CleanedState->get();
+  for (const MemRegion *MR : EscapedRegions) {
+if (!SymReaper.isLiveRegion(MR))
+  CleanedState = CleanedState->remove(MR);
+  }
+
   getCheckerManager().runCheckersForLiveSymbols(CleanedState, SymReaper);
 
   // Create a state in which dead bindings are removed from the environment
@@ -1194,6 +1202,11 @@
   State, Scanner.getSymbols(), /*CallEvent*/ nullptr, K, nullptr);
 }
 
+ProgramStateRef ExprEngine::processLocalRegionEscape(ProgramStateRef State,
+ const MemRegion *R) const {
+  return State->add(R);
+}
+
 void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
ExplodedNodeSet &DstTop) {
   PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
@@ -2680,7 +2693,8 @@
 
 // A value escapes in four possible cases:
 // (1) We are binding to something that is not a memory region.
-// (2) We are binding to a MemRegion that does not have stack storage.
+// (2) We are binding to a MemRegion that does not have stack storage
+// or the stack storage is escaped.
 // (3) We are binding to a top-level parameter region with a non-trivial
 // destructor. We won't see the destructor during analysis, but it's there.
 // (4) We are binding to a MemRegion with stack storage that the store
@@ -2691,7 +2705,7 @@
 
   // Cases (1) and (2).
   const MemRegion *MR = Loc.getAsRegion();
-  if (!MR || !MR->hasStackStorage())
+  if (!MR || !MR->hasStackStorage() || State->contains(MR))
 return escapeValue(State, Val, PSK_EscapeOnBind);
 
   // Case (3).
Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
===
--- clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -149,14 +149,16 @@
   }
 
   virtual ProgramStateRef
-  processPointerEscapedOnBind(ProgramStateRef State, SVal Loc, SVal Val, const LocationContext *LCtx) = 0;
+  processPointerEscapedOnBind(ProgramStateRef State, SVal Loc, SVal Val,
+  const LocationContext *LCtx) = 0;

[PATCH] D69878: Consoldiate internal denormal flushing controls

2019-12-10 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:1775
-if (getLangOpts().OpenCL)
-  FuncAttrs.addAttribute("denorms-are-zero",
- llvm::toStringRef(CodeGenOpts.FlushDenorm));

arsenm wrote:
> Anastasia wrote:
> > arsenm wrote:
> > > Anastasia wrote:
> > > > so where would `denorms-are-zero` be emitted now (in case some out of 
> > > > tree implementations rely on this)?
> > > Rely on in what sense? Do you have a concrete use of this?
> > Since it has been emitted before in the module potentially some LLVM 
> > implementations could be using that attribute?
> I'm disinclined to leave things around just in case some unknown user might 
> have been using them. We've dropped attributes like this before (I think the 
> less-precise-fp-mad one for disuse). This also isn't needed for correctness, 
> so it should be pretty safe to drop
Ok, fair enough!


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

https://reviews.llvm.org/D69878



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


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked 2 inline comments as done.
jdoerfert added a comment.

In D71241#1776798 , @ABataev wrote:

> You're merging different functions as multiversiin  variants. I don't think 
> this right to overcomplicate the semantics of multiversion functions just 
> because you want to do it.


I am actually not doing that here. What over complication do you mean exactly? 
Especially because this patch does not touch multi-version functions at all I'm 
confused by your comment.




Comment at: clang/lib/Sema/SemaOverload.cpp:9725
+
+  // TODO: Handle template instantiation
+  Best->Function = cast(

ABataev wrote:
> Implement all todos and check it with the size of the code where you just 
> need to iterate through all the va4iants and call the existing functions to 
> emit their aliases.
We do not emit aliases at all with this approach. Emitting aliases does not 
work for the generic case, e.g., the construct selector trait.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71241



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


[PATCH] D71282: Fix bug 44190 - wrong code with #pragma pack(1)

2019-12-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: rjmccall, efriedma, jnspaulsson.

https://github.com/llvm/llvm-project/commit/5b330e8d6122c336d81dfd11c864e6c6240a381e
 caused
a regression on s390:

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

we need to copy if if either the argument is non-byval or the argument is 
underaligned.


https://reviews.llvm.org/D71282

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGen/s390x-packed-struct-func-arg.c


Index: clang/test/CodeGen/s390x-packed-struct-func-arg.c
===
--- /dev/null
+++ clang/test/CodeGen/s390x-packed-struct-func-arg.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -emit-llvm -o - %s \
+// RUN: | FileCheck %s
+
+struct S0 {
+  long f1;
+  int f2 : 4;
+} d;
+
+#pragma pack(1)
+struct S1 {
+  struct S0 S0_member;
+};
+
+void f(struct S0 arg) {
+  arg.f2 = 1;
+}
+
+void g() {
+  struct S1 g;
+  // CHECK: alloca %struct.S0, align 8
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 {{.*}}, i8* align 
1 {{.*}}, i64 16
+  f(g.S0_member);
+}
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -4004,9 +4004,8 @@
   auto LV = I->getKnownLValue();
   auto AS = LV.getAddressSpace();
 
-  if ((!ArgInfo.getIndirectByVal() &&
-   (LV.getAlignment() >=
-getContext().getTypeAlignInChars(I->Ty {
+  if ((!ArgInfo.getIndirectByVal() ||
+   (LV.getAlignment() < getContext().getTypeAlignInChars(I->Ty 
{
 NeedCopy = true;
   }
   if (!getLangOpts().OpenCL) {


Index: clang/test/CodeGen/s390x-packed-struct-func-arg.c
===
--- /dev/null
+++ clang/test/CodeGen/s390x-packed-struct-func-arg.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 -emit-llvm -o - %s \
+// RUN: | FileCheck %s
+
+struct S0 {
+  long f1;
+  int f2 : 4;
+} d;
+
+#pragma pack(1)
+struct S1 {
+  struct S0 S0_member;
+};
+
+void f(struct S0 arg) {
+  arg.f2 = 1;
+}
+
+void g() {
+  struct S1 g;
+  // CHECK: alloca %struct.S0, align 8
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 {{.*}}, i8* align 1 {{.*}}, i64 16
+  f(g.S0_member);
+}
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -4004,9 +4004,8 @@
   auto LV = I->getKnownLValue();
   auto AS = LV.getAddressSpace();
 
-  if ((!ArgInfo.getIndirectByVal() &&
-   (LV.getAlignment() >=
-getContext().getTypeAlignInChars(I->Ty {
+  if ((!ArgInfo.getIndirectByVal() ||
+   (LV.getAlignment() < getContext().getTypeAlignInChars(I->Ty {
 NeedCopy = true;
   }
   if (!getLangOpts().OpenCL) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71247: [clangd] Rename constructors and destructors in cross-file case

2019-12-10 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:91
   if (const auto *D = SelectedNode->ASTNode.get()) {
-if (D->getLocation() != TokenStartLoc)
-  return {};
+if (D->getLocation() != TokenStartLoc) {
+  // Destructor->getLocation() points to ~. In this case, TokenStartLoc

Braindump from an offline conversation...
This seems like an unfortunate place to put a complicated special case and it 
doesn't generalize well.

The TokenStartLoc check is a bit unfortunate to begin with - it's subject to 
all the heuristic-token-rewinding problems we've encountered in the past. Its 
one advantage over plain selectiontree is that it works at the end of the 
identifier.

Better approach seems to be:
 - we only allow rename targeted at an identifier token
 - there can be at most one identifier touching the location (if there's one 
before and after, they'd be a single identifier)
 - so find that identifier spelled token using TokenBuffer
 - then look it up as a macro (we get its start location for  free)
 - if that fails, create a selectiontree for the token's range and rename what 
we find

I don't think there's a better TokenBuffer API than calling spelledTokens() and 
binary-searching, at the moment.

This touches more code, but is less special-case-y overall. I'd consider 
putting the getIdentifierTouching(SourceLocation, TokenBuffer, SourceManager) 
in SourceCode.h


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

https://reviews.llvm.org/D71247



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


[clang] da17a53 - [OPENMP50]Add if clause in target parallel for simd directive.

2019-12-10 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2019-12-10T12:28:32-05:00
New Revision: da17a53173e0452c0a8a64a83f61a9d4af96eaa8

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

LOG: [OPENMP50]Add if clause in target parallel for simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause is false, the non-vectorized version of the
loop must be executed.

Added: 


Modified: 
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 0783bb713592..1bb08b9bca48 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -4724,6 +4724,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
 ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
 AllowedNameModifiers.push_back(OMPD_target);
 AllowedNameModifiers.push_back(OMPD_parallel);
+if (LangOpts.OpenMP >= 50)
+  AllowedNameModifiers.push_back(OMPD_simd);
 break;
   case OMPD_target_simd:
 Res = ActOnOpenMPTargetSimdDirective(ClausesWithImplicit, AStmt, StartLoc,
@@ -10697,9 +10699,13 @@ static OpenMPDirectiveKind 
getOpenMPCaptureRegionForClause(
   switch (CKind) {
   case OMPC_if:
 switch (DKind) {
+case OMPD_target_parallel_for_simd:
+  if (OpenMPVersion >= 50 &&
+  (NameModifier == OMPD_unknown || NameModifier == OMPD_simd))
+CaptureRegion = OMPD_parallel;
+  LLVM_FALLTHROUGH;
 case OMPD_target_parallel:
 case OMPD_target_parallel_for:
-case OMPD_target_parallel_for_simd:
   // If this clause applies to the nested 'parallel' region, capture within
   // the 'target' region, otherwise do not capture.
   if (NameModifier == OMPD_unknown || NameModifier == OMPD_parallel)

diff  --git a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp 
b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
index bf9516b7d0c1..91f3551d0603 100644
--- a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
@@ -1,10 +1,16 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s 
-Wno-openmp-mapping | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s 
-Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o 
%t %s -Wno-openmp-mapping
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t 
-fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t 
-fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s 
--check-prefix=CHECK --check-prefix=OMP45
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s 
-Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP50
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o 
%t %s -Wno-openmp-mapping -DOMP5
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t 
-fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s 
--check-prefix=CHECK --check-prefix=OMP50
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s 
-Wno-openmp-mapping | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s 
-Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 
-emit-pch -o %t %s -Wno-openmp-mapping
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch 
%t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch 
%t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s 
--check-prefix=CHECK --check-prefix=OMP45
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s 
-Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP50
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 
-emit-pch -o %t %s -Wno-openmp-mapping -DOMP5
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch 
%t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck 
%s --check-prefix=CHECK --check-prefix=OMP50
 // expected-no-diagnostics
 
 #ifndef HEADER
@@ -108,9 +114,14 @@ T tmain(T argc, T *argv) {
   // CHEC

[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D71241#1777661 , @jdoerfert wrote:

> In D71241#1776798 , @ABataev wrote:
>
> > You're merging different functions as multiversiin  variants. I don't think 
> > this right to overcomplicate the semantics of multiversion functions just 
> > because you want to do it.
>
>
> I am actually not doing that here.


You do this when tries to resolve the overloading though it is absolutely not 
required. You can easily implement it at the codegen phase (it is implemented 
already, actually). Because you don't need to resolve the overloads, it is 
resolved already by sema. hat you need to do is to select the correct version 
of the function and that's it. If you have global traits only, you emit alias. 
If you have local traits (like construct), you use the address of the best 
variant function directly. And no need to worry about templates, overloading 
resolution etc. Plus handling for the corner cases and future changes.

In your solution, you're actually not using mutiversioning at all, you use just 
one feature from the multiversioning - handling of multiple definitions of the 
same function. Nothing else. I'm saying that it is better to modify slightly 
the codegen because there you have to deal with the C-like constrcuts, where 
you don't need to worry about most of the problematic c++ features. But you 
insist on moving of all this stuff to Sema and overcomplicate the things.

> What over complication do you mean exactly? Especially because this patch 
> does not touch multi-version functions at all I'm confused by your comment.

Handling of templates, for example. Plus, mixing different functions (with 
different names). You have it when you try to resolve overloadings though, 
actually, we don't need to do it, we can easily do this at the codegen.

Also, check how -ast-print works with your solution. It returns different 
result than expected because you're transform the code too early. It is 
incorrect behavior.




Comment at: clang/lib/Sema/SemaOverload.cpp:9725
+
+  // TODO: Handle template instantiation
+  Best->Function = cast(

jdoerfert wrote:
> ABataev wrote:
> > Implement all todos and check it with the size of the code where you just 
> > need to iterate through all the va4iants and call the existing functions to 
> > emit their aliases.
> We do not emit aliases at all with this approach. Emitting aliases does not 
> work for the generic case, e.g., the construct selector trait.
Not directly. I know that it won't work for construct, for construct we'll need 
a little bit different approach but it is not very hard to implement.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71241



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


[PATCH] D71284: [clangd] Consider () part of the FunctionDecl, not the FunctionTypeLoc

2019-12-10 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

CODE: int foo(int);
OLD:  TTT FFFT
NEW:  TTT TTTF

This works around targeting issues when the cursor is between name and (


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71284

Files:
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/test/hover.test
  clang-tools-extra/clangd/unittests/SelectionTests.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -971,7 +971,7 @@
   // Not a definition
   vo^i[[d^ ^f]]^oo();
 
-  [[vo^id ]]foo[[()]] {[[
+  [[vo^id ]]foo() {[[
 [[(void)(5+3);
 return;]]
   }]]
@@ -1879,7 +1879,7 @@
 // Not a definition
 vo^i[[d^ ^f]]^oo();
 
-[[vo^id ]]foo[[()]] {[[
+[[vo^id ]]foo() {[[
   [[(void)(5+3);
   return;]]
 }]])cpp");
Index: clang-tools-extra/clangd/unittests/SelectionTests.cpp
===
--- clang-tools-extra/clangd/unittests/SelectionTests.cpp
+++ clang-tools-extra/clangd/unittests/SelectionTests.cpp
@@ -249,10 +249,10 @@
   {"void foo() { [[foo^()]]; /*comment*/^}", "CallExpr"},
 
   // Tricky case: FunctionTypeLoc in FunctionDecl has a hole in it.
-  {"[[^void]] foo();", "BuiltinTypeLoc"},
-  {"[[void foo^()]];", "FunctionProtoTypeLoc"},
-  {"[[^void foo^()]];", "FunctionDecl"},
-  {"[[void ^foo()]];", "FunctionDecl"},
+  {"[[^void]] foo(int);", "BuiltinTypeLoc"},
+  {"[[void foo^(int)]];", "FunctionDecl"},
+  {"[[^void foo^(int)]];", "FunctionDecl"},
+  {"[[void ^foo(int)]];", "FunctionDecl"},
   // Tricky case: two VarDecls share a specifier.
   {"[[int ^a]], b;", "VarDecl"},
   {"[[int a, ^b]];", "VarDecl"},
Index: clang-tools-extra/clangd/test/hover.test
===
--- clang-tools-extra/clangd/test/hover.test
+++ clang-tools-extra/clangd/test/hover.test
@@ -24,7 +24,7 @@
 # CHECK-NEXT:  }
 # CHECK-NEXT:}
 ---
-{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":10}}}
+{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":0}}}
 #  CHECK:  "id": 1,
 # CHECK-NEXT:  "jsonrpc": "2.0",
 # CHECK-NEXT:  "result": null
Index: clang-tools-extra/clangd/Selection.cpp
===
--- clang-tools-extra/clangd/Selection.cpp
+++ clang-tools-extra/clangd/Selection.cpp
@@ -547,14 +547,13 @@
   // Pushes a node onto the ancestor stack. Pairs with pop().
   // Performs early hit detection for some nodes (on the earlySourceRange).
   void push(DynTypedNode Node) {
-SourceRange Early = earlySourceRange(Node);
 dlog("{1}push: {0}", printNodeToString(Node, PrintPolicy), indent());
 Nodes.emplace_back();
 Nodes.back().ASTNode = std::move(Node);
 Nodes.back().Parent = Stack.top();
 Nodes.back().Selected = NoTokens;
 Stack.push(&Nodes.back());
-claimRange(Early, Nodes.back().Selected);
+claimEarlyRange(Node, Nodes.back().Selected);
   }
 
   // Pops a node off the ancestor stack, and finalizes it. Pairs with push().
@@ -579,19 +578,26 @@
   // Returns the range of tokens that this node will claim directly, and
   // is not available to the node's children.
   // Usually empty, but sometimes children cover tokens but shouldn't own them.
-  SourceRange earlySourceRange(const DynTypedNode &N) {
+  void claimEarlyRange(const DynTypedNode &N,
+   SelectionTree::Selection &Selected) {
+auto Claim = [&](SourceRange R) { claimRange(R, Selected); };
 if (const Decl *D = N.get()) {
-  // void [[foo]]();
-  if (auto *FD = llvm::dyn_cast(D))
-return FD->getNameInfo().getSourceRange();
+  if (auto *FD = llvm::dyn_cast(D)) {
+// void [[foo]]();
+Claim(FD->getNameInfo().getSourceRange());
+// Also claim the parens. Formally, the FunctionTypeLoc is more precise,
+// but it's not a very "useful" node (e.g. we can't find its target).
+// Associating the parens with the function is what users expect.
+Claim(FD->getFunctionTypeLoc().getLParenLoc());
+Claim(FD->getFunctionTypeLoc().getRParenLoc());
+  }
   // int (*[[s]])();
   else if (auto *VD = llvm::dyn_cast(D))
-return VD->getLocation();
+Claim(VD->getLocation());
 } else if (const auto* CCI = N.get()) {
   // : [[b_]](42)
-  return CCI->getMemberLocation();
+  Claim(CCI->getMe

[PATCH] D71282: Fix bug 44190 - wrong code with #pragma pack(1)

2019-12-10 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:4008
+  if ((!ArgInfo.getIndirectByVal() ||
+   (LV.getAlignment() < getContext().getTypeAlignInChars(I->Ty 
{
 NeedCopy = true;

Thanks for the fix.  Please remove all the unnecessary parens, but otherwise 
LGTM.


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

https://reviews.llvm.org/D71282



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


[PATCH] D69764: [clang-format] Add Left/Right Const (East/West , Before/After) fixer capability

2019-12-10 Thread Ilya Mirsky via Phabricator via cfe-commits
ilya added a comment.

> I think this would likely make everything much more complicated, but perhaps 
> we should think about this for the configuration at least now so we future 
> proof ourselves.

What you've outlined looks good to me.
Of course we will be happy to contribute, given there will be an interest from 
the community, but as you said, for now at least let's keep this in mind for 
the configuration and naming.


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

https://reviews.llvm.org/D69764



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


[PATCH] D70256: [FPEnv] clang support for constrained FP builtins

2019-12-10 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM.


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

https://reviews.llvm.org/D70256



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


[clang] d62a151 - [OPENMP]Remove extra space from error message.

2019-12-10 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2019-12-10T12:55:40-05:00
New Revision: d62a15116b68c1d1ce7e4f3d6a9cd891670b03c5

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

LOG: [OPENMP]Remove extra space from error message.

Fixed emission of 2 consecutive whitespaces in the error message.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/OpenMP/target_parallel_for_if_messages.cpp
clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp
clang/test/OpenMP/target_parallel_if_messages.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_messages.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 939287014d9e..8a0ff1e8a697 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9519,7 +9519,7 @@ def err_omp_wrong_if_directive_name_modifier : Error<
 def err_omp_no_more_if_clause : Error<
   "no more 'if' clause is allowed">;
 def err_omp_unnamed_if_clause : Error<
-  "expected %select{|one of}0 %1 directive name modifier%select{|s}0">;
+  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
 def note_omp_previous_named_if_clause : Note<
   "previous clause with directive name modifier specified here">;
 def err_omp_ordered_directive_with_param : Error<

diff  --git a/clang/test/OpenMP/target_parallel_for_if_messages.cpp 
b/clang/test/OpenMP/target_parallel_for_if_messages.cpp
index a5a181b9d273..99bb13d24f2b 100644
--- a/clang/test/OpenMP/target_parallel_for_if_messages.cpp
+++ b/clang/test/OpenMP/target_parallel_for_if_messages.cpp
@@ -60,7 +60,7 @@ int tmain(T argc, S **argv) {
   for (i = 0; i < argc; ++i) foo();
   #pragma omp target parallel for if(parallel : argc) if (parallel :argc) // 
expected-error {{directive '#pragma omp target parallel for' cannot contain 
more than one 'if' clause with 'parallel' name modifier}}
   for (i = 0; i < argc; ++i) foo();
-  #pragma omp target parallel for if(target : argc) if (argc) // 
expected-error {{expected  'parallel' directive name modifier}} expected-note 
{{previous clause with directive name modifier specified here}}
+  #pragma omp target parallel for if(target : argc) if (argc) // 
expected-error {{expected 'parallel' directive name modifier}} expected-note 
{{previous clause with directive name modifier specified here}}
   for (i = 0; i < argc; ++i) foo();
   #pragma omp target parallel for if(target : argc) if(parallel : argc) if 
(argc) // expected-error {{no more 'if' clause is allowed}} expected-note 
{{previous clause with directive name modifier specified here}} expected-note 
{{previous clause with directive name modifier specified here}}
   for (i = 0; i < argc; ++i) foo();
@@ -106,7 +106,7 @@ int main(int argc, char **argv) {
   for (i = 0; i < argc; ++i) foo();
   #pragma omp target parallel for if(parallel : argc) if (parallel :argc) // 
expected-error {{directive '#pragma omp target parallel for' cannot contain 
more than one 'if' clause with 'parallel' name modifier}}
   for (i = 0; i < argc; ++i) foo();
-  #pragma omp target parallel for if(target : argc) if (argc) // 
expected-error {{expected  'parallel' directive name modifier}} expected-note 
{{previous clause with directive name modifier specified here}}
+  #pragma omp target parallel for if(target : argc) if (argc) // 
expected-error {{expected 'parallel' directive name modifier}} expected-note 
{{previous clause with directive name modifier specified here}}
   for (i = 0; i < argc; ++i) foo();
   #pragma omp target parallel for if(target : argc) if(parallel : argc) if 
(argc) // expected-error {{no more 'if' clause is allowed}} expected-note 
{{previous clause with directive name modifier specified here}} expected-note 
{{previous clause with directive name modifier specified here}}
   for (i = 0; i < argc; ++i) foo();

diff  --git a/clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp 
b/clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp
index a1588f8fce29..aa6cec1bd2bc 100644
--- a/clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp
+++ b/clang/test/OpenMP/target_parallel_for_simd_if_messages.cpp
@@ -63,9 +63,9 @@ int tmain(T argc, S **argv) {
   for (i = 0; i < argc; ++i) foo();
   #pragma omp target parallel for simd if(parallel : argc) if (parallel :argc) 
// expected-error {{directive '#pragma omp target parallel for simd' cannot 
contain more than one 'if' clause with 'parallel' name modifier}}
   for (i = 0; i < argc; ++i) foo();
-  #pragma omp target parallel for simd if(target : argc) if (argc) // 
omp45-error {{expected  'parallel' dir

[clang] 6515c52 - [FPEnv] clang support for constrained FP builtins

2019-12-10 Thread Kevin P. Neal via cfe-commits

Author: Kevin P. Neal
Date: 2019-12-10T13:09:12-05:00
New Revision: 6515c524b0ae50dd5bb052558afa8c81d3a75780

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

LOG: [FPEnv] clang support for constrained FP builtins

Change the IRBuilder and clang so that constrained FP intrinsics will be
emitted for builtins when appropriate. Only non-target-specific builtins
are affected in this patch.

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

Added: 
clang/test/CodeGen/constrained-math-builtins.c

Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
llvm/include/llvm/IR/IRBuilder.h

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 2b2738252a05..68c956a98637 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -348,6 +348,58 @@ static Value *EmitISOVolatileStore(CodeGenFunction &CGF, 
const CallExpr *E) {
   return Store;
 }
 
+// Emit a simple mangled intrinsic that has 1 argument and a return type
+// matching the argument type. Depending on mode, this may be a constrained
+// floating-point intrinsic.
+static Value *emitUnaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
+const CallExpr *E, unsigned IntrinsicID,
+unsigned ConstrainedIntrinsicID) {
+  llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
+
+  if (CGF.Builder.getIsFPConstrained()) {
+Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+return CGF.Builder.CreateConstrainedFPCall(F, { Src0 });
+  } else {
+Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+return CGF.Builder.CreateCall(F, Src0);
+  }
+}
+  
+// Emit an intrinsic that has 2 operands of the same type as its result.
+// Depending on mode, this may be a constrained floating-point intrinsic.
+static Value *emitBinaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
+const CallExpr *E, unsigned IntrinsicID,
+unsigned ConstrainedIntrinsicID) {
+  llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
+  llvm::Value *Src1 = CGF.EmitScalarExpr(E->getArg(1));
+
+  if (CGF.Builder.getIsFPConstrained()) {
+Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1 });
+  } else {
+Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+return CGF.Builder.CreateCall(F, { Src0, Src1 });
+  }
+}
+
+// Emit an intrinsic that has 3 operands of the same type as its result.
+// Depending on mode, this may be a constrained floating-point intrinsic.
+static Value *emitTernaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
+ const CallExpr *E, unsigned IntrinsicID,
+ unsigned ConstrainedIntrinsicID) {
+  llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
+  llvm::Value *Src1 = CGF.EmitScalarExpr(E->getArg(1));
+  llvm::Value *Src2 = CGF.EmitScalarExpr(E->getArg(2));
+
+  if (CGF.Builder.getIsFPConstrained()) {
+Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1, Src2 });
+  } else {
+Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+return CGF.Builder.CreateCall(F, { Src0, Src1, Src2 });
+  }
+}
+
 // Emit a simple mangled intrinsic that has 1 argument and a return type
 // matching the argument type.
 static Value *emitUnaryBuiltin(CodeGenFunction &CGF,
@@ -394,15 +446,22 @@ static Value *emitFPIntBuiltin(CodeGenFunction &CGF,
 }
 
 // Emit an intrinsic that has overloaded integer result and fp operand.
-static Value *emitFPToIntRoundBuiltin(CodeGenFunction &CGF,
-  const CallExpr *E,
-  unsigned IntrinsicID) {
-   llvm::Type *ResultType = CGF.ConvertType(E->getType());
-   llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
+static Value *
+emitMaybeConstrainedFPToIntRoundBuiltin(CodeGenFunction &CGF, const CallExpr 
*E,
+unsigned IntrinsicID,
+unsigned ConstrainedIntrinsicID) {
+  llvm::Type *ResultType = CGF.ConvertType(E->getType());
+  llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
 
-   Function *F = CGF.CGM.getIntrinsic(IntrinsicID,
-  {ResultType, Src0->getType()});
-   return CGF.Builder.CreateCall(F, Src0);
+  if (CGF.Builder.getIsFPConstrained()) {
+Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID,
+   {ResultType, Src0->getType()});
+return CGF.Builder.CreateConstrainedFPCall(F, {Src0});

[PATCH] D71282: Fix bug 44190 - wrong code with #pragma pack(1)

2019-12-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done.
yaxunl added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:4008
+  if ((!ArgInfo.getIndirectByVal() ||
+   (LV.getAlignment() < getContext().getTypeAlignInChars(I->Ty 
{
 NeedCopy = true;

rjmccall wrote:
> Thanks for the fix.  Please remove all the unnecessary parens, but otherwise 
> LGTM.
fixed


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

https://reviews.llvm.org/D71282



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


[PATCH] D70819: [ASTImporter] Support functions with placeholder return types ...

2019-12-10 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

Apologies for wacky C++ code that follows but will this also work for the 
following cases:

  auto f2() { 
auto l = []() {
struct X{};
return X();
};
   return l(); 
   }
  
   auto f3() { 
if ( struct X{} x; true) 
return X();
else return X();
   }
  
   auto f4() {
  for(struct X{} x;;)
 return X();
   }
  
   auto f5() {
  switch(struct X{} x; 10) {
case 10:
 return X();
  }
   }

godbolt live example 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70819



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


[PATCH] D71284: [clangd] Consider () part of the FunctionDecl, not the FunctionTypeLoc

2019-12-10 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60682 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71284



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


[PATCH] D70256: [FPEnv] clang support for constrained FP builtins

2019-12-10 Thread Kevin P. Neal via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6515c524b0ae: [FPEnv] clang support for constrained FP 
builtins (authored by kpn).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70256

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/constrained-math-builtins.c
  llvm/include/llvm/IR/IRBuilder.h

Index: llvm/include/llvm/IR/IRBuilder.h
===
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -2087,6 +2087,8 @@
 case Intrinsic::experimental_constrained_fpext:
 case Intrinsic::experimental_constrained_fptoui:
 case Intrinsic::experimental_constrained_fptosi:
+case Intrinsic::experimental_constrained_lround:
+case Intrinsic::experimental_constrained_llround:
   C = CreateIntrinsic(ID, {DestTy, V->getType()}, {V, ExceptV}, nullptr,
   Name);
   break;
@@ -2297,6 +2299,37 @@
 Args, OpBundles, Name, FPMathTag);
   }
 
+  // Deprecated [opaque pointer types]
+  CallInst *CreateConstrainedFPCall(
+  Value *Callee, ArrayRef Args, const Twine &Name = "",
+  Optional Rounding = None,
+  Optional Except = None) {
+llvm::SmallVector UseArgs;
+
+for (auto *OneArg : Args)
+  UseArgs.push_back(OneArg);
+Function *F = cast(Callee);
+switch (F->getIntrinsicID()) {
+default:
+  UseArgs.push_back(getConstrainedFPRounding(Rounding));
+  break;
+case Intrinsic::experimental_constrained_fpext:
+case Intrinsic::experimental_constrained_fptoui:
+case Intrinsic::experimental_constrained_fptosi:
+case Intrinsic::experimental_constrained_lround:
+case Intrinsic::experimental_constrained_llround:
+  // No rounding metadata for these intrinsics.
+  break;
+}
+UseArgs.push_back(getConstrainedFPExcept(Except));
+
+CallInst *C = CreateCall(
+cast(Callee->getType()->getPointerElementType()), Callee,
+UseArgs, Name);
+setConstrainedFPCallAttr(C);
+return C;
+  }
+
   Value *CreateSelect(Value *C, Value *True, Value *False,
   const Twine &Name = "", Instruction *MDFrom = nullptr) {
 if (auto *CC = dyn_cast(C))
Index: clang/test/CodeGen/constrained-math-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/constrained-math-builtins.c
@@ -0,0 +1,150 @@
+// RUN: %clang_cc1 -triple x86_64-linux -ffp-exception-behavior=strict -w -S -o - -emit-llvm %s | FileCheck %s
+
+// Test codegen of constrained math builtins.
+
+void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
+  f = __builtin_fmod(f,f);f = __builtin_fmodf(f,f);   f =  __builtin_fmodl(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.frem.f64(double, double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.frem.f32(float, float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.frem.f80(x86_fp80, x86_fp80, metadata, metadata)
+
+  __builtin_pow(f,f);__builtin_powf(f,f);   __builtin_powl(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.pow.f64(double, double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.pow.f32(float, float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.pow.f80(x86_fp80, x86_fp80, metadata, metadata)
+
+  __builtin_powi(f,f);__builtin_powif(f,f);   __builtin_powil(f,f);
+
+// CHECK: declare double @llvm.experimental.constrained.powi.f64(double, i32, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.powi.f32(float, i32, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.powi.f80(x86_fp80, i32, metadata, metadata)
+
+  __builtin_ceil(f);   __builtin_ceilf(f);  __builtin_ceill(f);
+
+// CHECK: declare double @llvm.experimental.constrained.ceil.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.ceil.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.ceil.f80(x86_fp80, metadata, metadata)
+
+  __builtin_cos(f);__builtin_cosf(f);   __builtin_cosl(f); 
+
+// CHECK: declare double @llvm.experimental.constrained.cos.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.cos.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.cos.f80(x86_fp80, metadata, metadata)
+
+  __builtin_exp(f);__builtin_expf(f);   __builtin_expl(f);
+
+// CHECK: declare double @llvm.experimental.constrained.exp.f64(double, metadata, metadata)
+// CHECK: declare float @llvm.experimental.constrained.exp.f32(float, metadata, metadata)
+// CHECK: declare x86_fp80 @llvm.experimental.constrained.exp.f80(x

  1   2   3   >