[all-commits] [llvm/llvm-project] 4723c9: [NFC] `IRBuilderBase::CreateAdd()`: place constant...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Oct 27 11:35:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4723c9b3c6c46632a5d66e65d198899894b1e2c5
      https://github.com/llvm/llvm-project/commit/4723c9b3c6c46632a5d66e65d198899894b1e2c5
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M clang/test/CodeGen/builtins-overflow.c
    M clang/test/CodeGen/builtins-ppc-p10vector.c
    M clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
    M clang/test/CodeGen/complex-convert.c
    M clang/test/CodeGen/extern-inline.c
    M clang/test/CodeGen/matrix-type-operators.c
    M clang/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
    M clang/test/CodeGenCXX/virtual-base-cast.cpp
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll
    M llvm/test/Instrumentation/MemorySanitizer/AArch64/vararg.ll
    M llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
    M llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
    M llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64.ll
    M llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
    M llvm/test/Instrumentation/MemorySanitizer/SystemZ/vararg.ll
    M llvm/test/Instrumentation/MemorySanitizer/msan_kernel_basic.ll
    M llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll
    M llvm/test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll
    M llvm/test/Transforms/LoopVectorize/X86/conversion-cost.ll
    M llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll
    M llvm/test/Transforms/LoopVectorize/X86/pr36524.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll
    M llvm/test/Transforms/LoopVectorize/float-minmax-instruction-flag.ll
    M llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
    M llvm/test/Transforms/LoopVectorize/induction-step.ll
    M llvm/test/Transforms/LoopVectorize/induction.ll
    M llvm/test/Transforms/LoopVectorize/pr30654-phiscev-sext-trunc.ll
    M llvm/test/Transforms/LoopVectorize/pr44488-predication.ll
    M llvm/test/Transforms/LoopVectorize/pr45259.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
    M llvm/test/Transforms/LoopVectorize/scalar_after_vectorization.ll
    M llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll

  Log Message:
  -----------
  [NFC] `IRBuilderBase::CreateAdd()`: place constant onto RHS


  Commit: cb90e5356ac1594e95fed8e208d6e0e9b6a87db1
      https://github.com/llvm/llvm-project/commit/cb90e5356ac1594e95fed8e208d6e0e9b6a87db1
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
    M clang/test/CodeGen/complex-convert.c
    M clang/test/CodeGen/matrix-type-operators.c
    M clang/test/CodeGen/volatile-1.c
    M clang/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
    M clang/test/CodeGenCXX/virtual-base-cast.cpp
    M clang/test/CodeGenCXX/volatile-1.cpp
    M clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/test/Instrumentation/AddressSanitizer/fake-stack.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime.ll
    M llvm/test/Instrumentation/HWAddressSanitizer/basic.ll
    M llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
    M llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
    M llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64.ll
    M llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
    M llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
    M llvm/test/Transforms/LoopIdiom/X86/arithmetic-right-shift-until-zero.ll
    M llvm/test/Transforms/LoopIdiom/X86/left-shift-until-zero.ll
    M llvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/induction-trunc.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/scalarize-store-with-predication.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll
    M llvm/test/Transforms/LoopVectorize/ARM/tail-folding-scalar-epilogue-fallback.ll
    M llvm/test/Transforms/LoopVectorize/X86/cost-model-assert.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
    M llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
    M llvm/test/Transforms/LoopVectorize/pointer-induction.ll
    M llvm/test/Transforms/LoopVectorize/pr30654-phiscev-sext-trunc.ll
    M llvm/test/Transforms/LoopVectorize/pr45679-fold-tail-by-masking.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
    M llvm/test/Transforms/LoopVectorize/select-cmp-predicated.ll
    M llvm/test/Transforms/LoopVectorize/tail-folding-vectorization-factor-1.ll
    M llvm/test/Transforms/LoopVectorize/unroll_nonlatch.ll
    M llvm/test/Transforms/LoopVectorize/use-scalar-epilogue-if-tp-fails.ll
    M llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll
    M llvm/unittests/IR/PatternMatch.cpp

  Log Message:
  -----------
  [IR] `IRBuilderBase::CreateAdd()`: short-circuit `x + 0` --> `x`

There's precedent for that in `CreateOr()`/`CreateAnd()`.

The motivation here is to avoid bloating the run-time check's IR
in `SCEVExpander::generateOverflowCheck()`.

Refs. https://reviews.llvm.org/D109368#3089809


Compare: https://github.com/llvm/llvm-project/compare/425cbbc602c9...cb90e5356ac1


More information about the All-commits mailing list