[llvm-commits] [llvm] r126567 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h test/CodeGen/X86/phi-bit-propagation.ll
Cameron Zwarich
zwarich at apple.com
Sun Feb 27 00:06:01 PST 2011
Author: zwarich
Date: Sun Feb 27 02:06:01 2011
New Revision: 126567
URL: http://llvm.org/viewvc/llvm-project?rev=126567&view=rev
Log:
Fix PR9324 / <rdar://problem/9052489> by handling the case where a PHI has no uses.
Modified:
llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll
Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=126567&r1=126566&r2=126567&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Sun Feb 27 02:06:01 2011
@@ -187,7 +187,12 @@
/// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be
/// called when a block is visited before all of its predecessors.
void InvalidatePHILiveOutRegInfo(const PHINode *PN) {
- unsigned Reg = ValueMap[PN];
+ // PHIs with no uses have no ValueMap entry.
+ DenseMap<const Value*, unsigned>::const_iterator It = ValueMap.find(PN);
+ if (It == ValueMap.end())
+ return;
+
+ unsigned Reg = It->second;
LiveOutRegInfo.grow(Reg);
LiveOutRegInfo[Reg].IsValid = false;
}
Modified: llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll?rev=126567&r1=126566&r2=126567&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll (original)
+++ llvm/trunk/test/CodeGen/X86/phi-bit-propagation.ll Sun Feb 27 02:06:01 2011
@@ -33,3 +33,23 @@
%retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ]
ret i1 %retval.0
}
+
+; This test case caused an assertion failure; see PR9324.
+define void @func_37() noreturn nounwind ssp {
+entry:
+ br i1 undef, label %lbl_919, label %entry.for.inc_crit_edge
+
+entry.for.inc_crit_edge: ; preds = %entry
+ br label %for.inc
+
+lbl_919: ; preds = %for.cond7.preheader, %entry
+ br label %for.cond7.preheader
+
+for.cond7.preheader: ; preds = %for.inc, %lbl_919
+ %storemerge.ph = phi i8 [ 0, %lbl_919 ], [ %add, %for.inc ]
+ br i1 undef, label %for.inc, label %lbl_919
+
+for.inc: ; preds = %for.cond7.preheader, %entry.for.inc_crit_edge
+ %add = add i8 undef, 1
+ br label %for.cond7.preheader
+}
More information about the llvm-commits
mailing list