[PATCH] D12013: [InstCombineCasts] Add cost model to decide which truncates are worth removing
hfinkel@anl.gov via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 16 03:51:28 PDT 2015
hfinkel added a subscriber: hfinkel.
================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:341
@@ +340,3 @@
+/// and store it into the "Cost" argument.
+/// Currently cost model is simple - increase cost by one for each additional
+/// instruction required, decrease cost by one for each instruction that
----------------
Currently cost model is simple -> Currently, the cost model is simple
================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:457
@@ +456,3 @@
+ // This is not a recognized instruction, but we can always truncate it by
+ // adding additional explicit trunc.
+ Cost += 1;
----------------
This does not seem right. Arbitrary instructions don't commute with truncation, by which I mean trunc(arbitrary(x, y)) != arbitrary(trunc(x), trunc(y)) in general. Also, for many instructions you'd hit the llvm_unreachable in the default case in EvaluateInDifferentType.
Repository:
rL LLVM
http://reviews.llvm.org/D12013
More information about the llvm-commits
mailing list