[PATCH] D64322: Add support for llvm.clear_cache intrinsic

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 04:01:52 PDT 2019


aheejin created this revision.
aheejin added reviewers: dschuff, sunfish.
Herald added subscribers: llvm-commits, jgravelle-google, sbc100.
Herald added a project: LLVM.
aheejin edited the summary of this revision.

This does not have any meaning for wasm (unless we create a new
clear_cache instruction in wasm), so it emits nothing. Fixes PR42356 <https://bugs.llvm.org/show_bug.cgi?id=42356>.


Repository:
  rL LLVM

https://reviews.llvm.org/D64322

Files:
  lib/Target/WebAssembly/WebAssemblyISelLowering.h
  test/CodeGen/WebAssembly/unsupported_intrinsics.ll


Index: test/CodeGen/WebAssembly/unsupported_intrinsics.ll
===================================================================
--- /dev/null
+++ test/CodeGen/WebAssembly/unsupported_intrinsics.ll
@@ -0,0 +1,16 @@
+; RUN: llc < %s -asm-verbose=false | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; Check if llvm.clear_cache is correctly lowered to nothing.
+; CHECK-LABEL: clear_cache:
+; CHECK-NEXT: .functype
+; CHECK-NEXT: end_function
+define void @clear_cache(i8* %begin, i8* %end) {
+entry:
+  call void @llvm.clear_cache(i8* %begin, i8* %end)
+  ret void
+}
+
+declare void @llvm.clear_cache(i8*, i8*)
Index: lib/Target/WebAssembly/WebAssemblyISelLowering.h
===================================================================
--- lib/Target/WebAssembly/WebAssemblyISelLowering.h
+++ lib/Target/WebAssembly/WebAssemblyISelLowering.h
@@ -89,6 +89,11 @@
   void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results,
                           SelectionDAG &DAG) const override;
 
+  /// WebAssembly has no notion of instruction cache in itself
+  const char *getClearCacheBuiltinName() const override {
+    return nullptr; // nothing to do, move along.
+  }
+
   // Custom lowering hooks.
   SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
   SDValue LowerFrameIndex(SDValue Op, SelectionDAG &DAG) const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64322.208361.patch
Type: text/x-patch
Size: 1413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/16ed6d2f/attachment.bin>


More information about the llvm-commits mailing list