From 11cbacf9da271aa454a10eaf9f1b20fafd1a2641 Mon Sep 17 00:00:00 2001 From: Kelly Wilson Date: Sun, 2 Jan 2011 00:42:10 -0500 Subject: [PATCH] Fix for ticket #440 by klickverbot. Thx. --- gen/passes/SimplifyDRuntimeCalls.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gen/passes/SimplifyDRuntimeCalls.cpp b/gen/passes/SimplifyDRuntimeCalls.cpp index bb7ba76a..6850b176 100644 --- a/gen/passes/SimplifyDRuntimeCalls.cpp +++ b/gen/passes/SimplifyDRuntimeCalls.cpp @@ -126,9 +126,9 @@ struct LLVM_LIBRARY_VISIBILITY ArraySetLengthOpt : public LibCallOptimization { if (CI->use_empty()) return CI; - Value* NewLen = CI->getOperand(2); + Value* NewLen = CI->getOperand(1); if (Constant* NewCst = dyn_cast(NewLen)) { - Value* Data = CI->getOperand(4); + Value* Data = CI->getOperand(3); // For now, we just catch the simplest of cases. // @@ -142,7 +142,7 @@ struct LLVM_LIBRARY_VISIBILITY ArraySetLengthOpt : public LibCallOptimization { return Data; // If both lengths are constant integers, see if NewLen <= OldLen - Value* OldLen = CI->getOperand(3); + Value* OldLen = CI->getOperand(2); if (ConstantInt* OldInt = dyn_cast(OldLen)) if (ConstantInt* NewInt = dyn_cast(NewCst)) if (NewInt->getValue().ule(OldInt->getValue()))