================
@@ -71,13 +81,66 @@ bool tryReplaceAliasWithAliasee(GlobalAlias &GA) {
return true;
}
+bool tryAssignPredicateSpecConstIDs(Module &M, Function *F) {
+ StringMap<unsigned> IDs;
+
+ // Replace placeholder Specialisation Constant IDs with unique IDs associated
+ // with the predicate being evaluated, which is encoded in the call name.
+ for (auto &&U : F->users()) {
+ if (!isa<CallInst>(U))
+ continue;
+
+ auto *CI = cast<CallInst>(U);
+
+ if (!isa<ConstantInt>(CI->getArgOperand(0)))
+ continue;
+
+ unsigned ID = cast<ConstantInt>(CI->getArgOperand(0))->getZExtValue();
+
+ if (ID != UINT32_MAX)
+ continue;
+
+ StringRef Name = CI->getName().substr(0, CI->getName().rfind('.'));
+ ID = IDs.try_emplace(Name, IDs.size()).first->second;
----------------
jmmartinez wrote:
From `Driver/Clang.cpp`
```cpp
#ifdef NDEBUG
const bool IsAssertBuild = false;
#else
const bool IsAssertBuild = true;
#endif
// Discard value names in no-asserts builds unless otherwise specified.
if (Args.hasFlag(options::OPT_fdiscard_value_names,
options::OPT_fno_discard_value_names, !IsAssertBuild)) {
if (Args.hasArg(options::OPT_fdiscard_value_names) &&
llvm::any_of(Inputs, [](const clang::driver::InputInfo &II) {
return types::isLLVMIR(II.getType());
})) {
D.Diag(diag::warn_ignoring_fdiscard_for_bitcode);
}
CmdArgs.push_back("-discard-value-names");
}
```
https://github.com/llvm/llvm-project/pull/134016
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits