[llvm] r245188 - [IR] Simplify code. No functionality change.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 16 14:26:39 PDT 2015


> On 16.08.2015, at 23:16, Benjamin Kramer via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: d0k
> Date: Sun Aug 16 16:16:26 2015
> New Revision: 245188
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=245188&view=rev
> Log:
> [IR] Simplify code. No functionality change.
> 
> Modified:
>    llvm/trunk/lib/IR/Type.cpp
> 
> Modified: llvm/trunk/lib/IR/Type.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Type.cpp?rev=245188&r1=245187&r2=245188&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Type.cpp (original)
> +++ llvm/trunk/lib/IR/Type.cpp Sun Aug 16 16:16:26 2015
> @@ -605,13 +605,11 @@ bool StructType::isValidElementType(Type
> /// specified struct.
> bool StructType::isLayoutIdentical(StructType *Other) const {
>   if (this == Other) return true;
> -  
> -  if (isPacked() != Other->isPacked() ||
> -      getNumElements() != Other->getNumElements())
> +
> +  if (isPacked() != Other->isPacked())
>     return false;
> -  
> -  return element_begin() &&
> -         std::equal(element_begin(), element_end(), Other->element_begin());
> +
> +  return elements() == Other->elements();

Actually there is a functionality change here. The function now returns true if both types are empty, like it should.

> }
> 
> /// getTypeByName - Return the type with the specified name, or null if there
> 
> 
> _______________________________________________
> 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