[llvm-commits] [llvm] r73195 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll
Chris Lattner
sabre at nondot.org
Thu Jun 11 10:54:56 PDT 2009
Author: lattner
Date: Thu Jun 11 12:54:56 2009
New Revision: 73195
URL: http://llvm.org/viewvc/llvm-project?rev=73195&view=rev
Log:
Fix 4366: store to null in non-default addr space should not be
turned into unreachable.
Added:
llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=73195&r1=73194&r2=73195&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Jun 11 12:54:56 2009
@@ -11824,7 +11824,8 @@
if (SI.isVolatile()) return 0; // Don't hack volatile stores.
// store X, null -> turns into 'unreachable' in SimplifyCFG
- if (isa<ConstantPointerNull>(Ptr)) {
+ if (isa<ConstantPointerNull>(Ptr) &&
+ cast<PointerType>(Ptr->getType())->getAddressSpace() == 0) {
if (!isa<UndefValue>(Val)) {
SI.setOperand(0, UndefValue::get(Val->getType()));
if (Instruction *U = dyn_cast<Instruction>(Val))
Added: llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll?rev=73195&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll Thu Jun 11 12:54:56 2009
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep store
+; PR4366
+
+define void @a() {
+ store i32 0, i32 addrspace(1)* null
+ ret void
+}
More information about the llvm-commits
mailing list