[llvm-commits] [llvm] r172313 - in /llvm/trunk/unittests/IR: AttributesTest.cpp CMakeLists.txt
Benjamin Kramer
benny.kra at googlemail.com
Sat Jan 12 06:13:45 PST 2013
Author: d0k
Date: Sat Jan 12 08:13:45 2013
New Revision: 172313
URL: http://llvm.org/viewvc/llvm-project?rev=172313&view=rev
Log:
Add a unit test to verifies that attribute uniquing works so it doesn't break again.
The folding set details can be subtle and broke twice in the last couple of weeks.
Added:
llvm/trunk/unittests/IR/AttributesTest.cpp
Modified:
llvm/trunk/unittests/IR/CMakeLists.txt
Added: llvm/trunk/unittests/IR/AttributesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/AttributesTest.cpp?rev=172313&view=auto
==============================================================================
--- llvm/trunk/unittests/IR/AttributesTest.cpp (added)
+++ llvm/trunk/unittests/IR/AttributesTest.cpp Sat Jan 12 08:13:45 2013
@@ -0,0 +1,34 @@
+//===- llvm/unittest/IR/AttributesTest.cpp - Attributes unit tests --------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/LLVMContext.h"
+#include "gtest/gtest.h"
+using namespace llvm;
+
+namespace {
+
+TEST(Attributes, Uniquing) {
+ LLVMContext C;
+
+ Attribute AttrA = Attribute::get(C, Attribute::AlwaysInline);
+ Attribute AttrB = Attribute::get(C, Attribute::AlwaysInline);
+ EXPECT_EQ(AttrA, AttrB);
+
+ AttributeWithIndex AWIs[] = {
+ AttributeWithIndex::get(C, 1, Attribute::ZExt),
+ AttributeWithIndex::get(C, 2, Attribute::SExt)
+ };
+
+ AttributeSet SetA = AttributeSet::get(C, AWIs);
+ AttributeSet SetB = AttributeSet::get(C, AWIs);
+ EXPECT_EQ(SetA, SetB);
+}
+
+} // end anonymous namespace
Modified: llvm/trunk/unittests/IR/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/CMakeLists.txt?rev=172313&r1=172312&r2=172313&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/CMakeLists.txt (original)
+++ llvm/trunk/unittests/IR/CMakeLists.txt Sat Jan 12 08:13:45 2013
@@ -5,6 +5,7 @@
)
set(IRSources
+ AttributesTest.cpp
ConstantsTest.cpp
DominatorTreeTest.cpp
IRBuilderTest.cpp
More information about the llvm-commits
mailing list