[PATCH] D12009: Logically Dead Code

Chakshu Grover via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 08:56:15 PDT 2015


chakshugrover created this revision.
chakshugrover added a subscriber: llvm-commits.

Removed Logically Dead Code

```
3249	  if (ForClass)
3250	    return llvm::Constant::getNullValue(ObjCTypes.IvarListPtrTy);
```
As we have already handled the case for ForClass being non-zero. So now further we take the false branch and the value of ForClass is equal to 0. So there's no need for additionally checking it again, making this code logically dead

```
3280	  if (ForClass)
3281	    GV =
3282	        CreateMetadataVar("OBJC_CLASS_VARIABLES_" + ID->getName(), Init,
3283	                          "__OBJC,__class_vars,regular,no_dead_strip", 4, true);
3284	  else
```

http://reviews.llvm.org/D12009

Files:
  lib/CodeGen/CGObjCMac.cpp

Index: lib/CodeGen/CGObjCMac.cpp
===================================================================
--- lib/CodeGen/CGObjCMac.cpp
+++ lib/CodeGen/CGObjCMac.cpp
@@ -3277,14 +3277,9 @@
   llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
 
   llvm::GlobalVariable *GV;
-  if (ForClass)
-    GV =
-        CreateMetadataVar("OBJC_CLASS_VARIABLES_" + ID->getName(), Init,
-                          "__OBJC,__class_vars,regular,no_dead_strip", 4, true);
-  else
-    GV = CreateMetadataVar("OBJC_INSTANCE_VARIABLES_" + ID->getName(), Init,
-                           "__OBJC,__instance_vars,regular,no_dead_strip", 4,
-                           true);
+  GV = CreateMetadataVar("OBJC_INSTANCE_VARIABLES_" + ID->getName(), Init,
+                         "__OBJC,__instance_vars,regular,no_dead_strip", 4,
+                         true);
   return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListPtrTy);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12009.32066.patch
Type: text/x-patch
Size: 925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150813/c7e1f07c/attachment.bin>


More information about the llvm-commits mailing list