[llvm-commits] [llvm-gcc-4.2] r59742 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Tanya Lattner
tonic at nondot.org
Thu Nov 20 11:34:41 PST 2008
Author: tbrethou
Date: Thu Nov 20 13:34:40 2008
New Revision: 59742
URL: http://llvm.org/viewvc/llvm-project?rev=59742&view=rev
Log:
Do not constant fold away the GEP access for first elements of the struct. We need to be able to distinguish between an annotate attribute on the first element and the whole struct.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=59742&r1=59741&r2=59742&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Nov 20 13:34:40 2008
@@ -6068,8 +6068,17 @@
"Annotate attribute arg should always be a string");
Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val);
+
+ // We can not use the IRBuilder because it will constant fold away
+ // the GEP that is critical to distinguish between an annotate
+ // attribute on a whole struct from one on the first element of the
+ // struct.
+ BitCastInst *CastFieldPtr = new BitCastInst(FieldPtr, SBP,
+ FieldPtr->getNameStart());
+ Builder.Insert(CastFieldPtr);
+
Value *Ops[4] = {
- BitCastToType(FieldPtr, SBP), BitCastToType(strGV, SBP),
+ CastFieldPtr, BitCastToType(strGV, SBP),
File, LineNo
};
More information about the llvm-commits
mailing list