1; RUN: opt %s -passes='default<O0>,globalopt' -S -o - 2 3; This is a regression test against very slow execution... 4; In bad case it should fail by timeout. 5 6; Hand-reduced from this example. 7; clang++ -mllvm -disable-llvm-optzns 8 9;#include <stdio.h> 10; 11;namespace { 12; char LargeBuffer[64 * 1024 * 1024]; 13;} 14; 15;int main ( void ) { 16; 17; LargeBuffer[0] = 0; 18; 19; printf(""); 20; 21; return LargeBuffer[0] == 0; 22;} 23 24; check that global array LargeBufferE was optimized out 25; and local variable LargeBufferE.0 was used instead. 26 27; CHECK-NOT: global 28; CHECK: main() 29; CHECK-NEXT: LargeBufferE.0 30; CHECK-NOT: global 31 32; ModuleID = 'test.cpp' 33source_filename = "test.cpp" 34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 35target triple = "x86_64-unknown-linux-gnu" 36 37@LargeBufferE = internal global [67108864 x i8] zeroinitializer, align 16 38@.str = private unnamed_addr constant [1 x i8] c"\00", align 1 39 40; Function Attrs: norecurse uwtable 41define dso_local i32 @main() #0 { 42 %1 = alloca i32, align 4 43 store i32 0, ptr %1, align 4 44 store i8 0, ptr @LargeBufferE, align 16 45 %2 = call i32 (ptr, ...) @printf(ptr @.str) 46 %3 = load i8, ptr @LargeBufferE, align 16 47 %4 = sext i8 %3 to i32 48 %5 = icmp eq i32 %4, 0 49 %6 = zext i1 %5 to i32 50 ret i32 %6 51} 52 53declare dso_local i32 @printf(ptr, ...) #0 54 55attributes #0 = { norecurse uwtable } 56 57!llvm.module.flags = !{!0} 58!llvm.ident = !{!1} 59 60!0 = !{i32 1, !"wchar_size", i32 4} 61!1 = !{!"clang version 10.0.0 "} 62