From 206876e2dabf2a1b4d1f72879afaf2419d6d9afd Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 28 May 2009 04:08:10 +0000 Subject: [PATCH] Use Operands.data() instead of &Operands[0] where Operands is a potentially empty SmallVector. llvm-svn: 72512 --- llvm/lib/Transforms/Scalar/SCCP.cpp | 2 +- .../Transforms/SCCP/2009-05-27-VectorOperandZero.ll | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 llvm/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index d2a70ea9d001..d73519c04e35 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1196,7 +1196,7 @@ CallOverdefined: // If we can constant fold this, mark the result of the call as a // constant. - if (Constant *C = ConstantFoldCall(F, &Operands[0], Operands.size())) { + if (Constant *C = ConstantFoldCall(F, Operands.data(), Operands.size())) { markConstant(I, C); return; } diff --git a/llvm/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll b/llvm/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll new file mode 100644 index 000000000000..480aca0d1acf --- /dev/null +++ b/llvm/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -sccp -disable-output +; PR4277 + +define i32 @main() nounwind { +entry: + %0 = tail call signext i8 (...)* @sin() nounwind + ret i32 0 +} + +declare signext i8 @sin(...)