[llvm-commits] [llvm] r74276 - in /llvm/trunk: test/CodeGen/ARM/orn.ll test/CodeGen/Thumb2/thumb2-orn.ll utils/TableGen/CodeGenDAGPatterns.cpp
Evan Cheng
evan.cheng at apple.com
Thu Jun 25 22:59:16 PDT 2009
Author: evancheng
Date: Fri Jun 26 00:59:16 2009
New Revision: 74276
URL: http://llvm.org/viewvc/llvm-project?rev=74276&view=rev
Log:
Fix a CodeGenDAGPatterns bug. Check if top level predicates match when it's looking for duplicates.
Added:
llvm/trunk/test/CodeGen/ARM/orn.ll
llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Added: llvm/trunk/test/CodeGen/ARM/orn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/orn.ll?rev=74276&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/orn.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/orn.ll Fri Jun 26 00:59:16 2009
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | llc -march=arm | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | Count 2
+
+define i32 @f1(i32 %a, i32 %b) {
+ %tmp = xor i32 %b, 4294967295
+ %tmp1 = and i32 %a, %tmp
+ ret i32 %tmp1
+}
+
+define i32 @f2(i32 %a, i32 %b) {
+ %tmp = xor i32 %b, 4294967295
+ %tmp1 = and i32 %tmp, %a
+ ret i32 %tmp1
+}
Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=74276&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Fri Jun 26 00:59:16 2009
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | Count 2
+
+define i32 @f1(i32 %a, i32 %b) {
+ %tmp = xor i32 %b, 4294967295
+ %tmp1 = and i32 %a, %tmp
+ ret i32 %tmp1
+}
+
+define i32 @f2(i32 %a, i32 %b) {
+ %tmp = xor i32 %b, 4294967295
+ %tmp1 = and i32 %tmp, %a
+ ret i32 %tmp1
+}
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=74276&r1=74275&r2=74276&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Jun 26 00:59:16 2009
@@ -2390,6 +2390,10 @@
// Scan to see if an instruction or explicit pattern already matches this.
bool AlreadyExists = false;
for (unsigned p = 0, e = PatternsToMatch.size(); p != e; ++p) {
+ // Skip if the top level predicates do not match.
+ if (PatternsToMatch[i].getPredicates() !=
+ PatternsToMatch[p].getPredicates())
+ continue;
// Check to see if this variant already exists.
if (Variant->isIsomorphicTo(PatternsToMatch[p].getSrcPattern(), DepVars)) {
DOUT << " *** ALREADY EXISTS, ignoring variant.\n";
More information about the llvm-commits
mailing list