[PATCH] D69542: Full Restrict Support - single patch

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 27 09:13:09 PDT 2023


jeroen.dobbelaere updated this revision to Diff 526273.
jeroen.dobbelaere edited the summary of this revision.
jeroen.dobbelaere added a comment.
Herald added a reviewer: sscalpone.

This is a rebase, based on dd2e681612f1f09d92abc9e16f5f65293e3fe725 <https://reviews.llvm.org/rGdd2e681612f1f09d92abc9e16f5f65293e3fe725> (May 27, 2023). It fully incorporates the ptr_provenance patches (D111159 <https://reviews.llvm.org/D111159>)

There are a number of known issues that have not yet been resolved. Those are available in testcases and have been marked with XFAIL
(a grep for XFAIL in this patch should show them) :

- wrong (too optimistic) assumption when mixing restrict and non-restrict based pointers:
  - with a global variable as restrict pointer
  - escape analysis misses cases where a noalias pointer (restrict annotated pointer) escapes through a double (or more) indirection
- LICM introduces inconsistencies in noalias.scope metadata (through phi nodes).
- LICM exposes an issue with AliasSet where ptr_provenance data is missed.

In the most recent rebase (between May 13 and may 27), I also noticed a change in behavior for an OpenMP testcase. That testcase has also been changed to XFAIL.

During June, I should be able to come up with an update that fixes those known issues.

As usual, any feedback is welcome. If you want to help out or discuss, you can always join the 4-weekly LLVM AA Technical calls.


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

https://reviews.llvm.org/D69542

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/Type.cpp
  clang/lib/CodeGen/Address.h
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprAgg.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CMakeLists.txt
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/CodeGenNoAliasOffsets.cpp
  clang/lib/CodeGen/CodeGenNoAliasOffsets.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma-types.c
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/aarch64-ls64.c
  clang/test/CodeGen/arm_neon_intrinsics.c
  clang/test/CodeGen/restrict/arg_reuse.c
  clang/test/CodeGen/restrict/array.c
  clang/test/CodeGen/restrict/basic.c
  clang/test/CodeGen/restrict/basic_opt_01.c
  clang/test/CodeGen/restrict/basic_opt_02.c
  clang/test/CodeGen/restrict/basic_opt_03.c
  clang/test/CodeGen/restrict/basic_opt_04.c
  clang/test/CodeGen/restrict/capture_checks_01.c
  clang/test/CodeGen/restrict/capture_checks_02.c
  clang/test/CodeGen/restrict/escape_through_volatile.c
  clang/test/CodeGen/restrict/inlining_01.c
  clang/test/CodeGen/restrict/inlining_02.c
  clang/test/CodeGen/restrict/licm_01.c
  clang/test/CodeGen/restrict/licm_02.c
  clang/test/CodeGen/restrict/provenance.noalias_reduction_01.c
  clang/test/CodeGen/restrict/struct.c
  clang/test/CodeGen/restrict/struct_base_class_09.cpp
  clang/test/CodeGen/restrict/struct_member_01.c
  clang/test/CodeGen/restrict/struct_member_02.c
  clang/test/CodeGen/restrict/struct_member_03.c
  clang/test/CodeGen/restrict/struct_member_04.c
  clang/test/CodeGen/restrict/struct_member_05.c
  clang/test/CodeGen/restrict/struct_member_06.c
  clang/test/CodeGen/restrict/struct_member_07.c
  clang/test/CodeGen/restrict/struct_member_08.cpp
  clang/test/CodeGenCUDA/builtins-amdgcn.cu
  clang/test/Driver/full-restrict.c
  clang/test/OpenMP/bug57757.cpp
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_firstprivate_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/master_taskloop_private_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/nested_loop_codegen.cpp
  clang/test/OpenMP/nvptx_param_translate.c
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_private_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/target_in_reduction_codegen.cpp
  clang/test/OpenMP/target_ompx_dyn_cgroup_mem_codegen.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/target_task_affinity_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp
  clang/test/OpenMP/task_codegen.cpp
  clang/test/OpenMP/task_firstprivate_codegen.cpp
  clang/test/OpenMP/task_if_codegen.cpp
  clang/test/OpenMP/task_in_reduction_codegen.cpp
  clang/test/OpenMP/task_member_call_codegen.cpp
  clang/test/OpenMP/task_private_codegen.cpp
  clang/test/OpenMP/task_target_device_codegen.c
  clang/test/OpenMP/taskloop_firstprivate_codegen.cpp
  clang/test/OpenMP/taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/taskloop_private_codegen.cpp
  clang/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_reduction_task_codegen.cpp
  llvm/docs/LangRef.rst
  llvm/docs/NoAliasInfo.rst
  llvm/docs/UserGuides.rst
  llvm/include/llvm-c/Core.h
  llvm/include/llvm/Analysis/BasicAliasAnalysis.h
  llvm/include/llvm/Analysis/MemoryLocation.h
  llvm/include/llvm/Analysis/ScopedNoAliasAA.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/Analysis/ValueTracking.h
  llvm/include/llvm/Analysis/VectorUtils.h
  llvm/include/llvm/AsmParser/LLParser.h
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/CodeGen/MachineMemOperand.h
  llvm/include/llvm/IR/Constant.h
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/InstVisitor.h
  llvm/include/llvm/IR/Instruction.h
  llvm/include/llvm/IR/Instructions.h
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/include/llvm/IR/Intrinsics.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/MDBuilder.h
  llvm/include/llvm/IR/Metadata.h
  llvm/include/llvm/IR/User.h
  llvm/include/llvm/IR/Value.def
  llvm/include/llvm/IR/Value.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/ConnectNoAliasDecl.h
  llvm/include/llvm/Transforms/Scalar/PropagateAndConvertNoAlias.h
  llvm/include/llvm/Transforms/Utils/Cloning.h
  llvm/include/llvm/Transforms/Utils/NoAliasUtils.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/lib/Analysis/CaptureTracking.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/MemoryLocation.cpp
  llvm/lib/Analysis/ScopedNoAliasAA.cpp
  llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/IntrinsicLowering.cpp
  llvm/lib/CodeGen/MIRParser/MILexer.cpp
  llvm/lib/CodeGen/MIRParser/MILexer.h
  llvm/lib/CodeGen/MIRParser/MIParser.cpp
  llvm/lib/CodeGen/MachineOperand.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/LLVMContextImpl.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/MDBuilder.cpp
  llvm/lib/IR/Metadata.cpp
  llvm/lib/IR/Value.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/ConnectNoAliasDecl.cpp
  llvm/lib/Transforms/Scalar/EarlyCSE.cpp
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Scalar/JumpThreading.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Scalar/PropagateAndConvertNoAlias.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Utils/CloneFunction.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/LoopPeel.cpp
  llvm/lib/Transforms/Utils/LoopUnroll.cpp
  llvm/lib/Transforms/Utils/NoAliasUtils.cpp
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/lib/Transforms/Utils/ValueMapper.cpp
  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Analysis/BasicAA/noalias-intr.ll
  llvm/test/Analysis/ScopedNoAliasAA/basic-domains.ll
  llvm/test/Analysis/ScopedNoAliasAA/basic2.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias-calls.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias-dup-scope.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias2.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_basics.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_member.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_phi.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_phi_in_loop.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_recursive.ll
  llvm/test/Analysis/ScopedNoAliasAA/noalias_select.ll
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/loadstore_ptr_provenance.ll
  llvm/test/CodeGen/Generic/noalias.ll
  llvm/test/CodeGen/Generic/provenance.noalias.ll
  llvm/test/CodeGen/Generic/ptr_provenance.ll
  llvm/test/CodeGen/X86/ptr_provenance_memoperand.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-pgo-preinline.ll
  llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/ConnectNoAliasDecl/basictest.ll
  llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll
  llvm/test/Transforms/Coroutines/coro-retcon-value.ll
  llvm/test/Transforms/DeadArgElim/noalias.ll
  llvm/test/Transforms/EarlyCSE/basic.ll
  llvm/test/Transforms/FunctionAttrs/nocapture.ll
  llvm/test/Transforms/FunctionAttrs/nonnull.ll
  llvm/test/Transforms/Inline/inline-noalias-unidentify-object.ll
  llvm/test/Transforms/Inline/launder.invariant.group.ll
  (46 more files...)



More information about the llvm-commits mailing list