[PATCH] D64394: [MachineCSE][MachinePRE] Do not hoist common computations into hot BBs

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 10:57:56 PDT 2019


dmgreen added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCSE.cpp:875
+         "CandidateBB should dominate MBB1");
+  return MBFI->getBlockFreq(CandidateBB) <=
+         MBFI->getBlockFreq(MBB) + MBFI->getBlockFreq(MBB1);
----------------
lkail wrote:
> dmgreen wrote:
> > Should this also say something like "if OptForMinSize then return true"? Under the assumption that pre will reduce the codesize.
> Hi @dmgreen , your concern makes sense, since CSE won't eliminate all common computations considering what `isProfitableToCSE` does. As a result, it might increase size after PRE. I think we can enhance it in following patches. 
Hello. Sorry. I meant more that - to my understanding - CSE is expected to decrease codesize. PRE can help perform more CSE so is expected to decrease codesize more. At Minsize (Oz) we don't really care which block is hot and which isn't, we just want to decrease codesize as much as possible. Hence this function, when optimising for minsize should just return true.

Feel free to correct me if any of that sounds wrong. It probably doesn't make a large difference either way, but we might as well do it whilst we are here.


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

https://reviews.llvm.org/D64394





More information about the llvm-commits mailing list