[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 11:58:41 PDT 2020
chandlerc added a comment.
Regarding access to volatile memory...
If volatile memory access is known to not trap, then the guidance on LLVM's own blog is wrong:
https://blog.llvm.org/posts/2011-05-13-what-every-c-programmer-should-know/
And in fact, Clang's error message is wrong as it specifically suggests re-writing a dereference of a null pointer to use volatile in order to ensure a trap.
If we insist on following the LangRef rules, we would need to change the lowering of volatile memory accesses in Clang, and that doesn't seem especially useful. I think the LangRef is simply wrong on this point, and we need to admit that access to volatile memory, much like a call to an unknown external function, may trap, unwind, never return, etc. There is a significant amount of real C and C++ code written that relies on these rules, no doubt because LLVM and Clang advertised them. =]
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87149/new/
https://reviews.llvm.org/D87149
More information about the llvm-commits
mailing list