diff --git a/builtins/util.m4 b/builtins/util.m4 index f395b6bc..ad0149ad 100644 --- a/builtins/util.m4 +++ b/builtins/util.m4 @@ -1497,7 +1497,12 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp, per_lane($1, <$1 x MASK> %mask, ` %cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE %val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE - %r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst + ifelse(LLVM_VERSION,LLVM_3_5,` + %r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst + ',` + %r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst + ') + %rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE store $2 %r_LANE_ID, $2 * %rp_LANE_ID') @@ -1507,7 +1512,11 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp, define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp, $2 %val) nounwind alwaysinline { - %r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst + ifelse(LLVM_VERSION,LLVM_3_5,` + %r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst + ',` + %r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst + ') ret $2 %r } ') diff --git a/cbackend.cpp b/cbackend.cpp index 8fc3b4ed..cb56cb82 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -464,7 +464,11 @@ namespace { // Must not be used in inline asm, extractelement, or shufflevector. if (I.hasOneUse()) { +#if defined(LLVM_3_5) + const llvm::Instruction &User = llvm::cast(*I.user_back()); +#else const llvm::Instruction &User = llvm::cast(*I.use_back()); +#endif if (isInlineAsm(User) || llvm::isa(User) || llvm::isa(User) || llvm::isa(User) || llvm::isa(User)) @@ -472,7 +476,11 @@ namespace { } // Only inline instruction it if it's use is in the same BB as the inst. +#if defined(LLVM_3_5) + return I.getParent() == llvm::cast(I.user_back())->getParent(); +#else return I.getParent() == llvm::cast(I.use_back())->getParent(); +#endif } // isDirectAlloca - Define fixed sized allocas in the entry block as direct diff --git a/module.cpp b/module.cpp index 014b7f5f..6aeeddfd 100644 --- a/module.cpp +++ b/module.cpp @@ -2099,12 +2099,12 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre } } -#if defined(LLVM_3_1) - inst.getLangOpts().BCPLComment = 1; -#else inst.getLangOpts().LineComment = 1; -#endif +#if defined(LLVM_3_5) + inst.createPreprocessor(clang::TU_Complete); +#else inst.createPreprocessor(); +#endif diagPrinter->BeginSourceFile(inst.getLangOpts(), &inst.getPreprocessor()); clang::DoPrintPreprocessedInput(inst.getPreprocessor(),