[llvm] 067c660 - Use concrete natural type alignment for masked load/store operations instead of 0.

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 02:19:25 PDT 2020


Author: Guillaume Chatelet
Date: 2020-06-25T09:19:12Z
New Revision: 067c660ac99b3d8cfe86264c16aad7d75c512793

URL: https://github.com/llvm/llvm-project/commit/067c660ac99b3d8cfe86264c16aad7d75c512793
DIFF: https://github.com/llvm/llvm-project/commit/067c660ac99b3d8cfe86264c16aad7d75c512793.diff

LOG: Use concrete natural type alignment for masked load/store operations instead of 0.

Summary: Alignment needs to be resolved at this point so we replace the
0 value with the ABI Type Alignment.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 4962c0d5f896..497f6f7da81e 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1387,12 +1387,18 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
     case Intrinsic::lifetime_end:
     case Intrinsic::sideeffect:
       return 0;
-    case Intrinsic::masked_store:
-      return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Store, Tys[0], 0,
+    case Intrinsic::masked_store: {
+      Type *Ty = Tys[0];
+      unsigned TyAlign = ConcreteTTI->DL.getABITypeAlignment(Ty);
+      return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Store, Ty, TyAlign,
                                                 0, CostKind);
-    case Intrinsic::masked_load:
-      return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Load, RetTy, 0, 0,
-                                                CostKind);
+    }
+    case Intrinsic::masked_load: {
+      Type *Ty = RetTy;
+      unsigned TyAlign = ConcreteTTI->DL.getABITypeAlignment(Ty);
+      return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Load, Ty, TyAlign,
+                                                0, CostKind);
+    }
     case Intrinsic::experimental_vector_reduce_add:
       return ConcreteTTI->getArithmeticReductionCost(Instruction::Add, VecOpTy,
                                                      /*IsPairwiseForm=*/false,


        


More information about the llvm-commits mailing list