[llvm-commits] [llvm] r94984 - /llvm/trunk/lib/Transforms/Utils/Local.cpp

Bob Wilson bob.wilson at apple.com
Mon Feb 1 09:41:44 PST 2010


Author: bwilson
Date: Mon Feb  1 11:41:44 2010
New Revision: 94984

URL: http://llvm.org/viewvc/llvm-project?rev=94984&view=rev
Log:
Fix pr6198 by moving the isSized() check to an outer conditional.
The testcase from pr6198 does not crash for me -- I don't know what's up with
that -- so I'm not adding it to the tests.

Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=94984&r1=94983&r2=94984&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Mon Feb  1 11:41:44 2010
@@ -95,13 +95,15 @@
       BaseAlign = GV->getAlignment();
     }
   }
-  if (TD && BaseType && BaseAlign == 0)
-    BaseAlign = TD->getPrefTypeAlignment(BaseType);
 
-  if (BaseType && Align <= BaseAlign) {
-    if (!TD)
-      return true; // Loading directly from an alloca or global is OK.
-    if (BaseType->isSized()) {
+  if (BaseType && BaseType->isSized()) {
+    if (TD && BaseAlign == 0)
+      BaseAlign = TD->getPrefTypeAlignment(BaseType);
+
+    if (Align <= BaseAlign) {
+      if (!TD)
+        return true; // Loading directly from an alloca or global is OK.
+
       // Check if the load is within the bounds of the underlying object.
       const PointerType *AddrTy = cast<PointerType>(V->getType());
       uint64_t LoadSize = TD->getTypeStoreSize(AddrTy->getElementType());





More information about the llvm-commits mailing list