[llvm] d32cc15 - [BasicAA] Handle PHIs without incoming values gracefully
Daniil Suchkov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 14:40:53 PDT 2021
Author: Daniil Suchkov
Date: 2021-06-07T21:39:01Z
New Revision: d32cc150feb72f315a5bbd34f92e7beca21a50da
URL: https://github.com/llvm/llvm-project/commit/d32cc150feb72f315a5bbd34f92e7beca21a50da
DIFF: https://github.com/llvm/llvm-project/commit/d32cc150feb72f315a5bbd34f92e7beca21a50da.diff
LOG: [BasicAA] Handle PHIs without incoming values gracefully
Fix a bug introduced by f6f6f6375d1a4bced8a6e79a78726ab32b8dd879.
Now for empty PHIs, instead of crashing on assert(hasVal()) in
Optional's internals, we'll return NoAlias, as we did before that patch.
Differential Revision: https://reviews.llvm.org/D103831
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index dec7fcbfb3366..356259fe5a7a8 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1293,6 +1293,8 @@ BasicAAResult::aliasSelect(const SelectInst *SI, LocationSize SISize,
AliasResult BasicAAResult::aliasPHI(const PHINode *PN, LocationSize PNSize,
const Value *V2, LocationSize V2Size,
AAQueryInfo &AAQI) {
+ if (!PN->getNumIncomingValues())
+ return AliasResult::NoAlias;
// If the values are PHIs in the same block, we can do a more precise
// as well as efficient check: just check for aliases between the values
// on corresponding edges.
diff --git a/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll b/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
index 10de852c26571..5bcd0018de6f4 100644
--- a/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
+++ b/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
@@ -1,4 +1,3 @@
-; XFAIL: *
; REQUIRES: asserts
; RUN: opt -jump-threading -aa-pipeline basic-aa -S -disable-output %s
; RUN: opt -passes=jump-threading -aa-pipeline basic-aa -S -disable-output %s
More information about the llvm-commits
mailing list