Use Operands.data() instead of &Operands[0] where Operands is a potentially
authorNick Lewycky <nicholas@mxc.ca>
Thu, 28 May 2009 04:08:10 +0000 (04:08 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Thu, 28 May 2009 04:08:10 +0000 (04:08 +0000)
empty SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72512 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SCCP.cpp
test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll [new file with mode: 0644]

index d2a70ea9d001b3efbe32d5a3317de5126f406030..d73519c04e352a67ec385498c10ab49b353d28cb 100644 (file)
@@ -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/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll b/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll
new file mode 100644 (file)
index 0000000..480aca0
--- /dev/null
@@ -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(...)