File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2886,6 +2886,8 @@ void CWriter::printFunction(Function &F) {
28862886 // print local variable information for the function
28872887 for (inst_iterator I = inst_begin (&F), E = inst_end (&F); I != E; ++I) {
28882888 if (AllocaInst *AI = isDirectAlloca (&*I)) {
2889+ if ( AI->getAllocatedType ()->isEmptyTy () ) continue ; // Ignore empty type local variable
2890+
28892891 unsigned Alignment = AI->getAlignment ();
28902892 bool IsOveraligned = Alignment &&
28912893 Alignment > TD->getABITypeAlignment (AI->getAllocatedType ());
@@ -4263,6 +4265,12 @@ void CWriter::visitAllocaInst(AllocaInst &I) {
42634265
42644266void CWriter::printGEPExpression (Value *Ptr, gep_type_iterator I,
42654267 gep_type_iterator E) {
4268+ Type* OperandType = Ptr->getType ();
4269+ if ( OperandType->isPointerTy () && isEmptyType (OperandType->getPointerElementType ()) ) {
4270+ // If the operand type is a pointer to an empty type, just output NULL pointer.
4271+ Out << " 0" ;
4272+ return ;
4273+ }
42664274
42674275 // If there are no indices, just print out the pointer.
42684276 if (I == E) {
You can’t perform that action at this time.
0 commit comments