mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[FIX] Allow non-constant assume operand bundle operands.
Fixes PR49545 Reviewed By: zequanwu, fhahn, lebedev.ri Differential Revision: https://reviews.llvm.org/D98444
This commit is contained in:
parent
018bbe154e
commit
6c444365cb
@ -88,9 +88,11 @@ void llvm::fillMapFromAssume(CallInst &AssumeCI, RetainedKnowledgeMap &Result) {
|
||||
Result[Key][&Assume] = {0, 0};
|
||||
continue;
|
||||
}
|
||||
unsigned Val = cast<ConstantInt>(
|
||||
getValueFromBundleOpInfo(Assume, Bundles, ABA_Argument))
|
||||
->getZExtValue();
|
||||
auto *CI = dyn_cast<ConstantInt>(
|
||||
getValueFromBundleOpInfo(Assume, Bundles, ABA_Argument));
|
||||
if (!CI)
|
||||
continue;
|
||||
unsigned Val = CI->getZExtValue();
|
||||
auto Lookup = Result.find(Key);
|
||||
if (Lookup == Result.end() || !Lookup->second.count(&Assume)) {
|
||||
Result[Key][&Assume] = {Val, Val};
|
||||
|
@ -383,6 +383,15 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {
|
||||
"(nonnull|align|dereferenceable)"));
|
||||
ASSERT_TRUE(FindExactlyAttributes(Map, Old, ""));
|
||||
}));
|
||||
Tests.push_back(std::make_pair(
|
||||
"call void @llvm.assume(i1 true) [\"align\"(i8* undef, i32 undef)]",
|
||||
[](Instruction *I) {
|
||||
// Don't crash but don't learn from undef.
|
||||
RetainedKnowledgeMap Map;
|
||||
fillMapFromAssume(*cast<IntrinsicInst>(I), Map);
|
||||
|
||||
ASSERT_TRUE(Map.empty());
|
||||
}));
|
||||
RunTest(Head, Tail, Tests);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user