[PATCH] D153036: [FuncSpec] Add Freeze and CallBase to the InstCostVisitor.
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 17 00:13:12 PDT 2023
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.
LGTM with comments.
================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:241-243
+ auto *C = dyn_cast<Constant>(V);
+ if (!C)
+ C = findConstantFor(V, KnownConstants);
----------------
nit:
================
Comment at: llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp:226-227
%ld = load i32, ptr %gep
- ret i32 %ld
+ %fr = freeze i32 %ld
+ %smax = call i32 @llvm.smax.i32(i32 %fr, i32 1)
+ ret i32 %smax
----------------
It will be better to test the invalid case. e.g., the freeze inst may be position or undef. And the call inst may not be constant. We can test that everything is still fine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153036/new/
https://reviews.llvm.org/D153036
More information about the llvm-commits
mailing list