[NVPTX] fix a crash bug in NVPTXFavorNonGenericAddrSpaces
authorJingyue Wu <jingyue@google.com>
Tue, 9 Jun 2015 21:50:32 +0000 (21:50 +0000)
committerJingyue Wu <jingyue@google.com>
Tue, 9 Jun 2015 21:50:32 +0000 (21:50 +0000)
commit95355e64984976e788cf1956bbc3f9f578163cc8
tree8f2703be4b3bf41ad5550b055ed62eedfd4e2e3a
parent1d815cac84475fd33865148a356f8def8ab20859
[NVPTX] fix a crash bug in NVPTXFavorNonGenericAddrSpaces

Summary:
We used to assume V->RAUW only modifies the operand list of V's user.
However, if V and V's user are Constants, RAUW may replace and invalidate V's
user entirely.

This patch fixes the above issue by letting the caller replace the
operand instead of calling RAUW on Constants.

Test Plan: @nested_const_expr and @rauw in access-non-generic.ll

Reviewers: broune, jholewinski

Reviewed By: broune, jholewinski

Subscribers: jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D10345

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239435 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
test/CodeGen/NVPTX/access-non-generic.ll