[PATCH] D28504: [WebAssembly] Only set one use at a time in FixFunctionBitcasts
Derek Schuff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 17:14:25 PST 2017
dschuff created this revision.
dschuff added a reviewer: sunfish.
dschuff added a subscriber: llvm-commits.
Herald added a subscriber: jfb.
When we collect 2 uses of a function in FindUses and then RAUW when we visit
the first, we end up visiting the wrapper (because the second was RAUW'd).
Instead just set one since we already did the traversal work.
https://reviews.llvm.org/D28504
Files:
lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
test/CodeGen/WebAssembly/function-bitcasts.ll
Index: test/CodeGen/WebAssembly/function-bitcasts.ll
===================================================================
--- test/CodeGen/WebAssembly/function-bitcasts.ll
+++ test/CodeGen/WebAssembly/function-bitcasts.ll
@@ -47,10 +47,16 @@
define void @test() {
entry:
call void bitcast (void (i32)* @has_i32_arg to void ()*)()
+ call void bitcast (void (i32)* @has_i32_arg to void ()*)()
call void bitcast (i32 ()* @has_i32_ret to void ()*)()
call void bitcast (void ()* @foo0 to void (i32)*)(i32 0)
+ %p = bitcast void ()* @foo0 to void (i32)*
+ call void %p(i32 0)
+ %q = bitcast void ()* @foo0 to void (i32)*
+ call void %q(i32 0)
%t = call i32 bitcast (void ()* @foo1 to i32 ()*)()
call void bitcast (void ()* @foo2 to void ()*)()
call void @foo3()
+
ret void
}
Index: lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
+++ lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
@@ -149,10 +149,7 @@
if (!Wrapper)
continue;
- if (isa<Constant>(U->get()))
- U->get()->replaceAllUsesWith(Wrapper);
- else
- U->set(Wrapper);
+ U->set(Wrapper);
}
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28504.83748.patch
Type: text/x-patch
Size: 1272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/e9cbfb49/attachment-0001.bin>
More information about the llvm-commits
mailing list