[llvm-commits] [llvm] r105289 - /llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Chris Lattner
clattner at apple.com
Tue Jun 1 14:15:47 PDT 2010
On Jun 1, 2010, at 2:06 PM, Jim Grosbach wrote:
> Author: grosbach
> Date: Tue Jun 1 16:06:46 2010
> New Revision: 105289
>
> URL: http://llvm.org/viewvc/llvm-project?rev=105289&view=rev
> Log:
> Simplify things a bit more. Fix prototype to use SmallVectorImpl and
> change a few SmallVectors to vanilla C arrays.
Thanks Jim, one gotcha:
> - SmallVector<Constant*,2> GEPIdx(2,
> - Constant::getNullValue(Type::getInt32Ty(M->getContext())));
> + Constant *GEPIdx[2] = {
> + ConstantInt::get(Type::getInt32Ty(M->getContext()), 2),
> + Constant::getNullValue(Type::getInt32Ty(M->getContext())) };
The old code made two elements with nulls in them, the new code makes a 2, then a null. Something like this should work:
Constant *Null32 = Constant::getNullValue(Type::getInt32Ty(M->getContext()));
Constant *GEPIdx[2] = { Null32, Null32 };
> AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
> } else {
> // The abort message for cheap EH support tells the user that EH is not
> @@ -212,8 +213,9 @@
> GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
> GlobalValue::InternalLinkage,
> Msg, "abortmsg");
> - SmallVector<Constant*,2> GEPIdx(2, Constant::getNullValue(
> - Type::getInt32Ty(M->getContext())));
> + Constant *GEPIdx[2] = {
> + ConstantInt::get(Type::getInt32Ty(M->getContext()), 2),
> + Constant::getNullValue(Type::getInt32Ty(M->getContext())) };
Likewise.
Otherwise, looks great, thanks!
-Chris
More information about the llvm-commits
mailing list