Fix const merging when an alias of a const is llvm.used.

We used to disable constant merging not only if a constant is llvm.used, but
also if an alias of a constant is llvm.used. This change fixes that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181175 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-05-06 01:48:55 +00:00
parent f93b6d2ec5
commit eaf14786ca
4 changed files with 29 additions and 8 deletions

View File

@@ -260,14 +260,24 @@ public:
/// this value.
bool hasValueHandle() const { return HasValueHandle; }
/// stripPointerCasts - This method strips off any unneeded pointer casts and
/// all-zero GEPs from the specified value, returning the original uncasted
/// value. If this is called on a non-pointer value, it returns 'this'.
/// \brief This method strips off any unneeded pointer casts,
/// all-zero GEPs and aliases from the specified value, returning the original
/// uncasted value. If this is called on a non-pointer value, it returns
/// 'this'.
Value *stripPointerCasts();
const Value *stripPointerCasts() const {
return const_cast<Value*>(this)->stripPointerCasts();
}
/// \brief This method strips off any unneeded pointer casts and
/// all-zero GEPs from the specified value, returning the original
/// uncasted value. If this is called on a non-pointer value, it returns
/// 'this'.
Value *stripPointerCastsNoFollowAliases();
const Value *stripPointerCastsNoFollowAliases() const {
return const_cast<Value*>(this)->stripPointerCastsNoFollowAliases();
}
/// stripInBoundsConstantOffsets - This method strips off unneeded pointer casts and
/// all-constant GEPs from the specified value, returning the original
/// pointer value. If this is called on a non-pointer value, it returns