[llvm] r224615 - CodeGen: do not attempt to invalidate virtual registers for zero-sized phis.

Peter Collingbourne peter at pcc.me.uk
Fri Dec 19 12:50:08 PST 2014


Author: pcc
Date: Fri Dec 19 14:50:07 2014
New Revision: 224615

URL: http://llvm.org/viewvc/llvm-project?rev=224615&view=rev
Log:
CodeGen: do not attempt to invalidate virtual registers for zero-sized phis.

Added:
    llvm/trunk/test/CodeGen/Generic/empty-phi.ll
Modified:
    llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h

Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=224615&r1=224614&r2=224615&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Fri Dec 19 14:50:07 2014
@@ -206,6 +206,9 @@ public:
       return;
 
     unsigned Reg = It->second;
+    if (Reg == 0)
+      return;
+
     LiveOutRegInfo.grow(Reg);
     LiveOutRegInfo[Reg].IsValid = false;
   }

Added: llvm/trunk/test/CodeGen/Generic/empty-phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/empty-phi.ll?rev=224615&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/empty-phi.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/empty-phi.ll Fri Dec 19 14:50:07 2014
@@ -0,0 +1,19 @@
+; RUN: llc < %s
+
+define void @f() {
+entry:
+  br label %bb1
+
+bb1:
+  %0 = phi [0 x { i8*, i64, i64 }] [ %load, %bb2 ], [ undef, %entry ]
+  store [0 x { i8*, i64, i64 }] %0, [0 x { i8*, i64, i64 }]* undef, align 8
+  %1 = icmp eq i64 undef, 0
+  br i1 %1, label %bb2, label %bb3
+
+bb2:
+  %load = load [0 x { i8*, i64, i64 }]* undef, align 8
+  br label %bb1
+
+bb3:
+  ret void
+}





More information about the llvm-commits mailing list