[llvm-commits] [llvm] r43897 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Thu Nov 8 10:45:15 PST 2007
Author: alenhar2
Date: Thu Nov 8 12:45:15 2007
New Revision: 43897
URL: http://llvm.org/viewvc/llvm-project?rev=43897&view=rev
Log:
Better check
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43897&r1=43896&r2=43897&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 8 12:45:15 2007
@@ -7582,7 +7582,7 @@
unsigned PrefAlign = 0) {
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
unsigned Align = GV->getAlignment();
- if (Align == 0 && TD && !isa<OpaqueType>(GV->getType()->getElementType()))
+ if (Align == 0 && TD && GV->getType()->getElementType()->isSized())
Align = TD->getPrefTypeAlignment(GV->getType()->getElementType());
// If there is a large requested alignment and we can, bump up the alignment
Modified: llvm/trunk/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll?rev=43897&r1=43896&r2=43897&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll Thu Nov 8 12:45:15 2007
@@ -6,12 +6,15 @@
%opaque_t = type opaque
+%op_ts = type {opaque, i32}
+
@g = external global %opaque_t
+ at h = external global %op_ts
define i32 @foo() {
entry:
%x = load i8* bitcast (%opaque_t* @g to i8*)
- %y = load i32* bitcast (%opaque_t* @g to i32*)
+ %y = load i32* bitcast (%op_ts* @h to i32*)
%z = zext i8 %x to i32
%r = add i32 %y, %z
ret i32 %r
More information about the llvm-commits
mailing list