[llvm] d60b74c - [InstCombine] Set MadeIRChange in replaceInstUsesWith.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 23 09:56:39 PST 2021
Author: Florian Hahn
Date: 2021-01-23T17:52:59Z
New Revision: d60b74c28a076062259ba8a8b80a9bdd802c7497
URL: https://github.com/llvm/llvm-project/commit/d60b74c28a076062259ba8a8b80a9bdd802c7497
DIFF: https://github.com/llvm/llvm-project/commit/d60b74c28a076062259ba8a8b80a9bdd802c7497.diff
LOG: [InstCombine] Set MadeIRChange in replaceInstUsesWith.
Some utilities used by InstCombine, like SimplifyLibCalls, may add new
instructions and replace the uses of a call, but return nullptr because
the inserted call produces multiple results.
Previously, the replaced library calls would get removed by
InstCombine's deleter, but after
292077072ec1279d89d21873fe900061e55ef936 this may not happen, if the
willreturn attribute is missing.
As a work-around, update replaceInstUsesWith to set MadeIRChange, if it
replaces any uses. This catches the cases where it is used as replacer
by utilities used by InstCombine and seems useful in general; updating
uses will modify the IR.
This fixes an expensive-check failure when replacing
@__sinpif/@__cospifi with @__sincospif_sret.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 5e466c5e13e7..79e9d5c46c70 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -398,6 +398,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
<< " with " << *V << '\n');
I.replaceAllUsesWith(V);
+ MadeIRChange = true;
return &I;
}
More information about the llvm-commits
mailing list