[llvm] [SDAG] Lower range attribute to AssertZext (PR #95450)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 14:00:17 PDT 2024
================
@@ -4487,6 +4487,18 @@ static const MDNode *getRangeMetadata(const Instruction &I) {
return I.getMetadata(LLVMContext::MD_range);
}
+static std::optional<ConstantRange> getRange(const Instruction &I) {
+ if (const auto *CB = dyn_cast<CallBase>(&I)) {
+ // see comment in getRangeMetadata about this check
+ if (CB->hasRetAttr(Attribute::NoUndef))
+ return CB->getRange();
+ }
+ if (const MDNode *Range = getRangeMetadata(I)) {
+ return getConstantRangeFromMetadata(*Range);
+ }
----------------
nikic wrote:
Remove braces.
https://github.com/llvm/llvm-project/pull/95450
More information about the llvm-commits
mailing list