[PATCH] D119994: [RewriteStatepointsForGC] Fix an incorrect assertion
Daniil Suchkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 10:45:44 PST 2022
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c3e2b92cf66: [RewriteStatepointsForGC] Fix an incorrect assertion (authored by DaniilSuchkov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119994/new/
https://reviews.llvm.org/D119994
Files:
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll
Index: llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll
===================================================================
--- llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll
+++ llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll
@@ -1,4 +1,3 @@
-; XFAIL: *
; REQUIRES: asserts
; RUN: opt < %s -disable-output -passes=rewrite-statepoints-for-gc
Index: llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -1164,13 +1164,21 @@
#ifndef NDEBUG
Value *OldBase = BlockToValue[InBB];
Value *Base = getBaseForInput(InVal, nullptr);
+
+ // We can't use `stripPointerCasts` instead of this function because
+ // `stripPointerCasts` doesn't handle vectors of pointers.
+ auto StripBitCasts = [](Value *V) -> Value * {
+ while (auto *BC = dyn_cast<BitCastInst>(V))
+ V = BC->getOperand(0);
+ return V;
+ };
// In essence this assert states: the only way two values
// incoming from the same basic block may be different is by
// being different bitcasts of the same value. A cleanup
// that remains TODO is changing findBaseOrBDV to return an
// llvm::Value of the correct type (and still remain pure).
// This will remove the need to add bitcasts.
- assert(Base->stripPointerCasts() == OldBase->stripPointerCasts() &&
+ assert(StripBitCasts(Base) == StripBitCasts(OldBase) &&
"findBaseOrBDV should be pure!");
#endif
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119994.409719.patch
Type: text/x-patch
Size: 1765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220217/55547391/attachment.bin>
More information about the llvm-commits
mailing list