From 408b703e38a8d9aaa68fc576b105ed35ca955a71 Mon Sep 17 00:00:00 2001 From: Shinji Okumura Date: Sun, 30 Aug 2020 03:23:41 +0900 Subject: [PATCH] [Attributor][NFC] Do not manifest noundef for positions to be changed to undef This patch fixes AANoUndef manifestation. We should not manifest noundef for positions that will be changed to undef. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D86835 --- lib/Transforms/IPO/AttributorAttributes.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Transforms/IPO/AttributorAttributes.cpp b/lib/Transforms/IPO/AttributorAttributes.cpp index 8098379b659..5c4754c5738 100644 --- a/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/lib/Transforms/IPO/AttributorAttributes.cpp @@ -7812,6 +7812,13 @@ struct AANoUndefImpl : AANoUndef { // values. if (A.isAssumedDead(getIRPosition(), nullptr, nullptr)) return ChangeStatus::UNCHANGED; + // A position whose simplified value does not have any value is + // considered to be dead. We don't manifest noundef in such positions for + // the same reason above. + auto &ValueSimplifyAA = A.getAAFor( + *this, getIRPosition(), /* TrackDependence */ false); + if (!ValueSimplifyAA.getAssumedSimplifiedValue(A).hasValue()) + return ChangeStatus::UNCHANGED; return AANoUndef::manifest(A); } };