[llvm] [X86][SimplifyCFG][CodeGen] Support hoisting load/store with conditional faulting (PR #95515)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 08:45:53 PDT 2024


================
@@ -5891,14 +5917,21 @@ bool X86TTIImpl::canMacroFuseCmp() {
 }
 
 bool X86TTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment) {
+  bool IsSingleElementVector =
+      isa<VectorType>(DataTy) &&
+      cast<FixedVectorType>(DataTy)->getNumElements() == 1;
+  Type *ScalarTy = DataTy->getScalarType();
+
+  if (ST->hasCF() && IsSingleElementVector &&
+      hasConditionalFaultingLoadStoreForType(ScalarTy))
+    return true;
----------------
KanRobert wrote:

No, it's incorrect. The following code would never be run.

https://github.com/llvm/llvm-project/pull/95515


More information about the llvm-commits mailing list