[ValueTracking] Calls to @llvm.assume always return
This change teaches llvm::isGuaranteedToTransferExecutionToSuccessor
that calls to @llvm.assume always terminate. Most other relevant
intrinsics should be covered by the "CS.onlyReadsMemory() ||
CS.onlyAccessesArgMemory()" bit but we were missing @llvm.assumes
because we state that it clobbers memory.
Added an LICM test case, but this change is not specific to LICM.
llvm-svn: 272703
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 7e09ec7..7109ff84 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3478,7 +3478,8 @@
// but it's consistent with other passes. See http://llvm.org/PR965 .
// FIXME: This isn't aggressive enough; a call which only writes to a
// global is guaranteed to return.
- return CS.onlyReadsMemory() || CS.onlyAccessesArgMemory();
+ return CS.onlyReadsMemory() || CS.onlyAccessesArgMemory() ||
+ match(I, m_Intrinsic<Intrinsic::assume>());
}
// Other instructions return normally.