[all-commits] [llvm/llvm-project] 2cafbc: [instcombine] Key deref vs deref_or_null annotatio...

Philip Reames via All-commits all-commits at lists.llvm.org
Sat Jan 8 10:34:17 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2cafbcb560d9e6e2300941d088e754b01d56595b
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2022-01-08 (Sat, 08 Jan 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/new-delete-itanium.ll
    M llvm/test/Transforms/InstCombine/objsize-64.ll

  Log Message:
  [instcombine] Key deref vs deref_or_null annotation of allocation sites off nonnull attribute

Goal is to remove use of isOpNewLike.  I looked at a couple approaches to this, and this turned out to be the cheapest one.  Just letting deref_or_null be generated causes a bunch of test diffs, and I couldn't convince myself there wasn't a real regression somewhere.  A generic instcombine to convert deref_or_null + nonnull to deref is annoying complicated since you have to mix facts from callsite and declaration while manipulating only existing call site attributes.  It just wasn't worth the code complexity.

Note that the change in new-delete-itanium.ll is a real regression.  If you have a callsite which overrides the builtin status of a nobuiltin declaration, *and* you don't put the apppriate attributes on that callsite, you may lose the deref fact.  I decided this didn't matter; if anyone disagrees, you can add this case to the generic non-null inference.

More information about the All-commits mailing list