[llvm-commits] [llvm] r165102 - in /llvm/trunk: lib/CodeGen/ExecutionDepsFix.cpp test/CodeGen/ARM/deps-fix.ll

Silviu Baranga silviu.baranga at arm.com
Wed Oct 3 01:29:37 PDT 2012


Author: sbaranga
Date: Wed Oct  3 03:29:36 2012
New Revision: 165102

URL: http://llvm.org/viewvc/llvm-project?rev=165102&view=rev
Log:
Fixed a bug in the ExecutionDependencyFix pass that caused dependencies to not propagate through implicit defs.

Added:
    llvm/trunk/test/CodeGen/ARM/deps-fix.ll
Modified:
    llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp

Modified: llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp?rev=165102&r1=165101&r2=165102&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp (original)
+++ llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp Wed Oct  3 03:29:36 2012
@@ -626,9 +626,12 @@
   }
   dv->Instrs.push_back(mi);
 
-  // Finally set all defs and non-collapsed uses to dv.
-  for (unsigned i = 0, e = mi->getDesc().getNumOperands(); i != e; ++i) {
-    MachineOperand &mo = mi->getOperand(i);
+  // Finally set all defs and non-collapsed uses to dv. We must iterate through
+  // all the operators, including imp-def ones.
+  for (MachineInstr::mop_iterator ii = mi->operands_begin(),
+                                  ee = mi->operands_end();
+                                  ii != ee; ++ii) {
+    MachineOperand &mo = *ii;
     if (!mo.isReg()) continue;
     int rx = regIndex(mo.getReg());
     if (rx < 0) continue;

Added: llvm/trunk/test/CodeGen/ARM/deps-fix.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/deps-fix.ll?rev=165102&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/deps-fix.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/deps-fix.ll Wed Oct  3 03:29:36 2012
@@ -0,0 +1,22 @@
+; RUN: llc < %s -march=arm -mcpu=cortex-a9 -mattr=+neon,+neonfp -float-abi=hard -mtriple armv7-linux-gnueabi | FileCheck %s
+
+;; This test checks that the ExecutionDepsFix pass performs the domain changes
+;; even when some dependencies are propagated through implicit definitions.
+
+; CHECK: fun_a
+define <4 x float> @fun_a(<4 x float> %in, <4 x float> %x, float %y) nounwind {
+; CHECK: vext
+; CHECK: vext
+; CHECK: vadd.f32
+  %1 = insertelement <4 x float> %in, float %y, i32 0
+  %2 = fadd <4 x float> %1, %x  
+  ret <4 x float> %2
+}
+; CHECK: fun_b
+define <4 x i32> @fun_b(<4 x i32> %in, <4 x i32> %x, i32 %y) nounwind {
+; CHECK: vmov.32
+; CHECK: vadd.i32
+  %1 = insertelement <4 x i32> %in, i32 %y, i32 0
+  %2 = add <4 x i32> %1, %x  
+  ret <4 x i32> %2
+}





More information about the llvm-commits mailing list