[all-commits] [llvm/llvm-project] 90ba33: [InstCombine] Canonicalize constant GEPs to i8 sou...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Wed Jan 24 06:25:42 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 90ba33099cbb17e7c159e9ebc5a512037db99d6d
https://github.com/llvm/llvm-project/commit/90ba33099cbb17e7c159e9ebc5a512037db99d6d
Author: Nikita Popov <npopov at redhat.com>
Date: 2024-01-24 (Wed, 24 Jan 2024)
Changed paths:
M clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma.c
M clang/test/CodeGen/aarch64-ls64-inline-asm.c
M clang/test/CodeGen/attr-arm-sve-vector-bits-bitcast.c
M clang/test/CodeGen/attr-counted-by.c
M clang/test/CodeGen/attr-riscv-rvv-vector-bits-bitcast.c
M clang/test/CodeGen/cleanup-destslot-simple.c
M clang/test/CodeGen/hexagon-brev-ld-ptr-incdec.c
M clang/test/CodeGen/ms-intrinsics.c
M clang/test/CodeGen/nofpclass.c
M clang/test/CodeGen/union-tbaa1.c
M clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
M clang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp
M clang/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp
M clang/test/CodeGenCXX/microsoft-abi-typeid.cpp
M clang/test/CodeGenObjC/arc-foreach.m
M clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm
M clang/test/Headers/__clang_hip_math.hip
M clang/test/OpenMP/bug57757.cpp
M flang/test/HLFIR/no-block-merging.fir
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Analysis/BasicAA/featuretest.ll
M llvm/test/CodeGen/AMDGPU/vector-alloca-bitcast.ll
M llvm/test/CodeGen/BPF/preserve-static-offset/load-inline.ll
M llvm/test/CodeGen/BPF/preserve-static-offset/load-unroll-inline.ll
M llvm/test/CodeGen/BPF/preserve-static-offset/load-unroll.ll
M llvm/test/CodeGen/BPF/preserve-static-offset/store-unroll-inline.ll
M llvm/test/CodeGen/Hexagon/autohvx/vector-align-tbaa.ll
M llvm/test/Transforms/Coroutines/coro-async.ll
M llvm/test/Transforms/Coroutines/coro-retcon-alloca-opaque-ptr.ll
M llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll
M llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll
M llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
M llvm/test/Transforms/Coroutines/coro-swifterror.ll
M llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
M llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
M llvm/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
M llvm/test/Transforms/InstCombine/X86/x86-addsub-inseltpoison.ll
M llvm/test/Transforms/InstCombine/X86/x86-addsub.ll
M llvm/test/Transforms/InstCombine/add3.ll
M llvm/test/Transforms/InstCombine/array.ll
M llvm/test/Transforms/InstCombine/assume.ll
M llvm/test/Transforms/InstCombine/cast_phi.ll
M llvm/test/Transforms/InstCombine/catchswitch-phi.ll
M llvm/test/Transforms/InstCombine/compare-alloca.ll
M llvm/test/Transforms/InstCombine/extractvalue.ll
M llvm/test/Transforms/InstCombine/gep-addrspace.ll
M llvm/test/Transforms/InstCombine/gep-canonicalize-constant-indices.ll
M llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll
M llvm/test/Transforms/InstCombine/gep-custom-dl.ll
M llvm/test/Transforms/InstCombine/gep-merge-constant-indices.ll
M llvm/test/Transforms/InstCombine/gep-vector-indices.ll
M llvm/test/Transforms/InstCombine/gep-vector.ll
M llvm/test/Transforms/InstCombine/gepphigep.ll
M llvm/test/Transforms/InstCombine/getelementptr.ll
M llvm/test/Transforms/InstCombine/icmp-custom-dl.ll
M llvm/test/Transforms/InstCombine/icmp-gep.ll
M llvm/test/Transforms/InstCombine/indexed-gep-compares.ll
M llvm/test/Transforms/InstCombine/intptr1.ll
M llvm/test/Transforms/InstCombine/intptr2.ll
M llvm/test/Transforms/InstCombine/intptr3.ll
M llvm/test/Transforms/InstCombine/intptr4.ll
M llvm/test/Transforms/InstCombine/intptr5.ll
M llvm/test/Transforms/InstCombine/intptr7.ll
M llvm/test/Transforms/InstCombine/load-store-forward.ll
M llvm/test/Transforms/InstCombine/load.ll
M llvm/test/Transforms/InstCombine/loadstore-metadata.ll
M llvm/test/Transforms/InstCombine/memchr-5.ll
M llvm/test/Transforms/InstCombine/memchr-9.ll
M llvm/test/Transforms/InstCombine/memcmp-3.ll
M llvm/test/Transforms/InstCombine/memcmp-4.ll
M llvm/test/Transforms/InstCombine/memcmp-5.ll
M llvm/test/Transforms/InstCombine/memcmp-6.ll
M llvm/test/Transforms/InstCombine/memcmp-7.ll
M llvm/test/Transforms/InstCombine/memcpy_alloca.ll
M llvm/test/Transforms/InstCombine/memrchr-5.ll
M llvm/test/Transforms/InstCombine/memset2.ll
M llvm/test/Transforms/InstCombine/multi-size-address-space-pointer.ll
M llvm/test/Transforms/InstCombine/non-integral-pointers.ll
M llvm/test/Transforms/InstCombine/opaque-ptr.ll
M llvm/test/Transforms/InstCombine/phi-equal-incoming-pointers.ll
M llvm/test/Transforms/InstCombine/phi-timeout.ll
M llvm/test/Transforms/InstCombine/phi.ll
M llvm/test/Transforms/InstCombine/pr39908.ll
M llvm/test/Transforms/InstCombine/pr44242.ll
M llvm/test/Transforms/InstCombine/pr58901.ll
M llvm/test/Transforms/InstCombine/ptr-replace-alloca.ll
M llvm/test/Transforms/InstCombine/select-cmp-br.ll
M llvm/test/Transforms/InstCombine/select-gep.ll
M llvm/test/Transforms/InstCombine/shift.ll
M llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
M llvm/test/Transforms/InstCombine/sprintf-2.ll
M llvm/test/Transforms/InstCombine/statepoint-cleanup.ll
M llvm/test/Transforms/InstCombine/str-int-3.ll
M llvm/test/Transforms/InstCombine/str-int-4.ll
M llvm/test/Transforms/InstCombine/str-int-5.ll
M llvm/test/Transforms/InstCombine/str-int.ll
M llvm/test/Transforms/InstCombine/strcall-bad-sig.ll
M llvm/test/Transforms/InstCombine/strcall-no-nul.ll
M llvm/test/Transforms/InstCombine/strlen-7.ll
M llvm/test/Transforms/InstCombine/strlen-9.ll
M llvm/test/Transforms/InstCombine/strncmp-4.ll
M llvm/test/Transforms/InstCombine/strncmp-5.ll
M llvm/test/Transforms/InstCombine/strncmp-6.ll
M llvm/test/Transforms/InstCombine/sub.ll
M llvm/test/Transforms/InstCombine/unpack-fca.ll
M llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll
M llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
M llvm/test/Transforms/InstCombine/vec_gep_scalar_arg-inseltpoison.ll
M llvm/test/Transforms/InstCombine/vec_gep_scalar_arg.ll
M llvm/test/Transforms/InstCombine/vscale_gep.ll
M llvm/test/Transforms/InstCombine/wcslen-5.ll
M llvm/test/Transforms/LoopUnroll/ARM/upperbound.ll
M llvm/test/Transforms/LoopUnroll/peel-loop.ll
M llvm/test/Transforms/LoopVectorize/AArch64/deterministic-type-shrinkage.ll
M llvm/test/Transforms/LoopVectorize/AArch64/intrinsiccost.ll
M llvm/test/Transforms/LoopVectorize/AArch64/sve-cond-inv-loads.ll
M llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-accesses.ll
M llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll
M llvm/test/Transforms/LoopVectorize/AArch64/vector-reverse-mask4.ll
M llvm/test/Transforms/LoopVectorize/AMDGPU/packed-math.ll
M llvm/test/Transforms/LoopVectorize/ARM/mve-qabs.ll
M llvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll
M llvm/test/Transforms/LoopVectorize/ARM/mve-selectandorcost.ll
M llvm/test/Transforms/LoopVectorize/ARM/pointer_iv.ll
M llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll
M llvm/test/Transforms/LoopVectorize/X86/interleaving.ll
M llvm/test/Transforms/LoopVectorize/X86/intrinsiccost.ll
M llvm/test/Transforms/LoopVectorize/X86/invariant-store-vectorization.ll
M llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll
M llvm/test/Transforms/LoopVectorize/X86/pr23997.ll
M llvm/test/Transforms/LoopVectorize/X86/small-size.ll
M llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-store-accesses-with-gaps.ll
M llvm/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll
M llvm/test/Transforms/LoopVectorize/extract-last-veclane.ll
M llvm/test/Transforms/LoopVectorize/float-induction.ll
M llvm/test/Transforms/LoopVectorize/induction.ll
M llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
M llvm/test/Transforms/LoopVectorize/reduction-inloop-uf4.ll
M llvm/test/Transforms/LoopVectorize/runtime-check.ll
M llvm/test/Transforms/LoopVectorize/scalar_after_vectorization.ll
M llvm/test/Transforms/LoopVectorize/vector-geps.ll
M llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-dominance.ll
M llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-loops.ll
M llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-multiple-blocks.ll
M llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused.ll
M llvm/test/Transforms/LowerMatrixIntrinsics/multiply-minimal.ll
M llvm/test/Transforms/PhaseOrdering/AArch64/hoisting-sinking-required-for-vectorization.ll
M llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll
M llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll
M llvm/test/Transforms/PhaseOrdering/AArch64/sinking-vs-if-conversion.ll
M llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll
M llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll
M llvm/test/Transforms/PhaseOrdering/X86/hoist-load-of-baseptr.ll
M llvm/test/Transforms/PhaseOrdering/X86/pixel-splat.ll
M llvm/test/Transforms/PhaseOrdering/X86/pr48844-br-to-switch-vectorization.ll
M llvm/test/Transforms/PhaseOrdering/X86/pr50555.ll
M llvm/test/Transforms/PhaseOrdering/X86/speculation-vs-tbaa.ll
M llvm/test/Transforms/PhaseOrdering/X86/spurious-peeling.ll
M llvm/test/Transforms/PhaseOrdering/X86/vdiv.ll
M llvm/test/Transforms/PhaseOrdering/X86/vec-shift.ll
M llvm/test/Transforms/PhaseOrdering/basic.ll
M llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll
M llvm/test/Transforms/PhaseOrdering/pr39282.ll
M llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll
M llvm/test/Transforms/PhaseOrdering/switch_with_geps.ll
M llvm/test/Transforms/SLPVectorizer/AArch64/gather-cost.ll
M llvm/test/Transforms/SLPVectorizer/AArch64/gather-reduce.ll
M llvm/test/Transforms/SLPVectorizer/AArch64/loadorder.ll
M llvm/test/Transforms/SLPVectorizer/WebAssembly/no-vectorize-rotate.ll
M llvm/test/Transforms/SLPVectorizer/X86/operandorder.ll
M llvm/test/Transforms/SLPVectorizer/X86/opt.ll
M llvm/test/Transforms/SLPVectorizer/X86/pr46983.ll
M llvm/test/Transforms/SLPVectorizer/X86/pr47629-inseltpoison.ll
M llvm/test/Transforms/SLPVectorizer/X86/pr47629.ll
M llvm/test/Transforms/SampleProfile/pseudo-probe-instcombine.ll
M llvm/test/Transforms/Util/strip-gc-relocates.ll
Log Message:
-----------
[InstCombine] Canonicalize constant GEPs to i8 source element type (#68882)
This patch canonicalizes getelementptr instructions with constant
indices to use the `i8` source element type. This makes it easier for
optimizations to recognize that two GEPs are identical, because they
don't need to see past many different ways to express the same offset.
This is a first step towards
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699.
This is limited to constant GEPs only for now, as they have a clear
canonical form, while we're not yet sure how exactly to deal with
variable indices.
The test llvm/test/Transforms/PhaseOrdering/switch_with_geps.ll gives
two representative examples of the kind of optimization improvement we
expect from this change. In the first test SimplifyCFG can now realize
that all switch branches are actually the same. In the second test it
can convert it into simple arithmetic. These are representative of
common optimization failures we see in Rust.
Fixes https://github.com/llvm/llvm-project/issues/69841.
More information about the All-commits
mailing list