[InlineCost] Simplify constant folding
authorNikita Popov <npopov@redhat.com>
Thu, 30 Jun 2022 09:14:01 +0000 (11:14 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 30 Jun 2022 09:49:17 +0000 (11:49 +0200)
commit54fcde42c0239b8041b89e17064846f01b60145c
treedae9d97f9234f787f3795d1fb20cf8ec04235993
parentbb0896e96f30c6f812c6824067ff52bdd707ad26
[InlineCost] Simplify constant folding

Use a common ConstantFoldInstOperands-based constant folding
implementation, instead of specifying the folding function for
each function individually. Going through the generic handling
doesn't appear to have any significant compile-time impact.

As the test change shows, this is not NFC, because we now use
DataLayout-aware constant folding, which can do slightly better
in some cases (e.g. those involving GEPs).
llvm/lib/Analysis/InlineCost.cpp
llvm/test/Transforms/Inline/gep_from_constant.ll