if (isMemTerminator(DefLoc, UseInst))
continue;
+ if (UseInst->mayThrow() && !isInvisibleToCallerBeforeRet(DefUO)) {
+ LLVM_DEBUG(dbgs() << " ... found throwing instruction\n");
+ Cache.KnownReads.insert(UseAccess);
+ Cache.KnownReads.insert(StartAccess);
+ Cache.KnownReads.insert(EarlierAccess);
+ return None;
+ }
+
// Uses which may read the original MemoryDef mean we cannot eliminate the
// original MD. Stop walk.
if (isReadClobber(DefLoc, UseInst)) {
ret void
}
-
+; We cannot remove the store in the entry block, because @unknown_func could
+; unwind and the stored value could be read by the caller.
define void @test17(i32* noalias %P) {
; CHECK-LABEL: @test17(
; CHECK-NEXT: [[P2:%.*]] = bitcast i32* [[P:%.*]] to i8*
+; CHECK-NEXT: store i32 1, i32* [[P]], align 4
; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB3:%.*]]
; CHECK: bb1:
; CHECK-NEXT: call void @unknown_func()
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; XFAIL: *
; RUN: opt < %s -basic-aa -dse -enable-dse-memoryssa -S | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"