[all-commits] [llvm/llvm-project] d74212: [ConstantFold] Remove unnecessary bounded index re...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 4 06:23:26 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d74212987b35c94ddef3aa5c18096fc1f4ee5112
      https://github.com/llvm/llvm-project/commit/d74212987b35c94ddef3aa5c18096fc1f4ee5112
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M clang/test/CodeGen/clear_cache.c
    M clang/test/CodeGenCXX/cxx11-initializer-aggregate.cpp
    M clang/test/CodeGenCXX/for-range.cpp
    M clang/test/CodeGenCXX/global-array-destruction.cpp
    M clang/test/CodeGenCXX/template-param-objects.cpp
    M clang/test/OpenMP/for_firstprivate_codegen.cpp
    M clang/test/OpenMP/parallel_copyin_codegen.cpp
    M clang/test/OpenMP/sections_firstprivate_codegen.cpp
    M clang/test/OpenMP/single_codegen.cpp
    M clang/test/OpenMP/single_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/threadprivate_codegen.cpp
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/Transforms/SCCP/apint-bigint2.ll
    M llvm/test/Transforms/SCCP/replace-dereferenceable-ptr-with-undereferenceable.ll

  Log Message:
  -----------
  [ConstantFold] Remove unnecessary bounded index restriction

The fold for merging a GEP of GEP into a single GEP currently bails
if doing so would result in notional overindexing. The justification
given in the comment above this check is dangerously incorrect: GEPs
with notional overindexing are perfectly fine, and if some code
treats them incorrectly, then that code is broken, not the GEP.
Such a GEP might legally appear in source IR, so only preventing
its creation cannot be sufficient. (The constant folder also ends
up canonicalizing the GEP to remove the notional overindexing, but
that's neither here nor there.)

This check dates back to
https://github.com/llvm/llvm-project/commit/bd4fef4a8939db18f39b108e19097b25e2c7c47a,
and as far as I can tell the original issue this was trying to
patch around has since been resolved.

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




More information about the All-commits mailing list