1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s 2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i386-mingw32 -fms-extensions -emit-llvm -o - %s | FileCheck %s 3*0a6a1f1dSLionel Sambuc 4*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test1 test1(int * a,int i)5*0a6a1f1dSLionel Sambucint test1(int *a, int i) { 6*0a6a1f1dSLionel Sambuc // CHECK: store i32* %a, i32** [[A_ADDR:%.+]], align 7*0a6a1f1dSLionel Sambuc // CHECK: [[A:%.+]] = load i32** [[A_ADDR]] 8*0a6a1f1dSLionel Sambuc // CHECK: [[CMP:%.+]] = icmp ne i32* [[A]], null 9*0a6a1f1dSLionel Sambuc // CHECK: call void @llvm.assume(i1 [[CMP]]) 10*0a6a1f1dSLionel Sambuc #ifdef _MSC_VER 11*0a6a1f1dSLionel Sambuc __assume(a != 0) 12*0a6a1f1dSLionel Sambuc #else 13*0a6a1f1dSLionel Sambuc __builtin_assume(a != 0); 14*0a6a1f1dSLionel Sambuc #endif 15*0a6a1f1dSLionel Sambuc 16*0a6a1f1dSLionel Sambuc // Nothing is generated for an assume with side effects... 17*0a6a1f1dSLionel Sambuc // CHECK-NOT: load i32** %i.addr 18*0a6a1f1dSLionel Sambuc // CHECK-NOT: call void @llvm.assume 19*0a6a1f1dSLionel Sambuc #ifdef _MSC_VER 20*0a6a1f1dSLionel Sambuc __assume(++i != 0) 21*0a6a1f1dSLionel Sambuc #else 22*0a6a1f1dSLionel Sambuc __builtin_assume(++i != 0); 23*0a6a1f1dSLionel Sambuc #endif 24*0a6a1f1dSLionel Sambuc 25*0a6a1f1dSLionel Sambuc return a[0]; 26*0a6a1f1dSLionel Sambuc } 27*0a6a1f1dSLionel Sambuc 28