The characters '.' and '@' are not allowed by PTX in identifiers. A previous patch cleans up such identifiers for global variables. This patch cleans up identifiers of local functions as well.
An unrelated patch changed the name collision avoidance code in LLVM by adding a suffix of the pattern ["." number]. This broke NVPTXAssignValidGlobalNames.cpp as the dot is introduced in the case of collisions. I fix this by cleaning up the new name and repeating as required.
Nit: "name, ensuring", since the gerund phrase is an appositive.