From: Manuel Brito Date: Sun, 11 Dec 2022 17:17:34 +0000 (+0000) Subject: Use poison instead of undef where its used as a placeholder [NFC] X-Git-Tag: upstream/17.0.6~24317 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45a892d0124ad430faebd96bc46f8abb0bf4f0dd;p=platform%2Fupstream%2Fllvm.git Use poison instead of undef where its used as a placeholder [NFC] Differential Revision: https://reviews.llvm.org/D139789 --- diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 231e8fe..a514bde 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4107,7 +4107,7 @@ static Value *BuildSubAggregate(Value *From, ArrayRef idx_range, assert(InsertBefore && "Must have someplace to insert!"); Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(), idx_range); - Value *To = UndefValue::get(IndexedType); + Value *To = PoisonValue::get(IndexedType); SmallVector Idxs(idx_range.begin(), idx_range.end()); unsigned IdxSkip = Idxs.size(); diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index 1fcee02..ecdfbbe 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -164,7 +164,7 @@ void SjLjEHPrepare::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal, // There are still some uses of LPI. Construct an aggregate with the exception // values and replace the LPI with that aggregate. Type *LPadType = LPI->getType(); - Value *LPadVal = UndefValue::get(LPadType); + Value *LPadVal = PoisonValue::get(LPadType); auto *SelI = cast(SelVal); IRBuilder<> Builder(SelI->getParent(), std::next(SelI->getIterator())); LPadVal = Builder.CreateInsertValue(LPadVal, ExnVal, 0, "lpad.val"); diff --git a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp index 262d60a..20f32ff 100644 --- a/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp @@ -283,7 +283,7 @@ static void buildUMulWithOverflowFunc(Module *M, Function *UMulFunc) { // umul.with.overflow intrinsic return a structure, where the first element // is the multiplication result, and the second is an overflow bit. Type *StructTy = UMulFunc->getReturnType(); - Value *Agg = IRB.CreateInsertValue(UndefValue::get(StructTy), Mul, {0}); + Value *Agg = IRB.CreateInsertValue(PoisonValue::get(StructTy), Mul, {0}); Value *Res = IRB.CreateInsertValue(Agg, Overflow, {1}); IRB.CreateRet(Res); } diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 9d07ff7..e2fc48b 100644 --- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -801,7 +801,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I, const DataLayout &DL) { } Value *Res = - IRB.CreateInsertValue(UndefValue::get(CASI->getType()), OldVal, 0); + IRB.CreateInsertValue(PoisonValue::get(CASI->getType()), OldVal, 0); Res = IRB.CreateInsertValue(Res, Success, 1); I->replaceAllUsesWith(Res); diff --git a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll index dc86d1e..aab5329 100644 --- a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll +++ b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll @@ -1645,7 +1645,7 @@ entry: ; CHECK-NEXT: {{.*}} = call i64 @__tsan_atomic64_compare_exchange_val(ptr {{.*}}, i64 {{.*}}, i64 {{.*}}, i32 5, i32 5), !dbg ; CHECK-NEXT: {{.*}} = icmp eq i64 ; CHECK-NEXT: {{.*}} = inttoptr i64 {{.*}} to ptr -; CHECK-NEXT: {{.*}} = insertvalue { ptr, i1 } undef, ptr {{.*}}, 0 +; CHECK-NEXT: {{.*}} = insertvalue { ptr, i1 } poison, ptr {{.*}}, 0 ; CHECK-NEXT: {{.*}} = insertvalue { ptr, i1 } {{.*}}, i1 {{.*}}, 1 define i128 @atomic128_load_unordered(ptr %a) nounwind uwtable {