[llvm-commits] [llvm] r102358 - in /llvm/trunk: lib/Transforms/Scalar/SCCP.cpp test/Transforms/SCCP/undef-resolve.ll
Chris Lattner
sabre at nondot.org
Mon Apr 26 11:21:23 PDT 2010
Author: lattner
Date: Mon Apr 26 13:21:23 2010
New Revision: 102358
URL: http://llvm.org/viewvc/llvm-project?rev=102358&view=rev
Log:
fix PR6940: sitofp(undef) folds to 0.0, not undef.
Modified:
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
llvm/trunk/test/Transforms/SCCP/undef-resolve.ll
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=102358&r1=102357&r2=102358&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Mon Apr 26 13:21:23 2010
@@ -1452,6 +1452,8 @@
// After a zero extend, we know the top part is zero. SExt doesn't have
// to be handled here, because we don't know whether the top part is 1's
// or 0's.
+ case Instruction::SIToFP: // some FP values are not possible, just use 0.
+ case Instruction::UIToFP: // some FP values are not possible, just use 0.
markForcedConstant(I, Constant::getNullValue(ITy));
return true;
case Instruction::Mul:
Modified: llvm/trunk/test/Transforms/SCCP/undef-resolve.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/undef-resolve.ll?rev=102358&r1=102357&r2=102358&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SCCP/undef-resolve.ll (original)
+++ llvm/trunk/test/Transforms/SCCP/undef-resolve.ll Mon Apr 26 13:21:23 2010
@@ -1,8 +1,19 @@
; RUN: opt %s -sccp -S | FileCheck %s
+
+
+; PR6940
+define double @test1() {
+ %t = sitofp i32 undef to double
+ ret double %t
+; CHECK: @test1
+; CHECK: ret double 0.0
+}
+
+
; rdar://7832370
; Check that lots of stuff doesn't get turned into undef.
-
-define i32 @main() nounwind readnone ssp {
+define i32 @test2() nounwind readnone ssp {
+; CHECK: @test2
init:
br label %control.outer.outer
More information about the llvm-commits
mailing list