[PATCH] D116935: [IRBuilder] Introduce folder using inst-simplify, use for Or fold.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 12:52:09 PST 2022


fhahn updated this revision to Diff 398722.
fhahn added a comment.

Rebased and made sure comments are consistent between different folders.

In D116935#3232227 <https://reviews.llvm.org/D116935#3232227>, @craig.topper wrote:

> In D116935#3232203 <https://reviews.llvm.org/D116935#3232203>, @lebedev.ri wrote:
>
>> In D116935#3232126 <https://reviews.llvm.org/D116935#3232126>, @craig.topper wrote:
>>
>>> If I remember correctly, the Or and And folds for 0 and all 1s are there to optimize bitfield codegen for the frontend. Are we losing that optimization if this patch goes in before switching clang to InstSimplifyFolder?
>>
>> True, but why is that optimization there in the first place?
>> Presumably it shouldn't matter nowadays.
>
> Probably for -O0 where there is no optimizer,
>
>   commit 0fc4311f0ea4034b4bad1c82c652dc04bb763cda
>   Author: Chris Lattner <sabre at nondot.org>
>   Date:   Wed Nov 4 05:00:12 2009 +0000
>   
>       make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
>       during bitfield codegen and slows down -O0 compile times by making
>       useless IR.  rdar://7362516
>   
>       llvm-svn: 86006

I collected numbers using the compile-time tracker and the data seems to indicate this is not an issue any longer, there are no notable changes for any config: http://llvm-compile-time-tracker.com/compare.php?from=baa5b54d43419b5d4a1ec36f3788c36d52187e11&to=e22fc3bb9b024699fdfd12b89c68205565215b27&stat=instructions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116935

Files:
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-when-nullptr-is-defined.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
  clang/test/CodeGen/catch-pointer-overflow-volatile.c
  clang/test/CodeGen/catch-pointer-overflow.c
  clang/test/CodeGen/ubsan-pointer-overflow.c
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/teams_private_codegen.cpp
  llvm/include/llvm/Analysis/InstSimplifyFolder.h
  llvm/include/llvm/Analysis/TargetFolder.h
  llvm/include/llvm/IR/ConstantFolder.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/IRBuilderFolder.h
  llvm/include/llvm/IR/NoFolder.h
  llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
  llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
  llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll
  llvm/test/Transforms/SROA/basictest-opaque-ptrs.ll
  llvm/test/Transforms/SROA/basictest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116935.398722.patch
Type: text/x-patch
Size: 218728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220110/bd51e4f5/attachment-0001.bin>


More information about the cfe-commits mailing list