[llvm] [X86, SimplifyCFG] Support hoisting load/store with conditional faulting (Part I) (PR #96878)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 03:34:47 PDT 2024
================
@@ -3080,22 +3108,31 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
// Only speculatively execute a single instruction (not counting the
// terminator) for now.
- ++SpeculatedInstructions;
+ bool IsSafeCheapLoadStore =
+ HositLoadsStores && isSafeCheapLoadStore(&I, TTI);
+ // Not count load/store into cost if target supports conditional faulting
+ // b/c it's cheap to speculate it.
----------------
nikic wrote:
At least as written, I don't think this reasoning makes a lot of sense. It's not like speculating a cload/cstore is *cheaper* than speculating an add, right?
And just ignoring the number entirely surely cannot be right. If you have a conditional block with 1000 stores, it does not make sense to convert all of them into cstore. I think your current implementation is going to do that?
https://github.com/llvm/llvm-project/pull/96878
More information about the llvm-commits
mailing list