[Lldb-commits] [PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB
TimNN added a comment. I'm sorry for the noise. Further investigation has shown that this happens when Rust is doing (thin) LTO, and I don't think this patch can be considered in any way "at fault" here, so this is the last you'll hear from me on the topic here. I don't know whether the fault is with how Rust implements (thin) LTO or something on the LLVM side. Basically, after running the `FunctionImporter` on a module, we end up with a `define available_externally void outer` and a `declare void inner`, presumably coming from different modules. `outer` contains the call to `inner` with `poison`, but the parameter is `noundef` on the declaration on `inner`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133036/new/ https://reviews.llvm.org/D133036 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 99a0566 - [lldb][test] Avoid UB in optimized_code test
Author: Arthur Eubanks Date: 2022-11-13T14:21:55-08:00 New Revision: 99a05667217162029d1de84d4a49d041c06be175 URL: https://github.com/llvm/llvm-project/commit/99a05667217162029d1de84d4a49d041c06be175 DIFF: https://github.com/llvm/llvm-project/commit/99a05667217162029d1de84d4a49d041c06be175.diff LOG: [lldb][test] Avoid UB in optimized_code test Added: Modified: lldb/test/API/functionalities/optimized_code/main.cpp Removed: diff --git a/lldb/test/API/functionalities/optimized_code/main.cpp b/lldb/test/API/functionalities/optimized_code/main.cpp index f1beaf3020d50..b318a92dfae84 100644 --- a/lldb/test/API/functionalities/optimized_code/main.cpp +++ b/lldb/test/API/functionalities/optimized_code/main.cpp @@ -11,8 +11,9 @@ struct S1 { }; struct S2 { - char a, b; - int pad; + char a = 0; + char b = 0; + int pad = 0; S2(int x) { a = x & 0xff; b = x & 0xff00; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB
aeubanks updated this revision to Diff 475017. aeubanks added a comment. I somehow missed the previous comments rebased on top of fixing UB in tests changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133036/new/ https://reviews.llvm.org/D133036 Files: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/test/Transforms/InstCombine/call-undef.ll llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll Index: llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll === --- llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll +++ llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll @@ -6,7 +6,7 @@ ; CHECK-LABEL: @test_out_of_bounds( ; CHECK-NEXT: entry: ; CHECK-NEXT:[[AND1:%.*]] = and i32 [[A:%.*]], 3 -; CHECK-NEXT:tail call void @llvm.assume(i1 poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret i32 [[AND1]] ; entry: @@ -20,7 +20,7 @@ define i128 @test_non64bit(i128 %a) { ; CHECK-LABEL: @test_non64bit( ; CHECK-NEXT:[[AND1:%.*]] = and i128 [[A:%.*]], 3 -; CHECK-NEXT:tail call void @llvm.assume(i1 poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret i128 [[AND1]] ; %and1 = and i128 %a, 3 Index: llvm/test/Transforms/InstCombine/call-undef.ll === --- llvm/test/Transforms/InstCombine/call-undef.ll +++ llvm/test/Transforms/InstCombine/call-undef.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -passes=instcombine -S | FileCheck %s +; RUN: opt < %s -passes=instcombine -S -instcombine-disable-optimize-passing-undef-ub | FileCheck %s --check-prefix=DISABLE declare void @c(i32 noundef) declare void @d(ptr dereferenceable(1)) @@ -8,8 +9,12 @@ define void @test1() { ; CHECK-LABEL: @test1( -; CHECK-NEXT:call void @c(i32 undef) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test1( +; DISABLE-NEXT:call void @c(i32 undef) +; DISABLE-NEXT:ret void ; call void @c(i32 undef) ret void @@ -17,8 +22,12 @@ define void @test2() { ; CHECK-LABEL: @test2( -; CHECK-NEXT:call void @c(i32 poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test2( +; DISABLE-NEXT:call void @c(i32 poison) +; DISABLE-NEXT:ret void ; call void @c(i32 poison) ret void @@ -26,8 +35,12 @@ define void @test3() { ; CHECK-LABEL: @test3( -; CHECK-NEXT:call void @e(i32 noundef undef) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test3( +; DISABLE-NEXT:call void @e(i32 noundef undef) +; DISABLE-NEXT:ret void ; call void @e(i32 noundef undef) ret void @@ -35,8 +48,12 @@ define void @test4() { ; CHECK-LABEL: @test4( -; CHECK-NEXT:call void @e(i32 noundef poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test4( +; DISABLE-NEXT:call void @e(i32 noundef poison) +; DISABLE-NEXT:ret void ; call void @e(i32 noundef poison) ret void @@ -44,8 +61,12 @@ define void @test5() { ; CHECK-LABEL: @test5( -; CHECK-NEXT:call void @d(ptr undef) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test5( +; DISABLE-NEXT:call void @d(ptr undef) +; DISABLE-NEXT:ret void ; call void @d(ptr undef) ret void @@ -53,8 +74,12 @@ define void @test6() { ; CHECK-LABEL: @test6( -; CHECK-NEXT:call void @d(ptr poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test6( +; DISABLE-NEXT:call void @d(ptr poison) +; DISABLE-NEXT:ret void ; call void @d(ptr poison) ret void @@ -62,8 +87,12 @@ define void @test7() { ; CHECK-LABEL: @test7( -; CHECK-NEXT:call void @f(ptr dereferenceable(1) undef) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test7( +; DISABLE-NEXT:call void @f(ptr dereferenceable(1) undef) +; DISABLE-NEXT:ret void ; call void @f(ptr dereferenceable(1) undef) ret void @@ -71,17 +100,38 @@ define void @test8() { ; CHECK-LABEL: @test8( -; CHECK-NEXT:call void @f(ptr dereferenceable(1) poison) +; CHECK-NEXT:store i1 true, ptr poison, align 1 ; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test8( +; DISABLE-NEXT:call void @f(ptr dereferenceable(1) poison) +; DISABLE-NEXT:ret void ; call void @f(ptr dereferenceable(1) poison) ret void } +define void @test9() sanitize_memory { +; CHECK-LABEL: @test9( +; CHECK-NEXT:call void @c(i32 undef) +; CHECK-NEXT:ret void +; +; DISABLE-LABEL: @test9( +; DISABLE-NEXT:call void @c(i32 undef) +; DISABLE-NEXT:ret void +;
[Lldb-commits] [lldb] 1239d37 - [lldb] Remove unused `stack_memory_dump` member from ScriptedProcess class (NFC)
Author: Med Ismail Bennani Date: 2022-11-13T22:06:09-08:00 New Revision: 1239d37bdbfbe79289a2fc578aad8360f84c315d URL: https://github.com/llvm/llvm-project/commit/1239d37bdbfbe79289a2fc578aad8360f84c315d DIFF: https://github.com/llvm/llvm-project/commit/1239d37bdbfbe79289a2fc578aad8360f84c315d.diff LOG: [lldb] Remove unused `stack_memory_dump` member from ScriptedProcess class (NFC) Signed-off-by: Med Ismail Bennani Added: Modified: lldb/examples/python/scripted_process/scripted_process.py Removed: diff --git a/lldb/examples/python/scripted_process/scripted_process.py b/lldb/examples/python/scripted_process/scripted_process.py index 43eb97dbd772..585cf0bae6a3 100644 --- a/lldb/examples/python/scripted_process/scripted_process.py +++ b/lldb/examples/python/scripted_process/scripted_process.py @@ -15,7 +15,6 @@ class ScriptedProcess(metaclass=ABCMeta): """ memory_regions = None -stack_memory_dump = None loaded_images = None threads = None metadata = None ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e85c723 - [lldb] Re-phase comments in `ScriptedThread.get_stackframes` method (NFC)
Author: Med Ismail Bennani Date: 2022-11-13T22:19:14-08:00 New Revision: e85c7233b429004faed2472e300abe40c4ab7cf3 URL: https://github.com/llvm/llvm-project/commit/e85c7233b429004faed2472e300abe40c4ab7cf3 DIFF: https://github.com/llvm/llvm-project/commit/e85c7233b429004faed2472e300abe40c4ab7cf3.diff LOG: [lldb] Re-phase comments in `ScriptedThread.get_stackframes` method (NFC) Signed-off-by: Med Ismail Bennani Added: Modified: lldb/examples/python/scripted_process/scripted_process.py Removed: diff --git a/lldb/examples/python/scripted_process/scripted_process.py b/lldb/examples/python/scripted_process/scripted_process.py index 585cf0bae6a3..29dbd04fd4d5 100644 --- a/lldb/examples/python/scripted_process/scripted_process.py +++ b/lldb/examples/python/scripted_process/scripted_process.py @@ -306,19 +306,16 @@ def get_stackframes(self): """ Get the list of stack frames for the scripted thread. ``` -class ScriptedStackFrame: -def __init__(idx, cfa, pc, symbol_ctx): -self.idx = idx -self.cfa = cfa -self.pc = pc -self.symbol_ctx = symbol_ctx +scripted_frame = { +idx = 0, +pc = 0xbadc0ffee +} ``` Returns: -List[ScriptedFrame]: A list of `ScriptedStackFrame` -containing for each entry, the frame index, the canonical -frame address, the program counter value for that frame -and a symbol context. +List[scripted_frame]: A list of `scripted_frame` dictionaries +containing at least for each entry, the frame index and +the program counter value for that frame. The list can be empty. """ return self.frames ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits