[llvm] r253955 - [TableGen] Use array_pod_sort. NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 20:55:53 PST 2015


> On 2015-Nov-24, at 16:28, Sean Silva via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 
> 
> On Mon, Nov 23, 2015 at 10:22 PM, Craig Topper via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> Author: ctopper
> Date: Tue Nov 24 00:22:43 2015
> New Revision: 253955
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=253955&view=rev
> Log:
> [TableGen] Use array_pod_sort. NFC
> 
> Modified:
>     llvm/trunk/utils/TableGen/CodeGenTarget.cpp
> 
> Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=253955&r1=253954&r2=253955&view=diff
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Nov 24 00:22:43 2015
> @@ -217,7 +217,8 @@ CodeGenRegBank &CodeGenTarget::getRegBan
> 
>  void CodeGenTarget::ReadRegAltNameIndices() const {
>    RegAltNameIndices = Records.getAllDerivedDefinitions("RegAltNameIndex");
> -  std::sort(RegAltNameIndices.begin(), RegAltNameIndices.end(), LessRecord());
> +  array_pod_sort(RegAltNameIndices.begin(), RegAltNameIndices.end(),
> +                 LessRecord());
>  }
> 
> array_pod_sort with an explicit comparator takes a qsort-like comparator, so this is probably not behaving as intended.
> 
> -- Sean Silva

Yeah, I'm puzzled that this even compiles...

>  
> 
>  /// getRegisterByName - If there is a register with the specific AsmName,
> @@ -253,7 +254,7 @@ void CodeGenTarget::ReadLegalValueTypes(
>      LegalValueTypes.insert(LegalValueTypes.end(), RC.VTs.begin(), RC.VTs.end());
> 
>    // Remove duplicates.
> -  std::sort(LegalValueTypes.begin(), LegalValueTypes.end());
> +  array_pod_sort(LegalValueTypes.begin(), LegalValueTypes.end());
>    LegalValueTypes.erase(std::unique(LegalValueTypes.begin(),
>                                      LegalValueTypes.end()),
>                          LegalValueTypes.end());
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list