[llvm] [SandboxIR] Added setVolatile member function to LoadInst and StoreInst (PR #101284)
Julius Alexandre via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 13:23:10 PDT 2024
================
@@ -160,6 +160,34 @@ void CallBrInstSetIndirectDest::dump() const {
}
#endif
+SetVolatile::SetVolatile(Instruction *I, bool WasBool, Tracker &Tracker)
+ : IRChangeBase(Tracker), Inst(I) {
+ if (auto *Load = cast<llvm::LoadInst>(Inst)) {
+ WasVolatile = Load->isVolatile();
+ InstUnion = Load;
+ }
+ if (auto *Store = cast<llvm::StoreInst>(Inst)) {
+ WasVolatile = Store->isVolatile();
+ InstUnion = Store;
+ }
+}
+
+void SetVolatile::revert() {
+ if (llvm::LoadInst *Load = InstUnion.dyn_cast<llvm::LoadInst *>()) {
----------------
medievalghoul wrote:
I ended up getting a error message removing `llvm::` namespace.
<details>
<summary> Error Message </summary>
```
/Users/juliusalexandre/GitDownloads/llvm-project/llvm/include/llvm/ADT/STLExtras.h:171:42: error: implicit instantiation of undefined template 'llvm::FirstIndexOfType<llvm::sandboxir::LoadInst *>'
: std::integral_constant<size_t, 1 + FirstIndexOfType<T, Us...>::value> {};
^
/Users/juliusalexandre/GitDownloads/llvm-project/llvm/include/llvm/ADT/STLExtras.h:171:42: note: in instantiation of template class 'llvm::FirstIndexOfType<llvm::sandboxir::LoadInst *, llvm::LoadInst *>' requested here
/Users/juliusalexandre/GitDownloads/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:230:30: note: in instantiation of template class 'llvm::FirstIndexOfType<llvm::sandboxir::LoadInst *, llvm::StoreInst *, llvm::LoadInst *>' requested here
return F.Val.getInt() == FirstIndexOfType<To, PTs...>::value;
```
</details>
https://github.com/llvm/llvm-project/pull/101284
More information about the llvm-commits
mailing list