1; RUN: llc -O3 < %s | FileCheck %s 2; 3; Check ADRP instr is not hoisted to entry basic block 4; which may throw exception. 5; 6; CHECK: adrp 7; CHECK: adrp 8; CHECK: adrp 9 10target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 11target triple = "aarch64-arm-none-eabi" 12 13@var = hidden local_unnamed_addr global i32 0, align 4 14@_ZTIi = external dso_local constant i8* 15declare dso_local void @_Z2fnv() local_unnamed_addr #1 16declare dso_local i32 @__gxx_personality_v0(...) 17declare i32 @llvm.eh.typeid.for(i8*) #2 18declare dso_local i8* @__cxa_begin_catch(i8*) local_unnamed_addr 19declare dso_local void @__cxa_end_catch() local_unnamed_addr 20 21define hidden i32 @_Z7examplev() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 22entry: 23 invoke void @_Z2fnv() to label %try.cont unwind label %lpad 24 25lpad: ; preds = %entry 26 %0 = landingpad { i8*, i32 } 27 catch i8* bitcast (i8** @_ZTIi to i8*) 28 catch i8* null 29 %1 = extractvalue { i8*, i32 } %0, 0 30 %2 = extractvalue { i8*, i32 } %0, 1 31 %3 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) 32 %matches = icmp eq i32 %2, %3 33 %4 = tail call i8* @__cxa_begin_catch(i8* %1) 34 %5 = load i32, i32* @var, align 4 35 br i1 %matches, label %catch1, label %catch 36 37catch1: ; preds = %lpad 38 %or3 = or i32 %5, 4 39 store i32 %or3, i32* @var, align 4 40 tail call void @__cxa_end_catch() 41 br label %try.cont 42 43try.cont: ; preds = %entry, %catch1, %catch 44 %6 = load i32, i32* @var, align 4 45 ret i32 %6 46 47catch: ; preds = %lpad 48 %or = or i32 %5, 8 49 store i32 %or, i32* @var, align 4 50 tail call void @__cxa_end_catch() 51 br label %try.cont 52} 53