diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -1578,22 +1578,22 @@ /// Return the minimum stack alignment of an argument. unsigned getMinStackArgumentAlignment() const { - return MinStackArgumentAlignment; + return MinStackArgumentAlignment.value(); } /// Return the minimum function alignment. unsigned getMinFunctionLogAlignment() const { - return MinFunctionLogAlignment; + return Log2(MinFunctionAlignment); } /// Return the preferred function alignment. unsigned getPrefFunctionLogAlignment() const { - return PrefFunctionLogAlignment; + return Log2(PrefFunctionAlignment); } /// Return the preferred loop alignment. virtual unsigned getPrefLoopLogAlignment(MachineLoop *ML = nullptr) const { - return PrefLoopLogAlignment; + return Log2(PrefLoopAlignment); } /// Should loops be aligned even when the function is marked OptSize (but not @@ -2106,14 +2106,14 @@ /// Set the target's minimum function alignment (in log2(bytes)) void setMinFunctionLogAlignment(unsigned LogAlign) { - MinFunctionLogAlignment = LogAlign; + MinFunctionAlignment = llvm::Align(1ULL << LogAlign); } /// Set the target's preferred function alignment. This should be set if /// there is a performance benefit to higher-than-minimum alignment (in /// log2(bytes)) void setPrefFunctionLogAlignment(unsigned LogAlign) { - PrefFunctionLogAlignment = LogAlign; + PrefFunctionAlignment = llvm::Align(1ULL << LogAlign); } /// Set the target's preferred loop alignment. Default alignment is zero, it @@ -2121,12 +2121,12 @@ /// specified in log2(bytes). The target may also override /// getPrefLoopAlignment to provide per-loop values. void setPrefLoopLogAlignment(unsigned LogAlign) { - PrefLoopLogAlignment = LogAlign; + PrefLoopAlignment = llvm::Align(1ULL << LogAlign); } /// Set the minimum stack alignment of an argument. void setMinStackArgumentAlignment(unsigned Align) { - MinStackArgumentAlignment = Align; + MinStackArgumentAlignment = llvm::Align(Align); } /// Set the maximum atomic operation size supported by the @@ -2688,18 +2688,18 @@ Sched::Preference SchedPreferenceInfo; /// The minimum alignment that any argument on the stack needs to have. - unsigned MinStackArgumentAlignment; + llvm::Align MinStackArgumentAlignment; /// The minimum function alignment (used when optimizing for size, and to /// prevent explicitly provided alignment from leading to incorrect code). - unsigned MinFunctionLogAlignment; + llvm::Align MinFunctionAlignment; /// The preferred function alignment (used when alignment unspecified and /// optimizing for speed). - unsigned PrefFunctionLogAlignment; + llvm::Align PrefFunctionAlignment; /// The preferred loop alignment (in log2 bot in bytes). - unsigned PrefLoopLogAlignment; + llvm::Align PrefLoopAlignment; /// Size in bits of the maximum atomics size the backend supports. /// Accesses larger than this will be expanded by AtomicExpandPass. diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -583,11 +583,7 @@ BooleanFloatContents = UndefinedBooleanContent; BooleanVectorContents = UndefinedBooleanContent; SchedPreferenceInfo = Sched::ILP; - MinFunctionLogAlignment = 0; - PrefFunctionLogAlignment = 0; - PrefLoopLogAlignment = 0; GatherAllAliasesMaxDepth = 18; - MinStackArgumentAlignment = 1; // TODO: the default will be switched to 0 in the next commit, along // with the Target-specific changes necessary. MaxAtomicSizeInBitsSupported = 1024;